extatistic
v1.3.7
Published
Perform statistical models on any text and extract specific features
Downloads
9
Maintainers
Readme
extatistic
Perform (statistical) methods on TEXT. Extract user defined features. Contains predefined helper functions. Analyse any source string (code, statement, quote, html, xml, json, etc).
Github repository: npm/extatistic | npm package: npm/extatistic
This project is part of the Guardjs, that used to extract features of normal javascript source code.
It has the capability to easily reduce or increase a feature model to the feature set through cli or api.
CLI
npx extatistic create --name lengthOfstr.js
To create a new feature named lengthOfstr.js. It can provided as a path.
npx extatistic list
To get the list of all registered features. If any error be in features there should be shown.
npx extatistic list > res.csv
npx extatistic execute
To start executing all features (methods in folder called 'features') on source text (of files in folder called 'input').
Results willl be saved as a csv file in a folder called 'ouput'.
npx extatistic execute >> res.csv
API
There's a sample code to show how to use the code and how it works:
const {
registerAFeature, // register a feature in to feature list
registerFeaturesList, // register a list of features to feature list
getListOfFeaturesName, // return a list of all registered features
getNumberOfFeatures, // return total number of registerd features
extractfeaturesRaw, // calculate and return a raw of features value
} = require('extatistic')
const newFeature = sourceString => sourceString.length || 0
registerAFeature(newFeature)
console.log(getListOfFeaturesName()) // newFeature
console.log(getNumberOfFeatures()) // 1
console.log(extractfeaturesRaw('a sample string')) // 15
const anotherFeature = sourceString => (sourceString.length / 2) || 0
registerAFeature(anotherFeature)
console.log(getListOfFeaturesName()) // newFeature, anotherFeature
console.log(getNumberOfFeatures()) // 2
console.log(extractfeaturesRaw('a sample string')) // 15, 7.5
The API:
| function | params | returns | description |
|:----------------------|:-----------|:------------|:---------------------------------------------|
| getListOfFeaturesName | | string
| return a list of all registered features |
| getNumberOfFeatures | | number
| return total number of registerd features |
| extractfeaturesRaw | string
| string
| calculate and return a raw of features value |
| registerAFeature | function
| undefined
| register a feature in to feature list |
| registerFeaturesList | object
| undefined
| register a list of features to feature list |
every feature added should return a primitive value, it's important!
Anatomy of project
There's Babel used to build this package, Jest used for test, yargs for command line application and fs uesd for manage files.
Contribution
How to help with develop
- Fork
- Make a change
- Request a merge!
- And for maintaining this project, if anyone are available and intrested please contact me to be a maintainer!
Contact us
Don't hesitate to contact me about this project
me on github
me on telegram