From a6e2a44283c7b7d0f25a5d000b24bbd2c2436d6b Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sun, 27 Sep 2015 18:17:41 +1000 Subject: [PATCH] * Add clarifying comment --- examples/matcher_example.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/examples/matcher_example.py b/examples/matcher_example.py index 2e3efadf2..041b98a9a 100644 --- a/examples/matcher_example.py +++ b/examples/matcher_example.py @@ -97,6 +97,14 @@ def main(): # sydney True # SYDNEY True # + # The key thing to note here is that we're setting these attributes once, + # over the vocabulary --- and then reusing them at run-time. This means the + # amortized complexity of anything we do this way is going to be O(1). You + # can match over expressions that need to have sets with tens of thousands + # of values, e.g. "all the street names in Germany", and you'll still have + # O(1) complexity. Most regular expression algorithms don't scale well to + # this sort of problem. + # # Now, let's use this in a pattern nlp.matcher.add("AuCitySportsTeam", "ORG", {}, [