spaCy/docs/source/reference/using/span.rst

59 lines
973 B
ReStructuredText
Raw Normal View History

2015-07-08 19:23:49 +03:00
===============
The Span Object
===============
2015-07-08 18:59:07 +03:00
.. autoclass:: spacy.spans.Span
2015-08-08 20:14:32 +03:00
.. py:class:: Span
2015-07-08 18:59:07 +03:00
2015-08-08 20:14:32 +03:00
.. py:method:: __getitem__
2015-07-08 18:59:07 +03:00
2015-08-08 20:14:32 +03:00
.. py:method:: __iter__
2015-07-08 18:59:07 +03:00
2015-08-08 20:14:32 +03:00
.. py:method:: __len__
2015-07-08 18:59:07 +03:00
2015-08-08 20:14:32 +03:00
.. py:attribute:: root
2015-07-08 18:59:07 +03:00
2015-08-08 20:14:32 +03:00
Syntactic head
2015-07-08 18:59:07 +03:00
2015-08-08 20:14:32 +03:00
.. py:attribute:: lefts
2015-07-08 18:59:07 +03:00
2015-08-08 20:14:32 +03:00
Tokens that are:
1. To the left of the span;
2. Syntactic children of words within the span
i.e.
.. code::
lefts = [span.doc[i] for i in range(0, span.start) if span.doc[i].head in span]
.. py:attribute:: rights
Tokens that are:
1. To the right of the span;
2. Syntactic children of words within the span
i.e.
.. code::
rights = [span.doc[i] for i in range(span.end, len(span.doc)) if span.doc[i].head in span]
Tokens that are:
1. To the right of the span;
2. Syntactic children of words within the span
.. py:attribute:: string
.. py:attribute:: lemma / lemma\_
.. py:attribute:: label / label\_
.. py:attribute:: subtree