mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 09:56:28 +03:00
Remove UPPER from Matcher attributes docs (resolves #1949)
This commit is contained in:
parent
696ae87b47
commit
a3b965b29d
|
@ -88,8 +88,8 @@ p
|
|||
+cell The exact verbatim text of a token.
|
||||
|
||||
+row
|
||||
+cell.u-nowrap #[code LOWER], #[code UPPER]
|
||||
+cell The lowercase, uppercase form of the token text.
|
||||
+cell.u-nowrap #[code LOWER]
|
||||
+cell The lowercase form of the token text.
|
||||
|
||||
+row
|
||||
+cell.u-nowrap #[code IS_ALPHA], #[code IS_ASCII], #[code IS_DIGIT]
|
||||
|
@ -222,8 +222,8 @@ p
|
|||
doc.ents += ((EVENT, start, end),)
|
||||
|
||||
matcher.add('GoogleIO', add_event_ent,
|
||||
[{'ORTH': 'Google'}, {'UPPER': 'I'}, {'ORTH': '/'}, {'UPPER': 'O'}],
|
||||
[{'ORTH': 'Google'}, {'UPPER': 'I'}, {'ORTH': '/'}, {'UPPER': 'O'}, {'IS_DIGIT': True}])
|
||||
[{'ORTH': 'Google'}, {'ORTH': 'I'}, {'ORTH': '/'}, {'ORTH': 'O'}],
|
||||
[{'ORTH': 'Google'}, {'ORTH': 'I'}, {'ORTH': '/'}, {'ORTH': 'O'}, {'IS_DIGIT': True}])
|
||||
|
||||
p
|
||||
| In addition to mentions of "Google I/O", your data also contains some
|
||||
|
|
|
@ -231,7 +231,7 @@ p
|
|||
def set_sentiment(matcher, doc, i, matches):
|
||||
doc.sentiment += 0.1
|
||||
|
||||
pattern1 = [{'ORTH': 'Google'}, {'UPPER': 'I'}, {'ORTH': '/'}, {'UPPER': 'O'}]
|
||||
pattern1 = [{'ORTH': 'Google'}, {'ORTH': 'I'}, {'ORTH': '/'}, {'ORTH': 'O'}]
|
||||
pattern2 = [[{'ORTH': emoji, 'OP': '+'}] for emoji in ['😀', '😂', '🤣', '😍']]
|
||||
matcher.add('GoogleIO', None, pattern1) # match "Google I/O" or "Google i/o"
|
||||
matcher.add('HAPPY', set_sentiment, *pattern2) # match one or more happy emoji
|
||||
|
|
Loading…
Reference in New Issue
Block a user