Created
April 17, 2019 17:30
-
-
Save keithrozario/9f60058bd28e2e15bafa61813da25914 to your computer and use it in GitHub Desktop.
using_spacy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import spacy | |
def lambda_handler(event, context): | |
nlp = spacy.load('/opt/en_core_web_sm-2.1.0') | |
doc = nlp(u"Apple is looking at buying U.K. startup for $1 billion. Keith Rozario doesn't have $1 billion.") | |
for ent in doc.ents: | |
print(ent.text, ent.start_char, ent.end_char, ent.label_) | |
return { | |
'statusCode': 200, | |
'body': json.dumps('Done') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment