Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to convert LM's binary model to arpa file #3777

Open
wwfcnu opened this issue Aug 31, 2023 · 2 comments
Open

how to convert LM's binary model to arpa file #3777

wwfcnu opened this issue Aug 31, 2023 · 2 comments

Comments

@wwfcnu
Copy link

wwfcnu commented Aug 31, 2023

how to convert LM's binary model to arpa file

@aadarsh-nagrath
Copy link

Well it may involves several steps, and the exact process may vary depending on the specific LM format and tools you have available.
Although I can try give u a general guideline for converting a binary LM to an ARPA file:

Identify the Binary LM Format. Different tools and frameworks may use different binary formats, and the conversion process may vary accordingly. Install Required Software. Common tools for language modeling include SRILM and KenLM.

If your binary LM is in the SRILM format, you can use SRILM's utilities to convert it to ARPA. Here's an example command:

ngram -lm binary_lm_file -order N -ppl test_corpus.txt

Replace binary_lm_file with the path to your binary LM file and N with the LM order test_corpus.txt should be replaced with the path to a text corpus that will be used to generate the ARPA file. The -ppl flag is used to specify that you want to compute perplexity, which will also create the ARPA file.

Note that - If your binary LM is in the KenLM format, you can use KenLM's bin2arpa tool to convert it to ARPA:

bin2arpa binary_lm_file > arpa_lm_file.arpa
Replace binary_lm_file with the path to your binary LM file, and arpa_lm_file.arpa with the desired name for the resulting ARPA file.

Depending on your specific use case, you may need to perform additional preprocessing on the ARPA file, such as removing certain entries or adjusting probabilities.

Keep in mind that the exact steps and tools may vary depending on the binary LM format and the toolkit used. Make sure to refer to the documentation of the specific toolkit you are working with for detailed instructions.

Hope it helps!

@wwfcnu
Copy link
Author

wwfcnu commented Sep 27, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@aadarsh-nagrath @wwfcnu and others