Giter Site home page Giter Site logo

guardjs / extatistic Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 1.28 MB

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

Home Page: https://www.npmjs.com/package/extatistic

License: MIT License

JavaScript 100.00%
extract-features statistical-models

extatistic's Introduction

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

extatistic's People

Contributors

dependabot[bot] avatar easa avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

extatistic's Issues

Add dynamic features

Make it possible to define functions by user to extract features (let's call it ef)!

  1. Define the default parameters sent to ef.
  2. Define the result value of ef.
  3. Write unit tests.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.