Skip to content

fix ngrams constructor clash when word is constructor#2

Open
preynal wants to merge 1 commit intoSyeoryn:masterfrom
preynal:master
Open

fix ngrams constructor clash when word is constructor#2
preynal wants to merge 1 commit intoSyeoryn:masterfrom
preynal:master

Conversation

@preynal
Copy link

@preynal preynal commented Sep 5, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant