Skip to content

Commit d5d248a

Browse files
author
sant_si
committed
exercise added
1 parent 58ce35c commit d5d248a

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

bag_of_words.ipynb

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,15 @@
394394
"foo = \"My baby and all other babies in my buildings are crying laughing and playing all the time\""
395395
]
396396
},
397+
{
398+
"cell_type": "code",
399+
"execution_count": null,
400+
"metadata": {},
401+
"outputs": [],
402+
"source": [
403+
"from nltk import word_tokenize"
404+
]
405+
},
397406
{
398407
"cell_type": "code",
399408
"execution_count": null,
@@ -473,6 +482,15 @@
473482
"eggs = '''Phew! After lots of <br>, I finally cleared all these \"English\" and \"Science\" exams'''"
474483
]
475484
},
485+
{
486+
"cell_type": "code",
487+
"execution_count": null,
488+
"metadata": {},
489+
"outputs": [],
490+
"source": [
491+
"string.punctuation"
492+
]
493+
},
476494
{
477495
"cell_type": "code",
478496
"execution_count": null,
@@ -482,6 +500,15 @@
482500
"punctuation_map = str.maketrans('', '', string.punctuation)"
483501
]
484502
},
503+
{
504+
"cell_type": "code",
505+
"execution_count": null,
506+
"metadata": {},
507+
"outputs": [],
508+
"source": [
509+
"str.maketrans?"
510+
]
511+
},
485512
{
486513
"cell_type": "code",
487514
"execution_count": null,
@@ -491,6 +518,25 @@
491518
"eggs.translate(punctuation_map)"
492519
]
493520
},
521+
{
522+
"cell_type": "markdown",
523+
"metadata": {},
524+
"source": [
525+
"!Exercise\n",
526+
"\n",
527+
"Try to apply all that we have learnt with the following paragraph. Tokenize the sentences, words, Remove punctuations, Apply stemming or lemmatization."
528+
]
529+
},
530+
{
531+
"cell_type": "code",
532+
"execution_count": null,
533+
"metadata": {},
534+
"outputs": [],
535+
"source": [
536+
"foobar = '''With a key sentence established, the next task is to shape the body of your paragraph to be both cohesive and coherent. As Williams and Bizup[3] explain, cohesion is about the “sense of flow” (how each sentence fits with the next), while coherence is about the “sense of the whole.”[4]\n",
537+
"To reiterate the initial point, it is useful to think of paragraphs as punctuation that organize your ideas in a readable way. Each paragraph should be an irreplaceable node within a coherent sequence of logic. Thinking of paragraphs as “building blocks” evokes the “five-paragraph theme” structure explained earlier: if you have identical stone blocks, it hardly matters what order they’re in.'''"
538+
]
539+
},
494540
{
495541
"cell_type": "code",
496542
"execution_count": null,

0 commit comments

Comments
 (0)