[Hindi]NLP 11# Spacy Basics Part-2 |NLP|Python 3|Natural Language Processing|2019
Code:
# -*- coding: utf-8 -*-
"""NLP_Ex7.ipynb
Automatically generated by Colaboratory.
"""
import spacy
nlp = spacy.load('en_core_web_sm')
txt2 = nlp(u"Knowledge Shelf isn't my youtube channel.")
for token in txt2:
print(token.text, token.pos_, token.dep_)
txt2[0].pos_
txt2[0].dep_
txt3 = nlp(u"Although commmonly attributed to John Lennon from his song 'Beautiful Boy', \
the phrase 'Life is what happens to us while we are making other plans' was written by \
cartoonist Allen Saunders and published in Reader\'s Digest in 1957, when Lennon was 17.")
quote = txt3[16:30]
print(quote)
type(quote)
type(txt3)
txt4 = nlp(u"This is first line. This is second line. This is third line. This is last line.")
for sentence in txt4.sents:
print(sentence)
txt4[5].is_sent_start
YouTube:
Recommended Book:
Click Me |
0 Comments