axa-group / nlp.js

An NLP library for building bots, with entity extraction, sentiment analysis, automatic language identify, and so more

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ContextData can't be saved and loaded

maiernte opened this issue · comments

contextData won't be save
I try out the Example of NER, save the hero-data in an other files. It works by nlp.addCorpus() and nlp.train().

But when I call nlp.save() and nlp.load(), I find out that the contextData in file "heros.json" won't be save in model.nlp

{
  "name": "Corpus test hero",
  "locale": "en-US",
  "contextData": "./src/data/base/heros.json",
  "data": [
    {
      "intent": "hero.realname",
      "utterances": [
        "what is the real name of @hero"
      ],
      "answers": [
        {
          "opts": "entities.hero !== undefined",
          "answer": "The real name of {{ hero }} is {{ _data[entities.hero.option].realName }}"
        },
        {
          "opts": "entities.hero === undefined",
          "answer": "Sorry, I don't know the real name of {{ hero }}."
        }
      ]
    },
    {
      "intent": "hero.city",
      "utterances": [
        "where @hero lives?",
        "what's the city of @hero?"
      ],
      "answers": [
        "{{ hero }} lives at {{ _data[entities.hero.option].city }}"
      ]
    }
  ],
  "entities": {
    "hero": {
      "options": {
        "spiderman": ["spiderman", "spider-man"],
        "ironman": ["ironman", "iron-man"],
        "thor": ["thor"]
      }
    }
  }
}