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

Cannot read properties of undefined (reading 'latestSlot') #1252

Closed
iamjohnseun opened this issue Jan 8, 2023 · 10 comments · Fixed by #1253
Closed

Cannot read properties of undefined (reading 'latestSlot') #1252

iamjohnseun opened this issue Jan 8, 2023 · 10 comments · Fixed by #1253

Comments

@iamjohnseun
Copy link

iamjohnseun commented Jan 8, 2023

Describe the bug
When trying to fill slots using the corpus file, If the mandatory flag is set to true, it throws the error
Cannot read properties of undefined (reading 'latestSlot')
Also when i remove the mandatory flag, it still shows the same error.

To Reproduce
Steps to reproduce the behavior:

  1. Using a sample corpus.json file
{
 "name": "basic conversations",
  "locale": "en-us",
  "entities": {
    "clientName": {
      "trim": [
        {
          "position": "betweenLast",
          "leftWords": ["is", "am"],
          "rightWords": ["."]
        },
        {
          "position": "afterLast",
          "words": ["is", "am"]
        }
      ]
    },
    "location": {
      "trim": [
        {
          "position": "betweenLast",
          "leftWords": ["in", "around"],
          "rightWords": ["today", "currently", "at"]
        },
        {
          "position": "afterLast",
          "words": ["in", "around", "to", "at", "from"]
        }
      ]
    }
  },
"data": [
    {
      "intent": "user.introduce",
      "utterances": [
        "i am @clientName",
        "my name is @clientName",
      ],
      "answer": [
        "Nice to meet you @clientName.",
        "It's a pleasure to meet you @clientName.",
      ],
      "slotFilling": {
        "clientName": "I'm sorry but i didn't get your name",
        "location": "Where are you from @clientName?"
      }
    },
}
  1. config.json file
{
  "settings": {
    "nlp": {
      "forceNER": true,
      "corpora": [
        "./corpus.json",
      ]
    }
  },
  "use": ["Basic", "BuiltinMicrosoft", "LangEn"]
}
  1. input i am john in the console
  2. Error produced Cannot read properties of undefined (reading 'latestSlot')

Expected behavior
The console should return one of the specified answers and ask for the users' location according to the data specified in the corpus file. for example
Nice to meet you john
Where are you from john

Desktop (please complete the following information):

  • OS: Windows
  • Package version: 4.26.0
  • Node version: v18.12.1
@Apollon77
Copy link
Contributor

Hi,

there is no mandatory in your example file? Please show the code and olease shjow the full error message

In the version on GitHub there were many changes around that, so it could be an idea to retest this after next release - but if you provide more infos I could also have a look to make sure it is fixed

@iamjohnseun
Copy link
Author

With the mandatory option set to true, Here is the full error,

TypeError: Cannot read properties of undefined (reading 'latestSlot')
    at SlotManager.process (C:\Program Files\www\bot\node_modules\@nlpjs\slot\src\slot-manager.js:295:36)
    at Nlp.process (C:\Program Files\www\bot\node_modules\@nlpjs\nlp\src\nlp.js:737:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Bot.process (C:\Program Files\www\bot\assistant\core\index.js:58:24)
    at async Interface.<anonymous> (C:\Program Files\www\bot\assistant\index.js:16:18)

@Apollon77
Copy link
Contributor

Ahh cool ... @eric-lara released a new version... will check.

DO you have your full code please that I can reproduce it? Or tell here to set in your corpus above a mandatory true

@Apollon77
Copy link
Contributor

Ok ... now I understand (after reading several times) that it has nothing to do with mandaory.

Can you please tell which text you process with the corpus above?

@iamjohnseun
Copy link
Author

I tried to process i am john

const dock = await dockStart();
const nlp = dock.get("nlp");
const response = await nlp.process("i am john");
console.log(response);

@Apollon77
Copy link
Contributor

hehe ... tries the same (also john) .. was able to reporoduce, will do PR for fix

@iamjohnseun
Copy link
Author

Do you know when the npm version will be released?
Would you advice downloading the github version and replacing the npm version?

@Apollon77
Copy link
Contributor

@iamjohnsimeon Fix see my PR yif you want to try it out/verify it: https://github.com/axa-group/nlp.js/pull/1253/files#diff-0950488bddfffba3f4622cfd4fbb2d2737c6fa1218c1e165536b3be2d2d5e210

@Apollon77
Copy link
Contributor

Would you advice downloading the github version and replacing the npm version?

No you can't! nlp.js is a monrepo ... you can not install the github version as easy as normal. This will not work. So best way to unblock you is to change manually the code until a fix gets released

@Apollon77
Copy link
Contributor

@iamjohnsimeon fix released by eric too

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

Successfully merging a pull request may close this issue.

2 participants