<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 3/8/2013 8:06 AM, Yi Yang wrote:<br>
</div>
<blockquote
cite="mid:CAKNTL4g7nOWVHNS5P3VgrrqzzsAxk389LH4pcDs5PYziPkUJ=A@mail.gmail.com"
type="cite">
<div dir="ltr">Hi Mohsen,
<div><br>
</div>
<div>Hope the following codes can be helpful:</div>
</div>
</blockquote>
you forgot to create the Vocab object. In your case you could
create it globally to your code works otherwise:<br>
<br>
Vocab vocab;<br>
<br>
Andreas<br>
<br>
<blockquote
cite="mid:CAKNTL4g7nOWVHNS5P3VgrrqzzsAxk389LH4pcDs5PYziPkUJ=A@mail.gmail.com"
type="cite">
<div dir="ltr">
<div><br>
</div>
<div>
<div>void SrilmTest::srilm_init(const char* fname, int order)
{</div>
<div> File file(fname, "r", 0);</div>
<div> assert(file);</div>
</div>
</div>
</blockquote>
<br>
<blockquote
cite="mid:CAKNTL4g7nOWVHNS5P3VgrrqzzsAxk389LH4pcDs5PYziPkUJ=A@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>
<div> ngram = new Ngram(vocab, order);</div>
<div> ngram->read(file, false);</div>
<div> cerr << "Done\n";</div>
<div>}</div>
<div><br>
</div>
<div>int SrilmTest::srilm_getvoc(const char* word) {</div>
<div> return vocab.getIndex((VocabString)word);</div>
<div>}</div>
<div><br>
</div>
<div>float SrilmTest::srilm_wordprob(int w, int* context) {</div>
<div> return (float)ngram->wordProb(w,
(VocabIndex*)context);</div>
<div>
}</div>
</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Thu, Mar 7, 2013 at 3:23 PM, mohsen
jadidi <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:mohsen.jadidi@gmail.com" target="_blank">mohsen.jadidi@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hey,
<div><br>
</div>
<div>I need to use srilm in my c++ code to build ML. all
the examples and slides in the internet explained it
using ngram-count command not code. I know should use
<Ngram.h> <Vocab.h>. can you point me to a
starting point?</div>
<div><br>
</div>
<div>cheers,</div>
<span class="HOEnZb"><font color="#888888">
<div>
<div><br>
</div>
<div><br>
</div>
-- <br>
Mohsen<br>
</div>
</font></span></div>
<br>
_______________________________________________<br>
SRILM-User site list<br>
<a moz-do-not-send="true"
href="mailto:SRILM-User@speech.sri.com">SRILM-User@speech.sri.com</a><br>
<a moz-do-not-send="true"
href="http://www.speech.sri.com/mailman/listinfo/srilm-user"
target="_blank">http://www.speech.sri.com/mailman/listinfo/srilm-user</a><br>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
Sincerely,<br>
Yi Yang<br>
<a moz-do-not-send="true"
href="http://www.cc.gatech.edu/%7Eyyang319/" target="_blank">http://www.cc.gatech.edu/~yyang319/</a><br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
SRILM-User site list
<a class="moz-txt-link-abbreviated" href="mailto:SRILM-User@speech.sri.com">SRILM-User@speech.sri.com</a>
<a class="moz-txt-link-freetext" href="http://www.speech.sri.com/mailman/listinfo/srilm-user">http://www.speech.sri.com/mailman/listinfo/srilm-user</a></pre>
</blockquote>
<br>
</body>
</html>