[{"id"=>"intent", "lookups"=>["trait"], "values"=> [{"value"..." /> [{"id"=>"intent", "lookups"=>["trait"], "values"=> [{"value"..." /> [{"id"=>"intent", "lookups"=>["trait"], "values"=> [{"value"..."/>

wit.ai HTTP Post/entities API not show expressions in "Keyword" search strategy

225 views Asked by At

I try to post Intent and entity via wit.ai HTTP API.

My JSON format:

{"entities"=>[{"id"=>"intent", "lookups"=>["trait"], "values"=> [{"value"=>"ask_info", "expressions"=>["How old are you ?"]}]}, {"id"=>"age", "values"=>[{"value"=>"old", "expressions"=>["How old are you ?"]}]}]}

Input sentence is "How old are you ?"
Intent is ask_info
Entity is age for value 'old'

I call post entitiles API twice for Intent and Entity

$ curl -XPOST 'https://api.wit.ai/entities?v=20160526' \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"id"=>"intent", "lookups"=>["trait"], "values"=> [{"value"=>"ask_info", "expressions"=>["How old are you ?"]}]}'

$ curl -XPOST 'https://api.wit.ai/entities?v=20160526' \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"id"=>"age", "values"=>[{"value"=>"old", "expressions"=>["How old are you ?"]}]}'

In wit.ai page, entity age not mapping to expression "How old are you ?". Just display in Synonyms Display Image

Downloaded Dataset only show intent no entity

{ "text" : "How old are you ?", "entities" : [ { "entity" : "intent", "value" : "\"ask_info\"" } ] }

wit.ai GUI work very nice

{ "text" : "How old are you ?", "entities" : [ { "entity" : "intent", "value" : "\"ask_info\"" }, { "entity" : "age", "value" : "\"old\"", "start" : 2, "end" : 3 } ] }

Do you have any method could solve this problem?

1

There are 1 answers

0
Mikulas Dite On

I've bypassed this bug by manually crafting an archive which I later used for deploy.

There are multiple issues with this approach:

  • Apps cannot be updated from an archive, the importer only supports creating new apps as far as I know. This means the history will be lost between deploys and the server token will need to be changed.
  • The importer seems to be a little flaky. Tampering with the archive is possible, but zipping back is complicated: all files should be in an directory, no directory entries should be present, and the file order also seems to be important.

The upside is multiple features that are not available in the API are exposed, such as setting the 'free-text' lookups option.

I've downloaded an sample application and proceeded from there.