<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 8/19/2017 1:56 AM, Shreya Singh
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CA+Y9mv4Z=7Ken7LHikd9behwDD1fLUeFVSkyti7GDN5ZdDUzWg@mail.gmail.com">
<div dir="ltr">
<div>Hi,<br>
</div>
I would like to know whether there is a command for combining
more than two language models in srilm. i know for only two lms
the command is :<br>
<pre>ngram -order N -lm LM1 -mix-lm LM2 -lambda W -write-lm MIXLM
<span class="gmail-"></span>Where N is the maximum ngram order in the two LMs, LM1, LM2 are the
input models, W is the weight to give to LM1, and MIXLM is the merged
model file.
</pre>
<pre><font face="arial,helvetica,sans-serif">what should i use for more than two lms?
</font></pre>
</div>
</blockquote>
<br>
ngram -order N \<br>
-lm LM0 -lambda W0 \<br>
-mix-lm LM1 \<br>
-mix-lm2 LM2 -mix-lambda2 W2 \<br>
-mix-lm3 LM3 -mix-lambda3 W3 \<br>
... <br>
-mix-lm9 LM9 -mix-lambda9 W9 \<br>
-write-lm MIXLM<br>
<br>
As you can see there is no option for the weight of LM1, since that
is implicitly given by 1 minus the sum of the other weights.<br>
<br>
Because this syntax is a little inconsistent and limited to 10
models, there is also a more general mechanism, which reads the
model specification from a file. Here is the relevant section from
the ngram(1) man page:<br>
<br>
<blockquote type="cite"> -read-mix-lms<br>
Read a list of linearly interpolated (mixture) LMs
and their weights from the file specified with -lm, instead of
gathering<br>
this information from the command line options
above. Each line in file starts with the filename containing the
component<br>
LM, followed by zero or more component-specific
options:<br>
<br>
-weight W the prior weight given to the
component LM<br>
<br>
-order N the maximal ngram order to use<br>
<br>
-type T the LM type, one of ARPA (the
default), COUNTLM, MAXENT, LMCLIENT, or MSWEBLM<br>
<br>
-classes C the word class definitions for the
component LM (which must be of type ARPA)<br>
<br>
-cache-served-ngrams<br>
enables client-side caching for LMs
of type LMCLIENT or MSWEBLM.<br>
<br>
The global options -bayes, -bayes-scale, and
-context-priors still apply with -read-mix-lms. When -bayes is
NOT used, the<br>
interpolation is static by ngram merging, and forces
all component LMs to be of type ARPA or MAXENT.<br>
<br>
-cache length</blockquote>
Note the file from which the model specification is read must be
given with the -lm file option.<br>
<br>
Andreas<br>
<br>
<br>
</body>
</html>