Loading...
Given a vocabulary list and a text, create a binary vector where each position is 1 if the corresponding vocabulary word appears in the text, and 0 otherwise.
Input format:
All comparisons are case-insensitive.
Output: A list of 0s and 1s.
cat,dog,fish,the the cat sat
[1, 0, 0, 1]
Step 1: Parse vocabulary ["cat", "dog", "fish", "the"]
Step 2: Check each vocab word in text "the cat sat" (lowered) contains: cat=yes, dog=no, fish=no, the=yes
Step 3: Build vector [1, 0, 0, 1]