Coder Social home page Coder Social logo

pyoracc's Introduction

pyoracc

Build Status Maintainability codecov DOI

Python tools for working with ORACC/C-ATF files

Depends on PLY, Mako and Pytest

Installation

If you don't use pip, you're missing out. Here are installation instructions.

Simply run:

    $ cd pyoracc
    $ git pull origin master
    $ pip install .

Or you can just do

$ pip install git+git://github.com/cdli-gh/pyoracc.git 

Or you can also do

$ pip install git+https://github.com/cdli-gh/pyoracc.git 

Upgrading

If you already have installed it and want to upgrade the tool:

    $ cd pyoracc
    $ git pull origin master
    $ pip install . --upgrade

Or you can just do

$ pip install git+git://github.com/cdli-gh/pyoracc.git --upgrade

Or you can also do

$ pip install git+https://github.com/cdli-gh/pyoracc.git --upgrade

Usage

To use it:

$ pyoracc --help

*Only files with the .atf extension can be processed. *

To run it on file:

$ pyoracc -i ./pyoracc/test/data/cdli_atf_20180104.atf -f cdli

For a fresh copy of CDLI ATF, download the data bundle here : https://github.com/cdli-gh/data/blob/master/cdliatf_unblocked.atf

To run it on oracc file:

$ pyoracc -i ./pyoracc/test/data/cdli_atf_20180104.atf -f oracc

To run it on folder:

$ pyoracc -i ./pyoracc/test/data -f cdli

To see the console messages of the tool, use --verbose switch

$ pyoracc -i ./pyoracc/test/data -f cdli --verbose

Note that using the verbose option will also create a parselog.txt file, containing the log output along with displaying it on command line. The verbose output contains the lexical symbols, the parse grammer table and the LR parsing table states.

Also note that, first time usage with any atf format will always display the parse tables irrespective of verbose switch.

If you don't give arguments, it will prompt for the path and atf file type.

Help

$ pyoracc --help
Usage: pyoracc [OPTIONS]

  My Tool does one work, and one work well.

Options:
  -i, --input_path PATH      Input the file/folder name.  [required]
  -f, --atf_type [cdli|atf]  Input the atf file type.  [required]
  -v, --verbose              Enables verbose mode
  --version                  Show the version and exit.
  --help                     Show this message and exit.

Internal Dev Usage

Development Guideline

  • ORACC atf based changes will go in pyoracc/atf/oracc
  • CDLI atf based changes will go in pyoracc/atf/cdli
  • Common atf based changes will go in pyoracc/atf/common

To run on directory

$ python  -m pyoracc.model.corpus ./pyoracc/test/data  cdli

To run on individual file

$ python -m pyoracc.atf.common.atffile ./pyoracc/test/data/cdli_atf_20180104.atf cdli True

Running Tests

Before running pytest and coverage, install py.test and pytest-cov.

$ py.test --cov=pyoracc --cov-report xml --cov-report html --cov-report annotate

Before running pycodestyle, install pycodestyle.

$ pycodestyle

API Consumption

from pyoracc.atf.common.atffile import file_process
file_process(pathname, atftype, verbose)

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.