Skip to content

Commit

Permalink
Merge pull request #58 from timstableford/fix/crash_with_single_skill
Browse files Browse the repository at this point in the history
Fixed crash when all but one skill is removed
  • Loading branch information
timstableford committed Apr 4, 2018
2 parents facb06b + 81343fb commit 92db7d6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions api/core-ask.js
Expand Up @@ -16,7 +16,7 @@ String.prototype.replaceAll = function (search, replacement) {
}

function strip(word) {
return word.replaceAll('\'', '').replace(/\?/g, '').replaceAll('.', '').toLowerCase().trim()
return word.replaceAll('\'', '').replace(/\?/g, '').replaceAll('\\.', '').toLowerCase().trim()
}

function * train_recognizer(skills) {
Expand Down Expand Up @@ -122,7 +122,7 @@ function * classify(q, user, token, isResponse) {
const result = classifier.getClassifications(q)[0]
const confidence = result.value
if (confidence > 0.5) {
throw new Error('error')
console.log(`Warning: Confidence for query '${q}' to skill '${result.label}' is unusually high at ${confidence}`)
}
for (let i = 0; i < loaded_skills.length; i++) {
if (loaded_skills[i].name == result.label) {
Expand Down

0 comments on commit 92db7d6

Please sign in to comment.