Skip to content

The NPM package to perform statistical models on any text and extract specific features

License

Notifications You must be signed in to change notification settings

guardjs/extatistic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

extatistic

Test Publish NPM version

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

  1. Fork
  2. Make a change
  3. Request a merge!
  4. 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