mirror of
https://github.com/explosion/spaCy.git
synced 2025-08-05 21:00:19 +03:00
Update docs.
This commit is contained in:
parent
a64ac73a76
commit
19657b392a
|
@ -158,6 +158,16 @@ cdef class SpanGroup:
|
||||||
return self._concat(other)
|
return self._concat(other)
|
||||||
return NotImplemented
|
return NotImplemented
|
||||||
|
|
||||||
|
def __iter__(self):
|
||||||
|
"""
|
||||||
|
Iterate over the spans in this SpanGroup.
|
||||||
|
YIELDS (Span): A span in this SpanGroup.
|
||||||
|
|
||||||
|
DOCS: https://spacy.io/api/spangroup#iter
|
||||||
|
"""
|
||||||
|
for i in range(self.c.size()):
|
||||||
|
yield self[i]
|
||||||
|
|
||||||
def append(self, Span span):
|
def append(self, Span span):
|
||||||
"""Add a span to the group. The span must refer to the same Doc
|
"""Add a span to the group. The span must refer to the same Doc
|
||||||
object as the span group.
|
object as the span group.
|
||||||
|
@ -170,15 +180,6 @@ cdef class SpanGroup:
|
||||||
raise ValueError(Errors.E855.format(obj="span"))
|
raise ValueError(Errors.E855.format(obj="span"))
|
||||||
self.push_back(span.c)
|
self.push_back(span.c)
|
||||||
|
|
||||||
def __iter__(self):
|
|
||||||
"""
|
|
||||||
Iterate over the spans in this SpanGroup.
|
|
||||||
YIELDS (Span): A span in this SpanGroup.
|
|
||||||
|
|
||||||
DOCS: https://spacy.io/api/spangroup#iter
|
|
||||||
"""
|
|
||||||
for i in range(self.c.size()):
|
|
||||||
yield self[i]
|
|
||||||
|
|
||||||
def extend(self, spans_or_span_group: Union[SpanGroup, Iterable["Span"]]):
|
def extend(self, spans_or_span_group: Union[SpanGroup, Iterable["Span"]]):
|
||||||
"""Add multiple spans or contents of another SpanGroup to the group.
|
"""Add multiple spans or contents of another SpanGroup to the group.
|
||||||
|
|
|
@ -202,6 +202,23 @@ already present in the current span group.
|
||||||
| `other` | The span group or spans to append. ~~Union[SpanGroup, Iterable[Span]]~~ |
|
| `other` | The span group or spans to append. ~~Union[SpanGroup, Iterable[Span]]~~ |
|
||||||
| **RETURNS** | The span group. ~~SpanGroup~~ |
|
| **RETURNS** | The span group. ~~SpanGroup~~ |
|
||||||
|
|
||||||
|
## SpanGroup.\_\_iter\_\_ {#iter tag="method" new="3.5"}
|
||||||
|
|
||||||
|
Iterate over the spans in this SpanGroup.
|
||||||
|
|
||||||
|
> #### Example
|
||||||
|
>
|
||||||
|
> ```python
|
||||||
|
> doc = nlp("Their goi ng home")
|
||||||
|
> doc.spans["errors"] = [doc[0:1], doc[1:3]]
|
||||||
|
> for error_span in doc.spans["errors"]:
|
||||||
|
> print(error_span)
|
||||||
|
> ```
|
||||||
|
|
||||||
|
| Name | Description |
|
||||||
|
| ---------- | ----------------------------------- |
|
||||||
|
| **YIELDS** | A span in this SpanGroup.. ~~Span~~ |
|
||||||
|
|
||||||
## SpanGroup.append {#append tag="method"}
|
## SpanGroup.append {#append tag="method"}
|
||||||
|
|
||||||
Add a [`Span`](/api/span) object to the group. The span must refer to the same
|
Add a [`Span`](/api/span) object to the group. The span must refer to the same
|
||||||
|
|
Loading…
Reference in New Issue
Block a user