mirror of
https://github.com/Llewellynvdm/php-ml.git
synced 2024-11-21 20:45:10 +00:00
documentation add tokenizer->fit required to build the dictionary (#155)
This commit is contained in:
parent
a11e3f69c3
commit
f7537c049a
@ -26,8 +26,13 @@ $samples = [
|
||||
];
|
||||
|
||||
$vectorizer = new TokenCountVectorizer(new WhitespaceTokenizer());
|
||||
$vectorizer->transform($samples)
|
||||
// return $vector = [
|
||||
|
||||
// Build the dictionary.
|
||||
$vectorizer->fit($samples);
|
||||
|
||||
// Transform the provided text samples into a vectorized list.
|
||||
$vectorizer->transform($samples);
|
||||
// return $samples = [
|
||||
// [0 => 1, 1 => 1, 2 => 2, 3 => 1, 4 => 1],
|
||||
// [5 => 1, 6 => 1, 1 => 1, 2 => 1],
|
||||
// [5 => 1, 7 => 2, 8 => 1, 9 => 1],
|
||||
|
Loading…
Reference in New Issue
Block a user