Fix biluo_tags_from_offsets example and docs

This commit is contained in:
ines 2017-11-26 16:37:32 +01:00
parent 434030e0d0
commit e4ee666be5
1 changed files with 4 additions and 6 deletions

View File

@ -123,7 +123,7 @@ p
p p
| Returns a list of unicode strings, describing the tags. Each tag string | Returns a list of unicode strings, describing the tags. Each tag string
| will be of the form either #[code ""], #[code "O"] or | will be of the form of either #[code ""], #[code "O"] or
| #[code "{action}-{label}"], where action is one of #[code "B"], | #[code "{action}-{label}"], where action is one of #[code "B"],
| #[code "I"], #[code "L"], #[code "U"]. The string #[code "-"] | #[code "I"], #[code "L"], #[code "U"]. The string #[code "-"]
| is used where the entity offsets don't align with the tokenization in the | is used where the entity offsets don't align with the tokenization in the
@ -135,9 +135,9 @@ p
+aside-code("Example"). +aside-code("Example").
from spacy.gold import biluo_tags_from_offsets from spacy.gold import biluo_tags_from_offsets
text = 'I like London.'
entities = [(len('I like '), len('I like London'), 'LOC')] doc = nlp('I like London.')
doc = tokenizer(text) entities = [(7, 13, 'LOC')]
tags = biluo_tags_from_offsets(doc, entities) tags = biluo_tags_from_offsets(doc, entities)
assert tags == ['O', 'O', 'U-LOC', 'O'] assert tags == ['O', 'O', 'U-LOC', 'O']
@ -163,5 +163,3 @@ p
+cell +cell
| Unicode strings, describing the | Unicode strings, describing the
| #[+a("/api/annotation#biluo") BILUO] tags. | #[+a("/api/annotation#biluo") BILUO] tags.