mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-01 04:46:38 +03:00
Merge branch 'spacy.io' of https://github.com/explosion/spaCy into spacy.io
This commit is contained in:
commit
3931fa146b
6
.github/contributors/armsp.md
vendored
6
.github/contributors/armsp.md
vendored
|
@ -98,9 +98,9 @@ mark both statements:
|
||||||
|
|
||||||
| Field | Entry |
|
| Field | Entry |
|
||||||
|------------------------------- | -------------------- |
|
|------------------------------- | -------------------- |
|
||||||
| Name | Shantam |
|
| Name | Shantam Raj |
|
||||||
| Company name (if applicable) | |
|
| Company name (if applicable) | |
|
||||||
| Title or role (if applicable) | |
|
| Title or role (if applicable) | |
|
||||||
| Date | 21/5/2018 |
|
| Date | 10/4/2021 |
|
||||||
| GitHub username | armsp |
|
| GitHub username | armsp |
|
||||||
| Website (optional) | |
|
| Website (optional) |https://shantamraj.com|
|
||||||
|
|
|
@ -601,12 +601,13 @@ print('Before', ents)
|
||||||
|
|
||||||
# Create a span for the new entity
|
# Create a span for the new entity
|
||||||
fb_ent = Span(doc, 0, 1, label="ORG")
|
fb_ent = Span(doc, 0, 1, label="ORG")
|
||||||
|
orig_ents = list(doc.ents)
|
||||||
|
|
||||||
# Option 1: Modify the provided entity spans, leaving the rest unmodified
|
# Option 1: Modify the provided entity spans, leaving the rest unmodified
|
||||||
doc.set_ents([fb_ent], default="unmodified")
|
doc.set_ents([fb_ent], default="unmodified")
|
||||||
|
|
||||||
# Option 2: Assign a complete list of ents to doc.ents
|
# Option 2: Assign a complete list of ents to doc.ents
|
||||||
doc.ents = list(doc.ents) + [fb_ent]
|
doc.ents = orig_ents + [fb_ent]
|
||||||
|
|
||||||
ents = [(e.text, e.start, e.end, e.label_) for e in doc.ents]
|
ents = [(e.text, e.start, e.end, e.label_) for e in doc.ents]
|
||||||
print('After', ents)
|
print('After', ents)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user