Kenneth Heafield
unread,Jun 28, 2013, 9:56:14 AM6/28/13Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to jane-...@googlegroups.com
Dear Jane,
In LMInterface.cpp, the documentation provided to the user says "Default: autodetect. Note however that auto-detection fails for the randlm LM type." This is not quite true: it also fails for kenlm. I note you're calling lm::ngram::RecognizeBinary(fname.c_str(), modelType) to classify the type of kenlm. It will also return false if it's not one of my binary files. So can I convince you to autodetect?
Change
if (userType == LMInterface::autodetectType) {
if (identifier == "\\data\\" || identifier.substr(0, 18) == "SRILM_BINARY_NGRAM")
lm = new SriLMInterface(config, fname, externalAlphabet);
else
lm = new BinaryLMInterface(config, fname, externalAlphabet);
fp.close();
} else {
to
lm::ngram::ModelType modelType;
if (userType == LMInterface::autodetectType) {
if (identifier == "\\data\\" || identifier.substr(0, 18) == "SRILM_BINARY_NGRAM")
userType = LMInterface::sriLmType;
else if (lm::ngram::RecognizeBinary(fname.c_str(), modelType))
userType = LMInterface::kenLmType;
else
userType = LMInterface::janeLmType;
}
{
Then presumably remove the spurious braces and indentation.
Kenneth