mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-28 10:56:31 +03:00
for easy copy & paste
This commit is contained in:
parent
e7ef51b382
commit
e66cd9cc70
|
@ -19,11 +19,11 @@ p Here's a minimal example. We first add a pattern that specifies three tokens:
|
||||||
p
|
p
|
||||||
| Once we've added the pattern, we can use the #[code matcher] as a
|
| Once we've added the pattern, we can use the #[code matcher] as a
|
||||||
| callable, to receive a list of #[code (ent_id, start, end)] tuples.
|
| callable, to receive a list of #[code (ent_id, start, end)] tuples.
|
||||||
| Note that #[code LOWER] and #[code IS_PUNCT] are data attributes
|
|
||||||
| of #[code spacy.attrs].
|
|
||||||
|
|
||||||
+code.
|
+code.
|
||||||
from spacy.matcher import Matcher
|
from spacy.matcher import Matcher
|
||||||
|
from spacy.attrs import IS_PUNCT, LOWER
|
||||||
|
|
||||||
matcher = Matcher(nlp.vocab)
|
matcher = Matcher(nlp.vocab)
|
||||||
matcher.add_pattern("HelloWorld", [{LOWER: "hello"}, {IS_PUNCT: True}, {LOWER: "world"}])
|
matcher.add_pattern("HelloWorld", [{LOWER: "hello"}, {IS_PUNCT: True}, {LOWER: "world"}])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user