QUESTION: Identifying Proper Names In A Text Document text_data = Heres to the crazy ones, the
Question:
QUESTION: Identifying Proper Names In A Text Document
text_data = """
Here’s to the crazy ones, the misfits, the rebels, thetroublemakers, the round pegs in the square holes. The ones who seethings differently — they’re not fond of rules. You can quote them,disagree with them, glorify or vilify them, but the only thing youcan’t do is ignore them because they change things. They push thehuman race forward, and while some may see them as the crazy ones,we see genius, because the ones who are crazy enough to think
that they can change the world, are the ones who do.
The quote baove is by Steve Jobs. Mr. Jobs also said: I choose alazy person to do a hard job. Because a lazy person will find aneasy way to do it. Steve started the apple computer company withSteve Wozniak (aka `Woz'). Little known facts:
Trump did not like Jobs. Jobs did not like Trump.
"""
Similar to the previous question ("Creating Rules ToIdentify Verbs"), write code that automatically identifies allwords/terms that are proper names. Use thesample text provided in text_data above.
Examples of proper names are:
- John
- Vancouver
- Trudeau
- Pierre Trudeau
- British Columbia, Canada
- Rememberance Day
import nltk
def is_word_a_pname(word):
word_is_a_pname = False
test_word = text_data.split()
if word in test_word:
rules = [(word.endswith('Jobs'))]
if all(rules):
print(True)
return word_is_a_pname
DISCUSSION
Briefly discuss the performance of your code (1-2paragraphs).
What types of proper names did the code perform well on? Whattypes of proper names did it not perform well on?
Niebels Methods, Standards and Work Design
ISBN: 978-0073376318
13th edition
Authors: Andris Freivalds, Benjamin Niebel