train-natural
v1.0.0
Published
Easily train Natural classifiers from text files on your system
Downloads
4
Readme
📜 Train Natural
Easily train classifiers from text files on your computer. Works with classifiers available in Natural, a Node.js natural language facility library.
💡 Usage
npm install train-natural
import { train } from "train-natural";
import { BayesClassifier } from "natural";
import { join } from "path";
const documents = join(__dirname, "training-data");
const classifier = new BayesClassifier();
await train(classifier, documents);
console.log(classifier.classify("example string"));
In the above example, a directory named training-data
contains several folders, one for each label, in which each text file is used to train the classifier.