wit-ai / wit

Natural Language Interface for apps and devices
https://wit.ai/
942 stars 91 forks source link

unable to retrieve the built in entities with php cURL code for REST API (HTTP API) #1313

Closed girrajmal closed 5 years ago

girrajmal commented 5 years ago

what i am trying to convey is that, when i use REST API with php and cURL code and send request to url 'https://api.wit.ai/message?v=20170307&q=thecompletemessage

'https://api.wit.ai/message?v=20170307&q=how%20many%20people%20between%20Tuesday%20and%20Friday' \ -H 'Authorization: Bearer $TOKEN'

i only receive customized entities in json response for this request made....... but no built in entities are received like wit/distance , or wit/amount_of_money

but when i make a request through facebook messenger webhook , i get the built in entities as well as the customized wit entities, but i am also working on telegram messaging chatbot, so i need built in entities also, through REST API and php and cURL request ....

on wit.ai (understanding) or dashboard , even there it depicts the built in entities along with the customized entities,,,, but i want to retrieve the BUILT IN ENTITIES THROUGH PHP cURL COMMANDS (REST API COMMANDS) PLZ HELP ME IN THAT .......

regards, Anurag Aggarwal https://wit.ai/anuragaggarwal/whatsappbotenglish

aforaleka commented 5 years ago

hey @girrajmal, can you show us the json response you get back? It'll also be helpful if you can set the verbose param as true, and show us the body of the message in the response

jtliao commented 5 years ago

@girrajmal we're not sure what you mean, the following response (with builtin entity datetime) is given for this query curl -H 'Authorization: Bearer $TOKEN' 'https://api.wit.ai/message?q=this%20monday':

{"_text":"this monday","entities":{"datetime":[{"confidence":0.96441,"values":[{"value":"2018-12-24T00:00:00.000+05:30","grain":"day","type":"value"}],"value":"2018-12-24T00:00:00.000+05:30","grain":"day","type":"value"}]},"msg_id":"1oLfqcK054XRtoNoE"}

Seems like the app is working as expected.

patapizza commented 5 years ago

For context: https://github.com/wit-ai/wit/issues/1226.

@girrajmal Please comment back on this issue if you still experience an issue with a clear repro. Just to make sure: in how many people between Tuesday and Friday, there wouldn't be any wit/distance nor wit/amount_of_money entities as the message doesn't mention anything like that. You would however get a wit/datetime entity for between Tuesday and Friday.

girrajmal commented 5 years ago

when i requested with php cURL (HTTP API), (including with verbose details also)

this is the text :- "please send 25mm cotton twill tape 3000 metres for the value of rupees 4400 through transport tomorrow"

sent to this url :- "https://api.wit.ai/message?v=20181219&q= https://api.wit.ai/message?v=20181219&q=".$text02."&verbose=true"

the following result json :-

{"_text":"please\u0025send\u0025mm\u0025cotton\u0025twill\u0025tape000\u0025metres\u0025for\u0025the\u0025value\u0025of\u0025rupeesD00\u0025through\u0025transport\u0025tomorrow",

"entities":

{"productcontent":[{"confidence":1,"value":"cotton","type":"value","_entity":"productcontent","_body":"cotton","_start":15,"_end":21}],

"productdesign":[{"confidence":1,"value":"twill","type":"value","_entity":"productdesign","_body":"twill","_start":22,"_end":27}],

"productname":[{"confidence":1,"value":"tape","type":"value","_entity":"productname","_body":"tape","_start":28,"_end":32}],

"productlogistic":[{"suggested":true,"confidence":0.35466439497949,"value":"transport\u0025","type":"value","_entity":"productlogistic","_body":"transport\u0025","_start":78,"_end":88}],

"datetime":[{"confidence":0.96871,"values":[{"value":"2018-12-20T00:00:00.000+05:30","grain":"day","type":"value"}],

"value":"2018-12-20T00:00:00.000+05:30","grain":"day","type":"value","_entity":"datetime","_body":"tomorrow","_start":88,"_end":96}],

"intent":[{"confidence":0.96831803260023,"value":"productorderbycustomer","_entity":"intent"}]},"msg_id":"1FwsntSnIPVrlL34k"}

In this result json, the built in entiity only datetime was given ....... but when i use the wit.ai http://wit.ai API through facebook messenger app, i got all the built in entities like wit/datetime, wit/distance and also wit/amount_of_money .... i need all these built in entities

the following is the json i got from fb messenger webhook :-

{"object":"page","entry":[{"id":"328744360878643","time":1545187975398,"messaging":[{"sender":{"id":"2214575088584903"},"recipient":{"id":"328744360878643"},

"timestamp":1545187974021,"message":{"mid":"riubnoRFMW_uKIGg0VFUR-HrpeUFDahl8umi1l0O42nOLF1enCfw79sEl35qtyszDJ0sCOghiQWBrJXYHce91w","seq":5035,

"text":"please send 25mm cotton twill tape 3000 metres for the value of rupees 4400 through transport tomorrow",

"nlp":{"entities":

{"distance":[{"confidence":0.96358,"value":25,"type":"value","unit":"millimetre"},

{"confidence":0.94355,"value":3000,"type":"value","unit":"metre"}],

"productcontent":[{"confidence":0.97509607904648,"value":"cotton","type":"value"}],

"productdesign":[{"confidence":0.85450578213894,"value":"twill","type":"value"}],

"productname":[{"confidence":0.9931923743658,"value":"tape","type":"value"}],

"amount_of_money":[{"confidence":1,"value":4400,"type":"value","unit":"INR"}],

"productlogistic":[{"suggested":true,"confidence":0.59380893103652,"value":"transport","type":"value"}],

"datetime":[{"confidence":0.96895,"values":[{"value":"2018-12-20T00:00:00.000+05:30","grain":"day","type":"value"}],

"value":"2018-12-20T00:00:00.000+05:30","grain":"day","type":"value"}],

"intent":[{"confidence":0.93619824114662,"value":"productorderbycustomer"}]}}}}]}]}

now, please help me for a way by which , i could retrieve all the built in entities by php cURL code (HTTP API) , its very important for me,

regards,

Anurag

https://wit.ai/anuragaggarwal/whatsappbotenglish https://wit.ai/anuragaggarwal/whatsappbotenglish

On Wed, Dec 19, 2018 at 2:29 AM Aleka C notifications@github.com wrote:

hey @girrajmal https://github.com/girrajmal, can you show us the json response you get back? It'll also be helpful if you can set the verbose param as true, and show us the body of the message in the response

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/wit-ai/wit/issues/1313#issuecomment-448368077, or mute the thread https://github.com/notifications/unsubscribe-auth/AI8qza_mP6lbTGYwYaZA7wcFg3vxBxWpks5u6VccgaJpZM4ZY-m3 .

patapizza commented 5 years ago

It seems like you have an encoding issue, as in the console it seems to work fine:

screen shot 2018-12-26 at 5 59 16 pm