train-natural

📜 Train Natural (Node.js NLP) classifiers with local text files

View the Project on GitHub AnandChowdhary/train-natural

📜 Train Natural

Easily train classifiers from text files on your computer. Works with classifiers available in Natural, a Node.js natural language facility library.

GitHub Actions Travis CI Coverage Status License Vulnerabilities NPM type definitions NPM

NPM

💡 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.

📄 License

MIT © Anand Chowdhary