mIRC Homepage

Counting repeating phrases

Posted By: Kex

Counting repeating phrases - 21/10/17 09:54 PM

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?
Posted By: maroon

Re: Counting repeating phrases - 21/10/17 11:51 PM

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
Posted By: Kex

Re: Counting repeating phrases - 22/10/17 11:30 AM

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 :->
© 2021 mIRC Discussion Forums