(27-08-2021, 01:00 PM)MarcoP wrote: You are not allowed to view links. Register or Login to view.1.As Patrick said, it could be that there are differences in how the mapping to 10 positions is done; I used this method (where i is word position in the range 0..lineLength-1):
pos=1+int(round(9.0*i/float(lineLength-1)))
I am not sure this is exactly what Patrick did, but it appears to be close enough.
Yes, thanks, rounding could be the issue, I did it differently: int(10*(i-1)/NF) to get the index in [0-9].
@awk -F '.' "BEGIN {} {for (i=1; i<=NF; i++) {if (substr($i, 0, 1) == \"o\") {cc++; cpo[int(10*(i-1)/NF)]++} if (length($i) > 1 && substr($i, 0, 2) == \"qo\") {cc++; cpqo[int(10*(i-1)/NF)]++}}} END {for (i=0; i<10; i++) print cpo[i]/cc\"\t\"cpqo[i]/cc}" zl_paragraphs_no_formatting.txt
As you can see I'm dividing the counts by cc, the total count of qo + o words. To check, the total line sums correctly to 1.

