https://github.com/anandchowdhary/train-natural
📜 Train Natural (Node.js NLP) classifiers with local text files
https://github.com/anandchowdhary/train-natural
classification natural natural-language-processing nodejs typescript
Last synced: 4 days ago
JSON representation
📜 Train Natural (Node.js NLP) classifiers with local text files
- Host: GitHub
- URL: https://github.com/anandchowdhary/train-natural
- Owner: AnandChowdhary
- License: mit
- Created: 2020-03-14T15:59:50.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-06-17T20:03:25.000Z (over 1 year ago)
- Last Synced: 2025-09-26T23:42:23.937Z (21 days ago)
- Topics: classification, natural, natural-language-processing, nodejs, typescript
- Language: TypeScript
- Homepage: https://anandchowdhary.github.io/train-natural/
- Size: 568 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 📜 Train Natural
Easily train classifiers from text files on your computer. Works with classifiers available in [Natural](https://github.com/NaturalNode/natural), a Node.js natural language facility library.
[](https://github.com/AnandChowdhary/train-natural/actions)
[](https://travis-ci.org/AnandChowdhary/train-natural)
[](https://coveralls.io/github/AnandChowdhary/train-natural?branch=master)
[](https://github.com/AnandChowdhary/train-natural/blob/master/LICENSE)


[](https://www.npmjs.com/package/train-natural)[](https://www.npmjs.com/package/train-natural)
## 💡 Usage
```bash
npm install train-natural
``````ts
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](./LICENSE) © [Anand Chowdhary](https://anandchowdhary.com)