textAnalysisSuite icon indicating copy to clipboard operation
textAnalysisSuite copied to clipboard

fix ngrams constructor clash when word is constructor

Open preynal opened this issue 9 years ago • 0 comments

When building ngrams from phrases with the word "constructor", I get unexpected behavior. This was because the dictionaries are created with var x = {}; which makes them inherit from the default object prototype with a constructor property. Creating an object with a null prototype Object.create(null); solves the problem.

preynal avatar Sep 05 '16 16:09 preynal