mirror of https://github.com/explosion/spaCy.git
new proposal for doctests
This commit is contained in:
parent
e08eca837c
commit
22d1112031
|
@ -6,13 +6,16 @@ mixin example(name)
|
||||||
|
|
||||||
|
|
||||||
+example("Load resources and process text")
|
+example("Load resources and process text")
|
||||||
include:doctest_all ../../../tests/test_load_resources_and_process_text.txt
|
pre.language-python: code
|
||||||
|
include ../../code/home.load_resources_and_process_text
|
||||||
|
|
||||||
+example("Get tokens and sentences")
|
+example("Get tokens and sentences")
|
||||||
include:doctest ../../../tests/test_get_tokens_and_sentences.txt
|
pre.language-python: code
|
||||||
|
include ../../code/home.get_tokens_and_sentences
|
||||||
|
|
||||||
+example("Use integer IDs for any string")
|
+example("Use integer IDs for any string")
|
||||||
include:doctest ../../../tests/test_use_interger_ids_for_any_strings.txt
|
pre.language-python: code
|
||||||
|
include ../../code/home.use_integer_ids_for_any_strings
|
||||||
|
|
||||||
+example("Get and set string views and flags")
|
+example("Get and set string views and flags")
|
||||||
pre.language-python: code
|
pre.language-python: code
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
>>> from spacy.en import English ###
|
|
||||||
>>> nlp = English() ###
|
|
||||||
>>> doc = nlp(u'Hello, world. Here are two sentences.') ###
|
|
||||||
>>>
|
|
||||||
>>> token = doc[0]
|
|
||||||
>>> sentence = doc.sents.next()
|
|
||||||
>>> assert token is sentence[0]
|
|
||||||
>>> assert sentence.text == 'Hello, world.'
|
|
|
@ -1,5 +0,0 @@
|
||||||
>>> from spacy.en import English
|
|
||||||
>>> nlp = English()
|
|
||||||
>>> doc = nlp(u'Hello, world. Here are two sentences.')
|
|
||||||
>>> print([s.string for s in doc.sents])
|
|
||||||
[u'Hello, world. ', u'Here are two sentences.']
|
|
|
@ -1,10 +0,0 @@
|
||||||
>>> from spacy.en import English ###
|
|
||||||
>>> nlp = English() ###
|
|
||||||
>>> doc = nlp(u'Hello, world. Here are two sentences.') ###
|
|
||||||
>>> token = doc[0] ###
|
|
||||||
>>>
|
|
||||||
>>> hello_id = nlp.vocab.strings['Hello']
|
|
||||||
>>> hello_str = nlp.vocab.strings[hello_id]
|
|
||||||
>>>
|
|
||||||
>>> assert token.orth == hello_id == 469755
|
|
||||||
>>> assert token.orth_ == hello_str == 'Hello'
|
|
Loading…
Reference in New Issue