Skip to content

Commit

Permalink
Update classificator.js
Browse files Browse the repository at this point in the history
Fix for when `"totalDocuments":0` or `"vocabularySize":0`
  • Loading branch information
lcherone authored Jul 6, 2021
1 parent 39cc888 commit 19d6850
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/classificator.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ module.exports.fromJson = (jsonStrOrObject) => {

// override the classifier's state
STATE_KEYS.forEach((k) => {
if (!parameters[k]) {
if (typeof parameters[k] === 'undefined') {
throw new Error(
`Naivebayes.fromJson: JSON string is missing an expected property: [${k}].`
);
Expand Down

0 comments on commit 19d6850

Please sign in to comment.