Copyright | (c) Greg Kobele 2019 |
---|---|
Maintainer | gkobele@uni-leipzig.de |
Safe Haskell | Safe |
This module implements Tier-based Strictly local string grammars, and parsing, generation, and learning algorithms for them:
- Parsing
- How could we use a grammar to understand (recognize) language data?
- Generation
- How could we use a grammar to construct a sentence?
- Learning
- How could we learn a grammar from language data?
Documentation
acceptTSL :: Eq a => TSL a -> Int -> Sentence a -> Bool Source #
determining whether a sentence is generated by the grammar is a matter of checking that its factors are permitted by the grammar
generateTSL :: Eq a => [a] -> Int -> TSL a -> [Sentence a] Source #
The generation algorithm first makes a tree of all the grammatical ways of adding a next letter to what we had before, then enumerates the nodes of this tree in a breadth-first fashion. The unfinished sentences are filtered out of this list of nodes, and then the remaining sentences are made pretty.