Git Product home page Git Product logo

simpledataparser's Introduction

Simple Data Parser

Simple data parser and filter recognizing boolean expression and value (with one-time variable substitution) comparisons.

Grammar (EBNF)

<expression> ::= <term> {<or> <term>}
<term> ::= <factor> {<and> <factor>}
<factor> ::= <comparison> | (<expression>)
<comparison> ::= <value> <operator> <value>
<value> ::= <variable> | <number>
<operator> ::= > | >= | < | <= | = | !=
<or> ::= OR | or
<and> ::= AND | and

How to use it

  1. Build project

    ./gradlew build
  2. Run program with path to data file as an argument

    java -jar build/libs/sdp-1.0.jar data/iris.data
  3. Enter selector to filter rows

     Enter data selector for attributes [sl, sw, pl, pw]:  (sw < 3 OR sw >= 4) AND pw = 0.2 
    
  4. Look at the constructed abstract syntax tree

     AST for entered selector:
     └── AND
         ├── OR
         │   ├── <
         │   │   ├── sw
         │   │   └── 3.0
         │   └── >=
         │       ├── sw
         │       └── 4.0
         └── =
             ├── pw
             └── 0.2
    
  5. Accept selector or deny and enter new one

     Do you accept it? [y/n]:  y
    
  6. Look at the selected rows

     Selected rows:
     {sw=2.9, pw=0.2, sl=4.4, pl=1.4}
     {sw=4.0, pw=0.2, sl=5.8, pl=1.2}
     {sw=4.2, pw=0.2, sl=5.5, pl=1.4}
     
     Result:  3 out of 150 rows selected in 0.028s
    

Data files

File format

Input files should contain tab-separated values. If first line contains values that start with a letter it is treated as a header and its values as attribute names. Otherwise attribute names are automatically generated as follows: a, b, ..., z, aa, ab, .... All values outside header should be numerical.

Sample data

Sample data sets located in data directory are taken from UC Irvine Machine Learning Repository.

License

Look inside LICENSE file.

simpledataparser's People

Contributors

mikus avatar

Watchers

 avatar  avatar

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.