Skip to content

Building & Publishing your Dictionary

These guides assume you are comfortable with the Command Line and NPM.

Seeing your dictionary in action (i.e. Local Development)

Important

This guide assumes you have worked through all the steps in preparing your data.

Once you have properly configured your dictionary data, you can let mothertongues put it all together!

This will parse all of the data according to your specifications, combine all of your sources of data, sort your data according to your alphabet, create an inverted index for improved performance, calculate BM25 scores for ranking search results, and generate the code necessary for your approximate search to work.

This guide assumes that you have worked through the steps to create a valid Language Configuration file and Data Resource Configuration files for each unique source of data. It also assumes you have a directory structure similar to the one described in this guide.

Then run:

mothertongues build-and-run <path_to_config.mtd.json>

And your dictionary will be served at http://localhost:3636

Exporting your data

First, you need to export the dictionary data required by any MTD UI.

  1. Change directories to your MTD folder.
  2. Then, build the dictionary using the mothertongues export command to create necessary data:

mothertongues export <path_to_config.mtd.json> <output_folder>

This will create a file called dictionary_data.json which is the file you will need to transfer to your MTD UI in the next section.

Mobile/UI Development

Here are the steps for creating a mobile dictionary on your machine.

Note

You only need to do this if you intend to customize the code for the UI, otherwise you can just follow the steps for running on your machine or exporting your data and publishing to GitHub

  1. Change into the UI directory:

    cd mothertongues-UI

  2. Install dependencies:

    npm install

  3. Move your exported data to mothertongues-UI/packages/mtd-mobile-ui/src/assets/dictionary_data.json

  4. Serve your dictionary:

    npx nx serve mtd-mobile-ui

Comments