bottenderjs / bottender-recognizer

Build bottender bots with intent recognizer and action resolver.
MIT License
0 stars 0 forks source link

應該在 recognizer/regex 被處理掉的東西進到 recognizer/nlu #9

Closed kidkcl closed 6 years ago

kidkcl commented 6 years ago

in regex.js:

export default (state, event) => {
  // const onPayload = payload => event.isPayload && event.payload === payload;

  if (event.isText && /^Hi$/i.test(event.text)) {
    return {
      name: '__GET_STARTED__',
    };
  }
  if (event.isPayload) return { name: event.payload };
};

nlu.js 跟 example 完全一樣

log:

Intent:  { name: '__GET_STARTED__' }
Action:  getStarted
TypeError: Cannot match against 'undefined' or 'null'.
    at IntentClassifier.predict (/Users/kcl/yoctol/abccar-bot/node_modules/ynlu/src/IntentClassifier.js:80:3)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:169:7)
kidkcl commented 6 years ago

這是同時做的 text 會進 regex 也會進去 classifier 以優先被決定的當作答案 @wtflink @Calvin-Lin