Forum

AI4I-3-Q: Explorato...
 
Notifications
Clear all

AI4I-3-Q: Exploratory Data Analysis Quiz - could not derive at the answer  

   RSS

0

I am not able to arrive at the answer for the last question of this quiz:

You notice that there are some unstructured text comments in
‘Q9: OTHER COMMENTS’.
You are curious how many sets of 2n-grams there are.

How many 2n-grams are there?

I would like to understand how the answer was derived. Grateful if someone can help advise?

Thanks,

Jeffrey

 

2 Answers
0
cv=CountVectorizer(ngram_range=(2,2))
cv.fit_transform(df['Q9: OTHER COMMENTS'].values.astype('str'))

This is the intended method. However, we note that there are multiple methods of deriving the n-grams and the question will be made less specific.
0

Thank you,

The code I provided is attached. Looks same to yours but I may be wrong.

How do we get the 7047 as the answer? 

cv_trigram_vec = CountVectorizer(max_features=100, stop_words='english', ngram_range = (2,2))
# Fit and apply trigram vectorizer
cv_trigram = cv_trigram_vec.fit_transform(df['Q9: OTHER COMMENTS'].apply(lambda x: np.str_(x)))

 

Share:

Delete your account