Back

Sanskar

Keen Learner and Exp...ย โ€ขย 22h

Day 10 of learning AI/ML as a beginner. Topic: N-Grams in Bag of Words (BOW). Yesterday I have talked about an amazing text to vector converter in machine learning i.e. Bag of Words (BOW). N-Gram is just a part of BOW. In BOW the program sees sentences with different meaning as similar which can be a big issue as it is relating the positive and negative things similar which should not happen. N-grams allows us to over come this limitation by grouping the words with next words so that is can give more accurate results for example in a sentence "The food is good" it will group "food" and "good" (assuming we have applied stopwords) together and will then compare it with the actual sentence and this will help the program distinguish between two different sentences and also lets the program understand what the user is saying. You can understand this better by seeing my notes that I have attached at last. I have also performed practical of this as n-gram is a part of BOW I decided to reuse my code and have imported the code in my BOW file (I also used if __name__ == "__main__": so that the results of previous code did not run in the new file). For using n-gram you just need to add this ngram_range=(1, 2) in the CountVectorizer. You can also change the range for getting bigram and trigram etc based on your need. I then used for loop to print all the group of words. Here's my code, its result and the notes I made of N-gram.

2 Replies
3
Replies (2)

More like this

Recommendations from Medial

Image Description
Image Description

Startup Memer

Jester of Medialย โ€ขย 4m

Me When I See the Words 'Billion' and 'Funding' in the Same Sentence

2 Replies
32
Image Description

param siddh

@paramsiddhย โ€ขย 4m

Listen to every elderโ€™s adviceโ€™ is the worst sentence ever said. Even fools grow old. If the talk is bullshit, donโ€™t follow itโ€”even if itโ€™s from an elder. And if thereโ€™s truth in the words, donโ€™t hesitate to bow before a 5-year-old

1 Reply
4

Sanskar

Keen Learner and Exp...ย โ€ขย 2d

Day 8 of learning AI/ML as a beginner. Topic: Bag of Words (BOW) Yesterday I told you guys about One Hot Encoding which is one way to convert text into vector however with serious disadvantages and to cater to those disadvantages there's another on

See More
Reply
1
12

Sanskar

Keen Learner and Exp...ย โ€ขย 5d

Day 5 of learning AI/ML as a beginner. Topic: lemmatization and stopwords. Lemmatization is same as stemming however in lemmatization a word is reduced to its base form also known as lemma. This is a dictionary based process. This is accurate then

See More
Reply
2

Sanskar

Keen Learner and Exp...ย โ€ขย 8d

Day 2 of learning AI/ML as a beginner. Topic: text preprocessing (tokenization) in NLP. I have moved further and decided to learn about Natural Language Process(NLP) which is used especially for translations, chatbots, and help them to generate hum

See More
Reply
4

Sanskar

Keen Learner and Exp...ย โ€ขย 4d

Day 6 of learning AI/ML as a beginner. Topic: pos tagging and name entity recognition. Pos (Part of Speech) tagging is process of labeling each word in a sentence(document with its role). Name entity recognition is the process where the system ide

See More
Reply
2

AIGuts

Exploring AI's poten...ย โ€ขย 3m

What Is an AI Sentence Generator and How Can It Improve Your Writing? Ever struggled to find the right words while writing a sentence or structuring a paragraph? Thatโ€™s where an AI Sentence Generator comes in. This smart sentence writing AI tool hel

See More
Reply
1
Image Description
Image Description

Sanskar

Keen Learner and Exp...ย โ€ขย 1d

Day 9 of learning AI/ML as a beginner. Topic: Bag of Words practical. Yesterday I shared the theory about bag of words and now I am sharing about the practical I did I know there's still a lot to learn and I am not very much satisfied with the topi

See More
4 Replies
20
1
Image Description
Image Description

Trademan

Business strategist ...ย โ€ขย 1y

I need a TECH CO-FOUNDER, I have seen n number of times in this platfm, It's time to switch n learn tech๐Ÿ˜Ÿ Consulting has become old school n of no value

7 Replies
2

Download the medial app to read full posts, comements and news.