Skip to main content

Tools for JSGF grammar expansion.

Project description

JSGF Grammar Tools for Leyzer corpus

Introduction

This library generate strings from a JSGF grammar. Although it can be used to generate strings from any JSGF grammar it was created as auxilary tool for Leyzer (https://github.com/cartesinus/leyzer) grammars generation. It is slightly modified version of https://github.com/syntactic/JSGFTools.

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

Dependencies:

  • Python 3.7
  • PyParsing 3.0.9

JSGFTools were originaly created by Pastèque Ho (and others).

Library Usage

To generate strings from grammar use it as in below example. Below example use grammar that is included in this repository. Other, more complex grammars, can be found in https://github.com/cartesinus/leyzer repository.

from from JSGFToolsLeyzer import parser

fs = open("Ideas.gram")
grammar = parser.getGrammarObject(fs)

for rule in grammar.publicRules:
    expansions = processRHS(rule.rhs, grammar)
    for expansion in expansions:
        print(expansion)

License

MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

JSGFToolsLeyzer-0.2.0.tar.gz (123.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

JSGFToolsLeyzer-0.2.0-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file JSGFToolsLeyzer-0.2.0.tar.gz.

File metadata

  • Download URL: JSGFToolsLeyzer-0.2.0.tar.gz
  • Upload date:
  • Size: 123.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.28.1

File hashes

Hashes for JSGFToolsLeyzer-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9218ab33b2ea5d9e53f1b3ed9584a92d35caad281735ba9886a13a3e5f6b9332
MD5 63683562dde290a58129dbbdef5f6a18
BLAKE2b-256 916509adc675ea89d52b8805bd302b757ea5ea624112659db288675600cef699

See more details on using hashes here.

File details

Details for the file JSGFToolsLeyzer-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for JSGFToolsLeyzer-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f9c1f493a78f7e825578ee6dad77ae8bc40338cf278d1030a9c535ace892d4b2
MD5 81e92b40ac35f87859bb955227b7fba6
BLAKE2b-256 793398c9721fd592179b15dd04fd1254000535ced3c4c512963aaf9eefff4697

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page