Click4Ai

210.

Medium

Create a TF-IDF vectorizer from a given list of texts. **Example:** For the texts ['hello world', 'hello'], the output should be a matrix with TF-IDF values. **Constraints:** 1 <= num_texts <= 10, text length <= 100.

Test Cases

Test Case 1
Input: ['hello world', 'hello']
Expected: [[1.0, 1.0], [1.0, 0.0]]
Test Case 2
Input: ['this is a test', 'this is a test']
Expected: [[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]
+ 3 hidden test cases