[SRILM User List] Perl client-server with SWIG and SRILM

Andreas Stolcke stolcke at speech.sri.com
Sun May 16 23:51:53 PDT 2010


Manuel Alves wrote:
> Sorry again.
>
> I want to use this function in Perl but i dont know how to call it 
> because i think it needs a point
>
> float getWordProb(Ngram* ngram, unsigned w, unsigned* context) {
>     return (float)ngram->wordProb(w, context);
> }
>
> The variable _context_ it seems a point to a string.
> How do i call it  in perl?
> it seems to me that perl doesnt use much the pointers.
> Thanks ,
You could write a c++ or c wrapper that accepts a fixed set of 
VocabIndex arguments, and translates them into the representation 
expected by wordProb.

Sort of like the function trigram_logprob(() in 
$SRILM/lm/src/simpleTrigram.cc

Then interface with that wrapper function in SWIG.

Andreas




More information about the SRILM-User mailing list