Skip to content

Instantly share code, notes, and snippets.

@keithrozario
Created April 21, 2019 16:09
Show Gist options
  • Save keithrozario/dcc85b21a5192f409a4c28dd16381668 to your computer and use it in GitHub Desktop.
Save keithrozario/dcc85b21a5192f409a4c28dd16381668 to your computer and use it in GitHub Desktop.
spaCy Lambda Layer example
import spacy
import json
def lambda_handler(event, context):
nlp = spacy.load('/opt/en_core_web_sm-2.1.0')
test = 'Keith is one awesome dude'
nlp_test = nlp(test)
output_ner = [(i, i.label_, i.label) for i in nlp_test.ents]
print(output_ner)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment