Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slot filling takes anything as missing entities #421

Open
vccortez opened this issue Mar 24, 2020 · 5 comments
Open

Slot filling takes anything as missing entities #421

vccortez opened this issue Mar 24, 2020 · 5 comments

Comments

@vccortez
Copy link

vccortez commented Mar 24, 2020

Describe the bug
I added a regex entity to an NlpManager instance and some documents to capture this entity in a sentence. This is working as expected, however, once I add a slot filler (with manager.slotManager.addSlot), the process function will take any follow up text as an entity to fill the slot with high accuracy, even if the word (or sentence) has nothing to do with the regex for the entity. I have also tested this with a named entity and the slot filling also ignores the named options.

To Reproduce
Steps to reproduce the behavior:

  1. Try this MWE:
const { NlpManager, ConversationContext } = require('node-nlp')
const readline = require('readline')
const ri = readline.createInterface({ input: process.stdin, output: process.stdout, terminal: false })

const languages = ['en']
const m = new NlpManager({ languages })

m.addNamedEntityText('action', 'kick', languages, ['kick', 'to kick'])
m.addNamedEntityText('action', 'ban', languages, ['ban', 'to ban'])
m.addRegexEntity('member', languages, /@[0-9]+/g)

m.addDocument('en', 'I want to %action% %member%', 'member.act')
m.addDocument('en', 'I wanna %action% %member%', 'member.act')
m.addDocument('en', '%action% %member%', 'member.act')

m.addAnswer('en', 'member.act', 'confirm {{action}} on {{member}}?')

m.slotManager.addSlot('member.act', 'member', true, {
  en: 'who should I {{action}}?',
})
m.slotManager.addSlot('member.act', 'action', true, {
  en: 'what shoud I do to {{member}}?',
})

async function main() {
  await m.train()
  m.save()
  console.log('you may type now')
  const context = new ConversationContext()
  ri.on('line', async (line) => {
    if (line == 'quit') process.exit()
    console.log('> ' + line)
    try {
      const response = await m.process(null, line, context)
      console.log('BOT:', JSON.stringify(response, null, 2))
    } catch (err) {
      console.error(err)
      process.exit()
    }
  })
}

main()
  1. Input the following:
I want to ban someone
kick
  1. Check out the "entities" object, you should see the correct action of ban, kick, and an incorrect member kick;
  2. The wrong answer will be "confirm kick on kick?".

Expected behavior
I expect the slot filling logic to at least obey the same entity matching that each entity defines. And to be fair, we can observe the "classifications" object of the reproducing example and see that in fact the model is matching the correct entities. So, why is the slot filler ignoring that?

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Ubuntu 18.04
  • Browser: not applicable.
  • Version: 3.10.2

Additional context
Add any other context about the problem here.

@obaid
Copy link

obaid commented Sep 25, 2020

Any update on this? I am running into the same issue.

@Gauhar
Copy link

Gauhar commented Oct 14, 2020

Is there any update on this issue? Any ETA on this one at least?

@Gauhar
Copy link

Gauhar commented Nov 13, 2020

@jesus-seijas-sp - we are blocked by this issue, is there ETA on the the fix for this issue? thanks in advance

@igoruehara123
Copy link

Did you have any corrections regarding this?

@Apollon77
Copy link
Contributor

This is a fallback logic. In fact the second answer do not contain anything which is matched and also no "member" entity was found. Thats why the slot filling logic just uses the full input as "the answer" for the currently expecting slot entry.

One idea could be to allow this behaviour to be configured. Then it would fallback to the same question again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants