ttezel/bayes

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

schue opened this issue · 0 comments

schue commented

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.