Skip to content

Latest commit

 

History

History
16 lines (13 loc) · 863 Bytes

File metadata and controls

16 lines (13 loc) · 863 Bytes

Exercise for Spacy POS tutorial,

  1. You are parsing a news story from cnbc.com. News story is stores in news_story.txt which is available in this same folder on github. You need to,
    1. Extract all NOUN tokens from this story. You will have to read the file in python first to collect all the text and then extract NOUNs in a python list
    2. Extract all numbers (NUM POS type) in a python list
    3. Print a count of all POS tags in this story for token in doc: if token.pos_ in ["NOUN", "PROPN"]: print(token, "|",token.pos_ ) if token.pos_=='NUM': print(token ,"|", token.pos_) count=doc.count_by(spacy.attrs.POS) print(count)

Solution