mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-27 09:44:36 +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
|
+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"])
|
+table([ "Name", "Description", "Example"])
|
||||||
+row
|
+row
|
||||||
+cell #[code !]
|
+cell #[code !]
|
||||||
|
@ -80,10 +84,18 @@ p
|
||||||
+cell match 0 or 1 times
|
+cell match 0 or 1 times
|
||||||
+cell optional, max one
|
+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
|
p
|
||||||
| There are no nested or scoped quantifiers. You can build those
|
| There are no nested or scoped quantifiers. You can build those
|
||||||
| behaviours with acceptors and
|
| behaviours with acceptors and
|
||||||
| #[+api("matcher#add_entity") #[code on_match]] callbacks.
|
| #[+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
|
+h(2, "acceptor-functions") Acceptor functions
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user