Code Monkey home page Code Monkey logo

jsgftools's Introduction

JSGF Grammar Tools

This set of tools can be used primarily to generate strings from a JSGF grammar, but it also provides an easy to use JSGFParser module which creates abstract syntax trees for JSGF grammars. Developers can use these ASTs to help create more tools for their purposes. For more detailed documentation, refer to the Sphinx documentation located in docs/_build/html/index.html

Dependencies

Instructions

The two main Python scripts are DeterministicGenerator.py and ProbabilisticGenerator.py. Both files require a grammar file as a command line argument, and the latter also requires a number, which refers to the number of sentences to generate. Importantly, DeterministicGenerator.py should not take grammars with recursive rules as an argument. A recursive rule is of the form:

<nonTerminal> = this (comes | goes) back to <nonTerminal>;

There are two example grammars included with the scripts: Ideas.gram and IdeasNonRecursive.gram. Ideas.gram is an example of a grammar with recursive rules, though the recursion is not as direct as the above example. It's a good idea to run these grammars with the generator scripts to see how the scripts work:

> python DeterministicGenerator.py IdeasNonRecursive.gram

> python ProbabilisticGenerator.py Ideas.gram 20

Notes

  • Larger grammars take a longer time to parse, so if nothing seems to be generating, wait a few seconds and the grammar should be parsed.

  • Most of JSGF as described in http://www.w3.org/TR/2000/NOTE-jsgf-20000605/ is supported, but there are a few things that have not been implemented by these tools yet:

    • Kleene operators
    • Imports and Grammar Names
    • Tags

jsgftools's People

Contributors

timothyakho 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.