Set up kenlm for Windows

2.2k views Asked by At

The official website makes it pretty clear that there is no support for kenlm in Windows. There is a Windows tag at the github repository but it seems to be maintained by few random contributors then and there.

How to set up kenlm for Windows then?

3

There are 3 answers

0
Bendemann On BEST ANSWER

The solution is to use Ubuntu in Windows through Windows Subsystem for Linux

  1. Get WSL for Windows
  2. From your ubuntu bash navigate to the folder where you want to do the setup. You can access the Windows file system from the /mnt/c/ folder, which you can find at the root directory.
  3. From there simply follow the official instructions, that is clone the git repo, and run cmake .. & make -j2 in order to build the project (after first making the necessary installations in your Ubuntu system).

Obviously, you must train the models or scorers using the Linux bash. You can also use these models from Windows using the kenlm python library.

E.g.

The two steps to build a scorer for the deepspeech-model as described here should be executed from your Ubuntu system. But after you have the scorer you should be able to run the command

deepspeech --model deepspeech-0.9.3-models.pbmm --scorer kenlm.scorer --audio audio.wav

from Windows. However, once you have WSL there's no need to do this work from Windows. Things will work nicely @your Ubuntu system.

0
Kathy Reid On

The new DeepSpeech PlayBook also includes instructions for setting up a Docker image and running training from within a Docker container. If you have Docker on Windows, this might be another solution.

The information for building a new Scorer is still in a PR, but may also be useful.

0
Nikita  Makarov On

I've faced the same problem and solved it by building kenlm wheel from Cygwin terminal as home page advices (pip wheel pypi-kenlm).

I've also uploaded wheel to pypi called kenlm-cygwin, but it's only python3.7.