diff --git a/website/docs/usage/rule-based-matching.jade b/website/docs/usage/rule-based-matching.jade index db7c70608..cf27a6a94 100644 --- a/website/docs/usage/rule-based-matching.jade +++ b/website/docs/usage/rule-based-matching.jade @@ -59,6 +59,10 @@ p +h(2, "quantifiers") Using quantifiers +p + | Token specifiers may have quantifiers attached to them, by setting the "OP" key + | to one of the following values: + +table([ "Name", "Description", "Example"]) +row +cell #[code !] @@ -80,10 +84,18 @@ p +cell match 0 or 1 times +cell optional, max one +p + | Thus the following matcher will match "Hello, World" or "Hello world" or "Hello - - world": + ++code. + matcher = Matcher(nlp.vocab) + matcher.add_pattern("HelloWorld", [{LOWER: "hello"}, {IS_PUNCT: True, 'OP': '*'}, {LOWER: "world"}]) + p | There are no nested or scoped quantifiers. You can build those | behaviours with acceptors and | #[+api("matcher#add_entity") #[code on_match]] callbacks. + | All the operators are greedy: they will match as many tokens as possible. +h(2, "acceptor-functions") Acceptor functions