mirror of https://github.com/explosion/spaCy.git
* Tweak information extraction example
This commit is contained in:
parent
c503654ec1
commit
e7c31f7eae
|
@ -45,14 +45,14 @@ def main():
|
||||||
nlp = English()
|
nlp = English()
|
||||||
texts = [
|
texts = [
|
||||||
u'Net income was $9.4 million compared to the prior year of $2.7 million.',
|
u'Net income was $9.4 million compared to the prior year of $2.7 million.',
|
||||||
u'Revenue exceeded twelve billion dollars, with a loss of $1b',
|
u'Revenue exceeded twelve billion dollars, with a loss of $1b.',
|
||||||
]
|
]
|
||||||
|
|
||||||
for text in texts:
|
for text in texts:
|
||||||
doc = nlp(text)
|
doc = nlp(text)
|
||||||
relations = extract_currency_relations(doc)
|
relations = extract_currency_relations(doc)
|
||||||
for r1, r2 in relations:
|
for r1, r2 in relations:
|
||||||
print(r1.text, r2.ent_type_)
|
print(r1.text, r2.ent_type_, r2.text)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in New Issue