[SRILM User List] Using SRILM for text classification
Andreas Stolcke
stolcke at icsi.berkeley.edu
Sun Jun 3 19:17:12 PDT 2012
On 6/3/2012 12:40 PM, Ali Asghar Toraby Parizy wrote:
> Hi
> Thanks for your reply.
> I'm trying to use ngram program to compute perplexity for several
> files in a directory. As you said I'm trying to build a simple shell
> script for that. ngram prints a large output but I only need
> perplexity as a number then I can save those numbers in a loop for
> every model and then compare those numbers. Something like this:
>
> for j in $models
> do
> echo model: $j
> ngram -lm $j -ppl $i
> done
>
> How can I adjust ngram to print only a number instead of this kind of
> output:
>
> file testfiles/test.test: 427 sentences, 2433 words, 1184 OOVs
> 0 zeroprobs, logprob= -5075.52 ppl= 1067.47 ppl1= 11578.9
>
> I need only number 1067.47 in this case!
Use any of a number of Unix/Linux text processing tools, like awk, perl,
python, etc.
Andreas
More information about the SRILM-User
mailing list