#duckling-rest
A REST enabled version of the Duckling project by Wit.ai with some extensions
To compile and run:
-
Install lein as in the link : https://github.com/technomancy/leiningen
-
To use the local (extended) version of duckling, go into the duckling folder in the project and run
lein jar
to generate a snapshot of the duckling project and then runlein install
to install this this jar as a local dependency. -
In case you want to use a non extended version of the duckling project, replace
[wit/duckling "1.0.85-SNAPSHOT"]
inproject.clj
(present in the main directory of the repository) with[wit/duckling "0.4.23"]
or the latest version from the Duckling project -
Back in the main project directory, run
lein deps
to download dependencies; -
In the main project directory, run
lein run
to test it out orlein uberjar
to generate a standalone jar -
Run the jar with the following command:
java -Xms256m -Xmx512m -Djava.awt.headless=true -jar target/standalone.jar
(customise the Xms and Xmx memory options based on system capabilities) -
The server should be accessible on port 9000
GET API's:
1) GET "/parse/all/:text"
2) GET "/parse/time/:text"
3) GET "/parse/number/:text"
4) GET "/parse/ordinal/:text"
5) GET "/parse/duration/:text"
6) GET "/parse/number-like/:text"
POST API's:
1) POST "/parse/all"
2) POST "/parse/time"
3) POST "/parse/number"
4) POST "/parse/ordinal"
5) POST "/parse/duration"
6) POST "/parse/number-like"
with JSON request body as: {text:"text"}
API for passing reference time for relative parsing:
1) POST "/parse/time-with-reference"
with JSON request body as {text:"tomorrow", reference-time: "2018-10-24T11:58:19.000Z"}