Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jobsamuel/woa
NodeJS module for word analytics
https://github.com/jobsamuel/woa
Last synced: 27 days ago
JSON representation
NodeJS module for word analytics
- Host: GitHub
- URL: https://github.com/jobsamuel/woa
- Owner: jobsamuel
- License: mit
- Created: 2015-09-18T14:50:23.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-12-16T16:20:34.000Z (almost 7 years ago)
- Last Synced: 2024-10-05T19:05:26.464Z (about 1 month ago)
- Language: JavaScript
- Size: 48.8 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# woa [![npm version](https://img.shields.io/npm/v/woa.svg?style=flat-square)](https://www.npmjs.com/package/woa) [![downloads](https://img.shields.io/npm/dt/woa.svg?style=flat-square)](https://www.npmjs.com/package/woa) [![license](https://img.shields.io/npm/l/woa.svg?style=flat-square)](https://www.npmjs.com/package/woa)
> NodeJS module for word analytics## installation
```bash
$ npm install woa
```## usage
```js
// example.jsimport woa from 'woa';
const text = `What is love?
Baby, don't hurt me
Don't hurt me no more`;const keywords = ['hurt', 'baby', 'oh'];
const result = woa({text, keywords});console.log(result);
```The result will be something like this:
```json
{
"hurt": 0.16666666666666666,
"baby": 0.08333333333333333,
"oh": "n/a"
}
```## why this module?
I stumbled upon the necessity of a tool that simplifies comments processing; I just want to make easy the analysis of any text.
**woa** helps you to discover and count patterns in text using the power of Node. It's written in pure Javascript, blazing fast and easy to use.
Would you like to try it out?
## api
### `woa(config)`
Generate a JSON with the percent occurrence of each keyword in a text.
#### argument
`config` an Object containing these parameters:
- `text` The text to be processed. Must be a *String* containing Text to be processed.
- `keywords` *optional* word or list of words to count in a text. Must be a *String* or an *Array of Strings*.
## testing
Since _woa_ is super simple, tests are super simple too:
```bash
$ npm test
```## contribution
Feel free to fork and create a Pull Request with new features or an improvement of the current ones.
## license
[MIT](http://opensource.org/licenses/MIT) License :copyright: 2017 Jobsamuel Núñez