Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/catplvsplus/naive-bayes
https://github.com/catplvsplus/naive-bayes
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/catplvsplus/naive-bayes
- Owner: catplvsplus
- License: mit
- Created: 2023-07-26T14:59:13.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-07-26T15:04:50.000Z (over 1 year ago)
- Last Synced: 2024-10-13T03:24:20.236Z (3 months ago)
- Language: TypeScript
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# naive-bayes
```js
import { NaiveBayesClassifier } from '@catplusplus/naive-bayes';const classifier = new NaiveBayesClassifier();
await classifier.addDocument('Hello, good morning!', 'greetings');
await classifier.addDocument('Hello, good evening!', 'greetings');
await classifier.addDocument('Hello, good day!', 'greetings');await classifier.addDocument('How are you today?', 'question');
await classifier.addDocument('What are you up to?', 'question');
await classifier.addDocument('What is your name?', 'question');await classifier.classify('Hi, good afternoon!'); // categories: [greetings, question]
await classifier.classify('Who are you?'); // categories: [question, greetings]
```