Skip to content

Commit

Permalink
refactor(server): actions to fallbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
louistiti committed May 4, 2019
1 parent 5cf77d9 commit 4d929dc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion core/langs.json
Expand Up @@ -13,7 +13,8 @@
{
"words": ["merci"],
"package": "leon",
"module": "welcome"
"module": "welcome",
"action": "run"
}
]
}
Expand Down
1 change: 1 addition & 0 deletions server/src/core/nlu.js
Expand Up @@ -148,6 +148,7 @@ class Nlu {
if (JSON.stringify(tmpWords) === JSON.stringify(fallbacks[i].words)) {
obj.classification.package = fallbacks[i].package
obj.classification.module = fallbacks[i].module
obj.classification.action = fallbacks[i].action
obj.classification.confidence = 1

log.success('Fallback found')
Expand Down
4 changes: 2 additions & 2 deletions test/unit/server/core/nlu.spec.js
Expand Up @@ -94,8 +94,8 @@ describe('NLU', () => {
}

expect(Nlu.fallback(obj, [
{ words: ['query', 'example', 'test', 'fallbacks'], package: 'fake-pkg', module: 'fake-module' }
]).classification).toContainEntries([['package', 'fake-pkg'], ['module', 'fake-module'], ['confidence', 1]])
{ words: ['query', 'example', 'test', 'fallbacks'], package: 'fake-pkg', module: 'fake-module', action: 'fake-action' }
]).classification).toContainEntries([['package', 'fake-pkg'], ['module', 'fake-module'], ['action', 'fake-action'], ['confidence', 1]])
})
})
})

0 comments on commit 4d929dc

Please sign in to comment.