Training of Composite Entities through the Samples API doesn't work
Do you want to request a feature, report a bug, or ask a question about wit? Bug What is the current behavior? Training of composite entities through the Samples API doesn't work If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Request: [ { "text": "live testing of sub entities", "entities": [
{
"entity": "sub2",
"value": "free text with sub entity",
"start": 0,
"end": 28,
"role": null,
"subentities": [
{
"entity": "sub_ent",
"value": "sub2",
"start": 0,
"end": 4,
"role": null
}
]
}
]
} ]
Response:
{ "sent": true, "n": 1 }
When I checked the interface I found that the expression was trained correctly.

However, when I try the same expression in Understanding, the result doesn't show the main entity

I detected this behavior when training subentities through the API if the main entity is of Keyword look up strategy. However, there isn't a clear documentation on how to change look up strategies from [Keywords] to [free-text] or [free-text & keywords]
What is the expected behavior? To be able to train composite entities, if there is a way to change look up strategies to free-text or free-text & keywords please let me know, as this could potentially solve the problem. Otherwise, please advise a clear way to train composite entities through the samples endpoint.
What is the App ID where you are experiencing this issue (if applicable)? 5ac72794-9985-4258-a6e2-7af1b295edeb
Thank you for the feedback, we're looking into it
@NourShalabi thanks again for your feedback!
- first, please realize that training is done asynchronously and can be in the order of minutes or even hours depending on the amount of data you have
- testing on my end seems to work, these are the steps:
- POST /apps
- POST /entities to create sub2 and sub_ent
- POST /samples to add 1 training sample
- ... wait 10 seconds ...
- GET /message
- lastly, you can find documentation for [keywords], [free-text] and [free-text & keywords] inline in the UI

EDIT: we are sometimes experiencing slower training times, this is an issue we're working on and may have been the issue during your testing
Hello,
Thanks, but it's been days and the training of this composite entity still didn't work


The expression isn't analyzed correctly. The screenshot you attached shows how to change the lookup strategies through the UI, but I need to be able to change them through the API, if you look into the entity "sub2" the lookup strategy is still "keywords" and that is why the training of it as composite is not working.
All entities will be created and trained through the API, but what happens is that we can't choose "free-text & keywords" at the time of entity creation, which makes it impossible to train composite entities, unless you can suggest another way to do it.
Hey @NourShalabi
Could you go over the API requests you sent, to get to this state? It's surprising that "keywords" is set as the default -- it should be free-text & keywords if it's going strictly through POST /samples
@stopachka I will go over them and let you know how it goes, but can you please clarify how exactly the lookup strategy is set for entities created through the API if we don't choose a specific type?
Basically, if you validate sample with span (aka start and end), Wit will know that this is freetext&keyword as opposed to if you validate sample without span, Wit will know that this is a trait. BTW, we just released an improvement to the PUT /entities/entity-id API: you can now set the lookups to free-text, keywords, or free-text & keywords through the API: https://wit.ai/docs/http/20170307#put--entities-:entity-id-link