[SRILM User List] merging two language models

Andreas Stolcke stolcke at icsi.berkeley.edu
Tue Sep 23 20:23:31 PDT 2014


On 9/23/2014 5:41 PM, Shahram wrote:
> Hi,
>
> Is there any way I can merge two language models?
> I don't have access to the actual text of the two language models, so 
> I guess I cannot create the N-gram count of them to use in ngram-merge 
> tool. I wan wondering if I can merge the two language models together 
> and create a single LM out of them?
You can merge two ngram backoff LMs using

ngram -order N  -lm LM1  -mix-lm LM2 -lambda W -write-lm MIXLM

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.

Using appropriate options you can merge more than 2 LMs.  Check out the 
ngram man page description of options
-mix-lm2 etc.
-mix-lambda2 etc.
-read-mix-lms
and related options.

Andreas




More information about the SRILM-User mailing list