mIRC Home    About    Download    Register    News    Help

Print Thread
Counting repeating phrases #261594 21/10/17 09:54 PM
Joined: Oct 2017
Posts: 14
K
Kex Offline OP
Pikka bird
OP Offline
Pikka bird
K
Joined: Oct 2017
Posts: 14
Hello everyone, is it possible to implement the script to read the file, then scan the most repetitive words in it, an exemple part of code :
Code:
 timerlawl 1 5 msg $chan $nick $read(test.ini)  %nick1 $+
  /write  stats.txt %nick1
the script is executed and %nick1 write in file, %nick1 -random, respectively data is written different and each on a new line, I need the script to scan each line and give the number of matches of a line and gave the result to the chat? Is possible in mIrc?

Last edited by Kex; 21/10/17 10:37 PM.
Re: Counting repeating phrases [Re: Kex] #261595 21/10/17 11:51 PM
Joined: Jan 2004
Posts: 1,638
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,638
It's hard to understand what you're asking for. You need to be careful about using $read without the -nt switches, as you can cause a line containing the text $version be replaced by the result of that identifier.

If you are wanting to find out how many lines of a text file is exactly a known word:

//filter -fw versions.txt @test word | echo -a $filtered

Number of lines containing a string:

//filter -fw versions.txt @test *word* | echo -a $filtered

(Note this finds password and sword)

Number of lines beginning with a word and a space and other words:

//filter -fw versions.txt @test word * | echo -a $filtered

If you want to scan a file for whichever is the most common line, you could make a hash table or @window to contain each word found, along with a counter of how many times that word/line appears.

edit: instead of creating a junk @window for the output, you can use the bit-bucket $null alias:

//filter -fk versions.txt null word | echo -a $filtered

Last edited by maroon; 22/10/17 12:24 AM.
Re: Counting repeating phrases [Re: maroon] #261596 22/10/17 11:30 AM
Joined: Oct 2017
Posts: 14
K
Kex Offline OP
Pikka bird
OP Offline
Pikka bird
K
Joined: Oct 2017
Posts: 14
Originally Posted By: maroon
If you want to scan a file for whichever is the most common line, you could make a hash table or @window to contain each word found, along with a counter of how many times that word/line appears.

edit: instead of creating a junk @window for the output, you can use the bit-bucket $null alias:

//filter -fk versions.txt null word | echo -a $filtered

Thnx, it's what i needed! Will try realize that. And thnx for -nt switches. And sorry for my language skill :->

Last edited by Kex; 22/10/17 12:13 PM.