GithubHelp home page GithubHelp logo

samyadaleh / cl-toolbox Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 4.0 9.12 MB

A Parsing-as-Deduction system that parses with different parsing algorithms and some related tools for educational purposes.

Java 99.94% Batchfile 0.05% Shell 0.01%
parsing deductions earley cfg java cyk-parser earley-parser earley-algorithm topdown computational-linguistics

cl-toolbox's Introduction

CL-Toolbox

Overview

A Parsing-as-Deduction system implemented in Java that parses everything and some related tools for educational purposes.

Check the documentation in /doc/doc.md for the list of currently supported algorithms and formalisms and all implementation details.

It prints out full parsing traces along with applied rules and antecedence items. Use it to generate examples, play around with grammars etc.

Without Installation

If you just want to get parsing traces of the most common algorithms, please visit http://cl-taskbox.de/. You can insert grammar and input for all algorithms listed there, afterwards click Help > Solve Task to get the full trace.

Installation

If you want to tinker with the code, for me it worked like this:

  • use your favorite IDE to clone/checkout the project
  • add the dependencies to your classpath/build path, preferable with the build.gradle file
  • run the JUnit tests in src.test to verify that everything is working. You should see some success messages and parsing outputs.

Logged-in GitHub users can download the latest jar from the Action tab.

Dependencies

See build.gradle.

Usage

Run it in your IDE.

If you downloaded or produced a jar, call with java -Dfile.encoding="UTF-8" -jar ... to correctly display special characters. Or call CL-Toolbox.bat (Windows) or CL-Toolbox.sh (Linux). They work with the same parameters, but you don't have to type in the encoding.

Video series about background and demonstration : English German

Examples:

java -jar CL-Toolbox.jar anbn.cfg "a a b b" cfg-topdown

true

1[S,0]axiom{}
2[a b,0]predict S -> a b{1}
3[a S b,0]predict S -> a S b{1}
4[b,1]scan{2}
5[S b,1]scan{3}
6[a b b,1]predict S -> a b{5}
7[a S b b,1]predict S -> a S b{5}
8[b b,2]scan{6}
9[S b b,2]scan{7}
10[b,3]scan{8}
11[a b b b,2]predict S -> a b{9}
12[a S b b b,2]predict S -> a S b{9}
13[ε,4]scan{10}

Where anbn.cfg is:

N = {S}
T = {a, b}
S = S
P = {S -> a S b, S -> a b}

CL-Toolbox.bat ancb.tag "a c b" tag-cyk --success

true

1[β,.1⊤,0,-,-,1]lex-scan a{}
3[α2,.1⊤,1,-,-,2]lex-scan c{}
7[β,.2⊤,1,1,2,2]foot-predict{}
12[α1,.2⊤,2,-,-,3]lex-scan b{}
15[β,ε⊥,0,1,2,2]move-binary{1, 7}
16[α2,ε⊥,1,-,-,2]move-unary{3}
19[β,ε⊤,0,1,2,2]null-adjoin{15}
21[α2,ε⊤,0,-,-,2]adjoin α2[ε,β]{16, 19}
23[α1,.1⊤,0,-,-,2]substitute α1[.1,α2]{21}
25[α1,ε⊥,0,-,-,3]move-binary{12, 23}
27[α1,ε⊤,0,-,-,3]null-adjoin{25}

Where ancb.tag is:

N = {S, T}
T = {a, b, c}
S = S
I = {α1 : (S T b), α2 : (T c)}
A = {β : (T a T*)}

Features

  • prints full traces or only successful traces
  • automatically transforms grammars into more expressive formalisms
  • can convert grammars to fit the algorithm
  • displays derivated trees for all algorithms
  • for TAG displays item trees on mouseover

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.