Bird
0
0

What will be the output of the following code snippet?

medium📝 Predict Output Q5 of 15
NLP - Word Embeddings
What will be the output of the following code snippet? from gensim.models import Word2Vec sentences = [['hello', 'world'], ['hello', 'machine', 'learning']] model = Word2Vec(sentences, vector_size=10, window=1, sg=1, min_count=1) print(len(model.wv))
A4
B3
C2
D1
Step-by-Step Solution
Solution:
  1. Step 1: Count unique words in sentences

    Words are 'hello', 'world', 'machine', 'learning' -- total 4 unique words.
  2. Step 2: Check min_count parameter effect

    min_count=1 means all words with frequency >=1 are included.
  3. Final Answer:

    4 -> Option A
  4. Quick Check:

    Vocabulary size = unique words with min_count ≥1 [OK]
Quick Trick: Vocabulary size equals unique words meeting min_count [OK]
Common Mistakes:
MISTAKES
  • Counting total words instead of unique
  • Ignoring min_count filtering
  • Assuming default min_count excludes words

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NLP Quizzes