Adding a new language to the Duckling project for people who know nothing about Clojure

As you might know Duckling is the probabilistic parser used by Facebook's wit.ai lib.

Adding a new language to the Duckling can be painful if you know nothing about Clojure. We faced it when we start on adding Armenian. I would like to share some basic principles on how to test new language added to Duckling. Frankly speaking we don't have any experience with Clojure and this post provides very basic information, though enough to run it locally, so please don't blame us :) 

Lets assume you have already forked the Duckling project and added new language with the way described here

What do I need to execute Clojure files?

This was the first question we had. You need to install JDK (means Java) and Leiningen which is a very helpful tool for executing Clojure files. 

How to test a Duckling in action?

Create a file test.clj and paste the following code there (this is an example from readme.md file a bit modified)

(p/load! '(:languages ["en"])) loads "en" language (English), so make sure you change that to whatever language you are testing

"wake me up the last Monday of January 2015 at 6am" is the string you would like to test

[:time] entities you are trying to test

How to execute test.clj?

Open your favorite terminal, go to the Duckling project folder and type following command

cat test.clj | lein repl

Alternatively, for faster execution, you can do the following

lein repl

then in the console every time you want to test 

(load-file "init.clj")

After successful execution, you should be able to see something like this

Screen Shot 2017-03-24 at 6.28.50 PM.png

We will update this post whenever we learn something useful.

By the way if you are interested in contributing to the Armenian language support in Duckling here is the git repo we are working on.