mirror of
https://github.com/explosion/spaCy.git
synced 2025-08-05 21:00:19 +03:00
Merge 1bd0d90a9e
into 9d3afba255
This commit is contained in:
commit
b24cc31114
|
@ -192,7 +192,7 @@ this:
|
||||||
tag=True, parse=True)
|
tag=True, parse=True)
|
||||||
>>> output = ''
|
>>> output = ''
|
||||||
>>> for tok in tokens:
|
>>> for tok in tokens:
|
||||||
... output += tok.string.upper() if tok.pos == ADVERB else tok.string
|
... output += tok.string.upper() if tok.pos == ADV else tok.string
|
||||||
... output += tok.whitespace
|
... output += tok.whitespace
|
||||||
>>> print(output)
|
>>> print(output)
|
||||||
‘Give it BACK,’ he pleaded ABJECTLY, ‘it’s mine.’
|
‘Give it BACK,’ he pleaded ABJECTLY, ‘it’s mine.’
|
||||||
|
@ -210,7 +210,7 @@ problematic, given our starting assumptions:
|
||||||
>>> from spacy.parts_of_speech import ADV, VERB
|
>>> from spacy.parts_of_speech import ADV, VERB
|
||||||
>>> cosine = lambda v1, v2: dot(v1, v2) / (norm(v1), norm(v2))
|
>>> cosine = lambda v1, v2: dot(v1, v2) / (norm(v1), norm(v2))
|
||||||
>>> def is_bad_adverb(token, target_verb, tol):
|
>>> def is_bad_adverb(token, target_verb, tol):
|
||||||
... if token.pos != ADVERB
|
... if token.pos != ADV
|
||||||
... return False
|
... return False
|
||||||
... elif toke.head.pos != VERB:
|
... elif toke.head.pos != VERB:
|
||||||
... return False
|
... return False
|
||||||
|
|
Loading…
Reference in New Issue
Block a user