bayes icon indicating copy to clipboard operation
bayes copied to clipboard

Use of plain objects prevents tokens or categories named "constructor"

Open schue opened this issue 8 years ago • 0 comments

The "vocabulary", "docCount", "wordCount", "wordFrequencyCount" and "categories" data structures in the classifier are defined as {} which means that "constructor" is a field. This causes problems for documents containing the word "constructor" as well as categories with that name. The solution is to use Object.create(null) as is already used elsewhere in the existing code.

schue avatar May 23 '17 17:05 schue