snipsco / snips-nlu

Snips Python library to extract meaning from text
https://snips-nlu.readthedocs.io
Apache License 2.0
3.9k stars 512 forks source link

Nested Entities #899

Open jcuenod opened 3 years ago

jcuenod commented 3 years ago

Is it possible to find overlapping/nested entities?

Search for two red balls with dots and the playing cards in an orange bucket

I am new to snips-nlu so I'm not sure whether it can solve my use case but I'm hoping to transform that imperative into something like:

{
    intent: "find",
    entities: [
        {
            text: "two red balls with dots",
            type: "object_to_find",
            subentities: [
                { value: 2, attribute: "number", text: "two" },
                { value: "red", attribute: "color", text: "red" },
                { value: "ball", attribute: "type", text: "balls" },
                { value: "dotted", attribute: "decoration", text: "with dots" },
            ]
        }, {
            text: "playing cards",
            type: "object_to_find",
            subentities: [
                { value: "cards", attribute: "type", text: "playing cards" },
            ]
        }, {
            text: "an orange bucket",
            type: "location_filter",
            subentities: [
                { value: "orange", attribute: "color", text: "orange" },
                { value: "bucket", attribute: "type", text: "bucket" },
            ]
        }
    ]
}

I need to distinguish between multiple search terms ("objects") that each have attributes and other search filters (like the "location_filter"). I have used wit.ai to do this before but I'm wondering whether snips can solve for my use case and where I should look for an example like this or some documentation.

datta-aerosys commented 1 year ago

I have a similar use-case..

We already have a very complex rhasspy nlu dataset, where we have nesting in entities of certain intents. And, we are building a custom parser for our use.

Since the "rhasspy-snips-nlu" parser always generates all possible sentences in the data, it is unusable for us and creates millions of utterance sentences for certain intents.

Does SNIPS support such nesting of entities? I could not find any information regarding it.

jcuenod commented 1 year ago

@datta-aerosys FWIW, I moved on to another platform...

datta-aerosys commented 1 year ago

@datta-aerosys FWIW, I moved on to another platform...

Which NLU tool did you move too? Does it support nested entities too ?

jcuenod commented 1 year ago

@datta-aerosys Eventually I stopped trying to roll my own and just used Azure's cognitive services. I might return to this in the future, but it was for a side project.

datta-aerosys commented 1 year ago

@datta-aerosys Eventually I stopped trying to roll my own and just used Azure's cognitive services. I might return to this in the future, but it was for a side project.

Ahh, ok. Online services are not possible for me, since my target edge-device has to be offline and standalone capable.