-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mod.ts
37 lines (37 loc) · 918 Bytes
/
mod.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* Machine Learning utilities for TypeScript.
*
* @example
* ```ts
* const data = [
* "twinkle twinkle little star",
* "How I wonder what you are",
* "up above the world so high",
* "like a diamond in the sky",
* ];
*
* // Clean the text
* const cleaner = new TextCleaner({
* lowercase: true,
* stripHtml: true,
* stripNewlines: true,
* normalizeWhiteSpaces: true,
* });
* x = cleaner.clean(x);
*
* // Tokenize the text
* const tokenizer = new SplitTokenizer();
* tokenizer.fit(x);
* const x_tokens = tokenizer.transform(x);
*
* // Vectorize the tokens
* const vectorizer = new CountVectorizer(tokenizer.vocabulary.size);
* const x_vec = vectorizer.transform(x_tokens, "f32");
*
* // Apply Tf-Idf transformation
* const transformer = new TfIdfTransformer();
* console.log(transformer.fit(x_vec).transform(x_vec));
* ```
* @module
*/
export * from "./src/mod.ts";