Git Product home page Git Product logo

rtokenize's Introduction

rtokenize

Ruby tool to tokenise YAML, JSON and other files

  • ./rtokenize.rb [-y|--yaml|-j|--json] < file > output_file

Options:

  • -j|--json - tokenize JSON file
  • -y|--yaml - tokenize YAML file
  • -h|--header - Generate begin_unit header and end_unit footer
  • -n|--numbers - Generate numeric stats (first number is Nth call of recursive tokenizer, second number is Nth token within single call)
  • -s N|--split N - Split string tokens longer than given N
  • -p P|--part-size P - Split string part size (will split strings longer than N into parts not longer than P), specify P=1 to split every word in strings longer than N

Tool reads from standard input and writes to standard output. Eventual errors are written to standard error.

rlocalize

Ruby tool to localize tokens in original file. When we have tokenized file generated, we may want to know where each token is in the original sorce file.

To check this use:

  • ./rlocalize.rb json tokenized_json.token original_json.json [0]
  • ./rlocalize.rb yaml tokenized_yaml.token original_yaml.yaml [0]

Parameters are:

  • type of file: json or yaml
  • tokenized file (output of ./rtokenize.rb)
  • original file
  • start position in original file (defaults to 0)

Shell scripts

Some ready to go Shell scripts:

  • ./check_yamls.sh - this is a check on all Kubernetes YAML files - to see if parser works for all of them.
  • ./check_jsons.sh - this is a check on all Kubernetes JSON files - to see if parser works for all of them.
  • ./check_yaml.sh file_name.yaml - check tokenize & localize on single YAML file
  • ./check_json.sh file_name.json - check tokenize & localize on single JSON file
  • ./rtokenize.sh y|j - read YAML or JSON from stdin, output tokenized & localized to stdout

rtokenize's People

Contributors

lukaszgryglicki avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar  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.