valencianok / Wit.ai.net

A .Net client for Wit.ai HTTP API
MIT License
13 stars 4 forks source link

Interval Entity Resolver #3

Open gianvi opened 7 years ago

gianvi commented 7 years ago

Hi, do you have an example to use your client as entity resolver?

I tryied in this way in my c# bot app:

public async Task StartAsync(IDialogContext context)
{
    var client = new com.valgut.libs.bots.Wit.WitClient("XXXXXXXXX");

    var response = client.GetMessage("which day is the day after tomorrow");

    foreach (var e in response.entities)
    {
        var k = e.Key;
        var v = e.Value;

        await context.PostAsync("Entity KEY: " + k);

        foreach (var val in v)
        {
            await context.PostAsync("Entity VAL: " + val.value + "\n\n   MD:" + val.metadata);
        }
    }

It actually recognize that there is 1 entity (DateTime) but I cannot retrieve the Value (day after tomorrow => 13/06/2017)

(In my Wit app I have no actions already setted!) Thanks in advance

gianvi commented 7 years ago

It is possible that tool is not getting values for interval entities (or in general composed/hierarchical ?

This is the json that Wit get me back with "domani pomeriggio":

{ “msg_id”: “0s4YSkvlzlMlH8k29”, "_text": “domani pomeriggio”, “entities”: { “datetime”: [ { “confidence”: 0.99902519427591, “values”: [ { “to”: { “value”: “2017-06-14T20:00:00+02:00”, “grain”: “hour” }, “from”: { “value”: “2017-06-14T13:00:00+02:00”, “grain”: “hour” }, “type”: “interval” } ], “to”: { “value”: “2017-06-14T20:00:00+02:00”, “grain”: “hour” }, “from”: { “value”: “2017-06-14T13:00:00+02:00”, “grain”: “hour” }, “type”: “interval” } ] } }

...and this is response in above code, using getMessage("domani pomeriggio"):

cattura_witintervalissue

As you can see I have Datetime entity recognized with high confidence, but there is no FROM and TO sub-entities valorized

gianvi commented 7 years ago

With basic datetime entity, instead, it works correctly.

Here the json from Wit:

{ “msg_id”: “066zWQAwqXDF91cjo”, "_text": “il 22 giugno alle 11”, “entities”: { “datetime”: [ { “confidence”: 0.96708812631587, “values”: [ { “value”: “2017-06-22T12:00:00+02:00”, “grain”: “hour”, “type”: “value” }, { “value”: “2018-06-22T12:00:00+02:00”, “grain”: “hour”, “type”: “value” }, { “value”: “2019-06-22T12:00:00+02:00”, “grain”: “hour”, “type”: “value” } ], “value”: “2017-06-22T12:00:00+02:00”, “grain”: “hour”, “type”: “value” } ] } }

...and this is the stack with correct value in Datetime entity:

cattura_witdatetime

valencianok commented 7 years ago

Hmm you are right, seams like a bug here. I will look into that case