Skip to content

ohnorobo/earley

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

generate.py - takes in a grammar file and generates n sentences
    timing - approx 15 seconds to generate 10 sentences in a ~10,000 line grammar

earley.py - takes a grammar and a list of sentences, 
    return True for correctly parsed sentences and False for incorrect ones
    timing - approx 5 sentences to parse 10 sentences in a ~10,000 line grammar

grammar/ - grammar files
    small-grammar.txt - little toy grammar
    large-grammar.txt - a grammar designed to make legal but difficult-to-parse sentences
        this grammar tends to produce very garden path-y sentences
        if you uncomment line 47 of generate.py it will product a bracketed sentences
        to aid human readers
        if you uncomment line 62 it wil output all the rewrite rules it uses in order


Small Grammar Example Sentences:
    is it true that a poppy played with Pru ?
    is it true that Pru played ?
    the president perplexed every perplexed president !
    the platitude played !
    Pru played !

Large Grammar Example Sentences:
    outside this cacophony this expert will neigh !
    your marshmallow force-feeds one genie this oxtail that ships the scollop eight considerations and housekeepers and two tsetses .
    that electrocution could conk off .
    what is he ?
    that heaven earlier sways back .
    nine gibbons were deep freezes !
    the charity and one web and that spookier forefoot would beware that squall .
    may seven devotions that would vote the basilisks brainwashed plum-puddings and fly-swatters deny loons the escapement ?
    is it flaps ?
    this gauchest vulgarian shall dilly dally .

About

an earley parser and a random sentence generator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages