Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/seikho/neo-classify
Naive Bayes text classification using Neo4j
https://github.com/seikho/neo-classify
bayes naive-bayes neo4j nodejs text-classification typescript
Last synced: about 1 month ago
JSON representation
Naive Bayes text classification using Neo4j
- Host: GitHub
- URL: https://github.com/seikho/neo-classify
- Owner: Seikho
- Created: 2017-06-05T10:52:53.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-29T03:23:01.000Z (almost 7 years ago)
- Last Synced: 2024-11-02T07:06:07.999Z (3 months ago)
- Topics: bayes, naive-bayes, neo4j, nodejs, text-classification, typescript
- Language: TypeScript
- Size: 19.5 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Neo-classify
> Text Classification with Naive Bayes implementation using Neo4j and Node.JS## Requirements
- Neo4J
- NodeJS## Installation
```sh
$ yarn add neo-classify
$ # or:
$ npm i neo-classify
```## Usage
```ts
import { configure, train, classify } from 'neo-classify'configure('http://username:password@localhost:7474')
// or
configure({ host: 'localhost', user: 'username', password: 'password', port: 7474, protocol: 'https' })example()
async function example() {
const pos = { type: 'sentiment', tags: ['positive'] }
const neg = { type: 'sentiment', tags: ['negative'] }await train('i like coffee', [pos])
await train('i love coffee', [pos])
await train('coffee is too bitter', [neg])
await train('i dont like coffee', [neg])
await train('i like coffee with milk', [pos])
await train('i hate coffee', [neg])const result = await classify('i really dont like coffee')
console.log(JSON.stringify(result.results, null, 2))// returns...
interface Classifcation {
total: number
docs: { [type: string]: { [tag: string]: number } }
relations: { [type: string]: { [tag: string]: number } }
words: { [word: string]: { [type: string]: { [tag: string]: number } } }
results: { [type: string]: { [tag: string]: { percent: number; probability: number } } }
}
}```
# License
MIT