* Tweak information extraction example

This commit is contained in:
Matthew Honnibal 2015-10-06 10:35:49 +11:00
parent c503654ec1
commit e7c31f7eae
1 changed files with 2 additions and 2 deletions

View File

@ -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__':