[Hindi]NLP 13# Tokenization Part-2 |NLP|Python 3|Natural Language Processing|2019
Code:
# -*- coding: utf-8 -*-
"""NLP_Ex8.ipynb
Automatically generated by Colaboratory.
"""
import spacy
nlp = spacy.load("en_core_web_sm")
doc5= nlp(u"It's better to give than receive")
nlp = spacy.load("en_core_web_sm")
doc5= nlp(u"It's better to give than receive")
doc5[0]
doc5[1:6]
doc5[0] = 'Vishwajeet'
doc6 = nlp(u"Google to build a Gujrat factory for $60 million.")
for token in doc6:
print(token.text, end=' | ')
for entity in doc6.ents:
print(entity)
print(entity.label_)
print(str(spacy.explain(entity.label_)))
print('\n')
doc7 = nlp(u"Autonomous cars shift insurance liability towards manufacturers.")
for chunks in doc7.noun_chunks:
print(chunks)
0 Comments