mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-26 17:24:41 +03:00
DOC "OP" key in token spec
This commit is contained in:
parent
00fc2db7ef
commit
80a9652617
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user