mirror of https://github.com/explosion/spaCy.git
more explicit Example constructor example (#11489)
* make constructor example for Example more explicit * shorten example and add spaces
This commit is contained in:
parent
0509f90874
commit
df0b815c23
|
@ -23,11 +23,13 @@ both documents.
|
||||||
> ```python
|
> ```python
|
||||||
> from spacy.tokens import Doc
|
> from spacy.tokens import Doc
|
||||||
> from spacy.training import Example
|
> from spacy.training import Example
|
||||||
>
|
> pred_words = ["Apply", "some", "sunscreen"]
|
||||||
> words = ["hello", "world", "!"]
|
> pred_spaces = [True, True, False]
|
||||||
> spaces = [True, False, False]
|
> gold_words = ["Apply", "some", "sun", "screen"]
|
||||||
> predicted = Doc(nlp.vocab, words=words, spaces=spaces)
|
> gold_spaces = [True, True, False, False]
|
||||||
> reference = parse_gold_doc(my_data)
|
> gold_tags = ["VERB", "DET", "NOUN", "NOUN"]
|
||||||
|
> predicted = Doc(nlp.vocab, words=pred_words, spaces=pred_spaces)
|
||||||
|
> reference = Doc(nlp.vocab, words=gold_words, spaces=gold_spaces, tags=gold_tags)
|
||||||
> example = Example(predicted, reference)
|
> example = Example(predicted, reference)
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue