From 48447d7355ffb53edb312ac1917e4aa3249c8c02 Mon Sep 17 00:00:00 2001 From: "mr.Shu" Date: Sun, 25 Jan 2015 18:01:43 +0100 Subject: [PATCH 1/2] docs: Change `postags` to `parts_of_speech` * It seems that the docs use `spacy.postags` but the actual module that can be found in `spacy/` is `parts_of_speech`. Signed-off-by: mr.Shu --- docs/source/index.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/index.rst b/docs/source/index.rst index c2c4e44d0..ab554438d 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -184,7 +184,7 @@ adverbs to. Recall that our previous adverb highlighting function looked like this: >>> import spacy.en - >>> from spacy.postags import ADVERB + >>> from spacy.parts_of_speech import ADVERB >>> # Load the pipeline, and call it with some text. >>> nlp = spacy.en.English() >>> tokens = nlp("‘Give it back,’ he pleaded abjectly, ‘it’s mine.’", @@ -206,7 +206,7 @@ problematic, given our starting assumptions: >>> from numpy import dot >>> from numpy.linalg import norm >>> import spacy.en - >>> from spacy.postags import ADVERB, VERB + >>> from spacy.parts_of_speech import ADVERB, VERB >>> def is_bad_adverb(token, target_verb, tol): ... if token.pos != ADVERB ... return False From 202f74aeffa63eea8f113abce1efdbc7bb7fe7bf Mon Sep 17 00:00:00 2001 From: "mr.Shu" Date: Sun, 25 Jan 2015 18:10:28 +0100 Subject: [PATCH 2/2] docs: Use actual constants from parts_of_speech * It turns out `ADVERB` is not in `parts_of_speech` Signed-off-by: mr.Shu --- docs/source/index.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/source/index.rst b/docs/source/index.rst index ab554438d..82300240c 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -184,14 +184,14 @@ adverbs to. Recall that our previous adverb highlighting function looked like this: >>> import spacy.en - >>> from spacy.parts_of_speech import ADVERB + >>> from spacy.parts_of_speech import ADV >>> # Load the pipeline, and call it with some text. >>> nlp = spacy.en.English() >>> tokens = nlp("‘Give it back,’ he pleaded abjectly, ‘it’s mine.’", tag=True, parse=True) >>> output = '' >>> 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 >>> print(output) ‘Give it BACK,’ he pleaded ABJECTLY, ‘it’s mine.’ @@ -206,9 +206,9 @@ problematic, given our starting assumptions: >>> from numpy import dot >>> from numpy.linalg import norm >>> import spacy.en - >>> from spacy.parts_of_speech import ADVERB, VERB + >>> from spacy.parts_of_speech import ADV, VERB >>> def is_bad_adverb(token, target_verb, tol): - ... if token.pos != ADVERB + ... if token.pos != ADV ... return False ... elif toke.head.pos != VERB: ... return False