Enhanced organizations¶
V2ENHANCEDORGANIZATIONS uses the same recognition and name policy as Organizations, retaining each accepted mention’s start position.
Requirements¶
Install the ner extra and an English spaCy model. Name rules are included. See installation.
Example¶
from gdelt_regkg.fields.ner import SpacyNER
from gdelt_regkg.fields.ner import analyze_entities
ner = SpacyNER.from_model("en_core_web_sm", name_policy="surface")
text = "Microsoft opened a store. Microsoft expanded."
print(analyze_entities(text, recognizer=ner).to_gkg("ORG", enhanced=True))
entities = analyze_entities(text, recognizer=ner)
Behavior¶
Entries are name,offset, separated by ;. Repeated names are separate. Offsets are zero-based character positions in the analyzed body. Normalization and cell filters do not shift them.
Use entities.to_gkg("ORG", enhanced=True) to share one NER result with the standard field. Pass precomputed recognition to generate_gkg(text, metadata, resources, ner_result=entities). The result must describe that exact body. After translation, offsets refer to the English body.
Limitations¶
The extraction limitations are the same as for organizations. After translation, offsets refer to the analyzed English body.