In [ ]:
# ----------------------------------- Spacy
# https://spacy.io/
# ----------------------------------- +
import spacy
from spacy import displacy
In [ ]:
nlp = spacy.load('en_core_web_sm')
doc = nlp(u"Apple is looking to buying U.K. startup for $1 billion")
In [ ]:
# ------------------------------------------------------------------- + Natural Language Processing
# ----- Segmentation >> Tokenization
# ----- Tagging >> Parsing >> Entity Recognizer (ER)
# ------------------------------------------------------------------- +
In [ ]:
for token in doc:
print(token.text, token.pos_, token.tag_, token.dep_, token.head.text, token.lefts, token.rights)
In [ ]:
displacy.serve(doc, style='dep')
In [ ]:
displacy.serve(doc, style='ent')
In [ ]:
# ------------------------------------- Inline Rendering (instead of serving)
displacy.render(doc, style='dep', jupyter=True, options={'distance': 100})
* run NN classifier : takes in to account the entire sentence - black magic at work :)
* i.e. input layer, hidden layer, output layer with forward and backward prop.
* tools
- word2vec: Gensim Python Library ::: sentences, size of embedding vector, window i.e. neighbors, workers
- skip-gram and cbow models : using hierarchical softmax or negative sampling
- keras: build cnn pipeline
In [ ]:
# > You shall know a word by the company it keeps - J.R. Firth
In [ ]: