From 404d3067b89a71145b85af37f4f0233eb9cc5689 Mon Sep 17 00:00:00 2001 From: ines Date: Sat, 19 Aug 2017 12:45:00 +0200 Subject: [PATCH] Document new Doc.char_span() method --- website/docs/api/doc.jade | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/website/docs/api/doc.jade b/website/docs/api/doc.jade index 5c065e775..fcba091b8 100644 --- a/website/docs/api/doc.jade +++ b/website/docs/api/doc.jade @@ -140,6 +140,44 @@ p Get the number of tokens in the document. +cell int +cell The number of tokens in the document. ++h(2, "char_span") Doc.char_span + +tag method + +tag-new(2) + +p Create a #[code Span] object from the slice #[code doc.text[start : end]]. + ++aside-code("Example"). + doc = nlp(u'I like New York') + label = doc.vocab.strings['GPE'] + span = doc.char_span(7, 15, label=label) + assert span.text == 'New York' + ++table(["Name", "Type", "Description"]) + +row + +cell #[code start] + +cell int + +cell The index of the first character of the span. + + +row + +cell #[code end] + +cell int + +cell The index of the first character after the span. + + +row + +cell #[code label] + +cell uint64 + +cell A label to attach to the Span, e.g. for named entities. + + +row + +cell #[code vector] + +cell #[code.u-break numpy.ndarray[ndim=1, dtype='float32']] + +cell A meaning representation of the span. + + +footrow + +cell returns + +cell #[code Span] + +cell The newly constructed object. + +h(2, "similarity") Doc.similarity +tag method +tag-model("vectors")