0.1.0 • Published 3 years ago

duckling-client v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

duckling-client

A client for duckling.

Installation

# using npm
npm i duckling-client

# using yarn
yarn add duckling-client

# using pnpm
pnpm i duckling-client

Usage

import { DucklingClient } from "duckling-client";

const client = new DucklingClient({
    endpoint: "http://0.0.0.0:8000",
    locale: "nl_NL",
    dims: ["volume"],
});

const result = await client.parse("3ml ghb");

This gives the result variable a value that looks something like following:

[
    {
        "body": "3ml",
        "start": 1,
        "value": {
            "value": 3,
            "type": "value",
            "unit": "millilitre"
        },
        "end": 4,
        "dim": "volume",
        "latent": false
    }
]