DEV Community

Installing Finite-State Transducer (FST) tools on Windows

Finite-state transducers (FSTs) are often used in linguistics to create morphological models of a language, which can both parse words in that language and return a morphological analysis, and accept a morphological analysis and produce a grammatically correct word. While FSTs and computational models sound complex, they're actually fairly straightforward! You don't need to have advanced computational skills. The most difficult part is in fact the grammatical analysis of the language rather than implementing that analysis as an FST. Any linguist can create an FST.

In this post I'll show you how to install the two most common tools for creating FSTs—foma and hfst—on Windows. (If you're on Mac or Linux, those links also have installation instructions for those platforms.)


  1. Download foma by going to the foma home page > Precompiled binaries for Win32, OSX, Linux > foma-X.X.X_win32.zip (where the X's are the latest version numbers).

  2. Download hfst by going to the hfst home page > download page > win32 executables > hfst-latest.zip.

  3. Extract the zip file for both downloads.

  4. Rename the folder in the foma download from win32 to foma.

  5. Move both extracted folders to C:\Program Files (x86), like so:

  • C:\Program Files (x86)\foma
  • C:\Program Files (x86)\hfst

Next you need to make the foma and hfst commands available to run from the terminal / command line. Neither foma nor hfst have a graphical user interface, so you run them by opening a command line (press the Windows key, then type "command", and open the Command Prompt program that is shown) and typing simple text commands that begin with foma or hfst. At the moment, however, if you open a command line, no foma or hfst commands are available. So let's fix that:

  1. Press the Windows key and type "path". One of the options should be "Edit the system environment variables"—open that. (If that option doesn't appear, search for "path" or "environment variables" in Settings.)

  2. A System Properties dialog box will open. Click Environment Variables in the lower right.

  3. An Environment Variables dialog box will open. Under User variables for {username}, click on Path and then click Edit.

  4. You will now add the paths to the foma and hfst executables that you placed in Program Files earlier. Do this by clicking New and adding a line for each. Note that for hfst you also need to add \bin to the path, like so:

  • C:\Program Files (x86)\foma
  • C:\Program Files (x86)\hfst\bin

The command line should now know about the existence of the foma and hfst commands and be able to run them. Let's check:

  1. Open a terminal / command line, type foma -h and press Enter. You should see the following:

Help text returned by the foma command

The -h flag stands for "help", and displays information about how to use foma. If you got the help text, it worked! The command line successfully recognized the foma command.

  1. Check for the hfst command in a similar way: type hfst-info and press enter, and you should get see information about the hfst software.

You're all set! You are now ready to begin creating and using finite-state transducers!

Discussion (0)