language-toolkit-1.2.0.0: A set of tools for analyzing languages via logic and automata
Copyright(c) 2019-2020 Dakotah Lambert
LicenseMIT
Safe HaskellSafe-Inferred
LanguageHaskell2010

LTK.Learn.StringExt

Description

A generic implementation of Jeff Heinz's "String Extension Learning". For details, see https://www.aclweb.org/anthology/P10-1092

Since: 0.3

Synopsis

Documentation

class Grammar (g :: Type -> Type) where #

A grammar is a representation of a mechanism by which one can determine whether or not a given object is in a given set.

Methods

genFSA :: (NFData a, Ord a) => g a -> FSA Integer a #

augmentG :: Ord a => g a -> g a -> g a #

isSubGOf :: Ord a => g a -> g a -> Bool #

emptyG :: Ord a => g a #

Instances

Instances details
Grammar SLG # 
Instance details

Defined in LTK.Learn.SL

Methods

genFSA :: (NFData a, Ord a) => SLG a -> FSA Integer a #

augmentG :: Ord a => SLG a -> SLG a -> SLG a #

isSubGOf :: Ord a => SLG a -> SLG a -> Bool #

emptyG :: Ord a => SLG a #

Grammar SPG # 
Instance details

Defined in LTK.Learn.SP

Methods

genFSA :: (NFData a, Ord a) => SPG a -> FSA Integer a #

augmentG :: Ord a => SPG a -> SPG a -> SPG a #

isSubGOf :: Ord a => SPG a -> SPG a -> Bool #

emptyG :: Ord a => SPG a #

Grammar TSLG # 
Instance details

Defined in LTK.Learn.TSL.AugmentedSubsequences

Methods

genFSA :: (NFData a, Ord a) => TSLG a -> FSA Integer a #

augmentG :: Ord a => TSLG a -> TSLG a -> TSLG a #

isSubGOf :: Ord a => TSLG a -> TSLG a -> Bool #

emptyG :: Ord a => TSLG a #

Grammar TSLG # 
Instance details

Defined in LTK.Learn.TSL.ViaSL

Methods

genFSA :: (NFData a, Ord a) => TSLG a -> FSA Integer a #

augmentG :: Ord a => TSLG a -> TSLG a -> TSLG a #

isSubGOf :: Ord a => TSLG a -> TSLG a -> Bool #

emptyG :: Ord a => TSLG a #

learn :: (Grammar g, Ord b, Collapsible s) => (a -> g b) -> s (Maybe a) -> g b #

Construct a grammar from a finite initial segment of a positive text. The function argument \(f\) should be such that if \(G=f(L)\) and \(f(w)\in G\) then \(w\in L\). In order to be able to learn the empty set, the text argument allows for time points at which no data is provided.

augmentSE :: (Grammar g, Ord b, Collapsible s) => (a -> g b) -> g b -> s (Maybe a) -> g b #

Add more data to a grammar generated by learn.

isRecognizedBy :: (Grammar g, Ord b) => (a -> g b) -> g b -> a -> Bool #

True iff the given object is in the set represented by the given grammar.