diff options
| author | bringert <bringert@cs.chalmers.se> | 2007-01-05 15:38:47 +0000 |
|---|---|---|
| committer | bringert <bringert@cs.chalmers.se> | 2007-01-05 15:38:47 +0000 |
| commit | 6ee7296f9dd5290bb3ee581403a18464444ab28b (patch) | |
| tree | e78719e9463866a899bfe5e1cabc26844860e7c0 /src/GF/Speech/CFGToFiniteState.hs | |
| parent | 741dde5a2a00dc737e570a7005663c2534ea4f6d (diff) | |
Changed all SRG printer to take Options and StateGrammar arguments. This makes Custom a lot cleaner.
Diffstat (limited to 'src/GF/Speech/CFGToFiniteState.hs')
| -rw-r--r-- | src/GF/Speech/CFGToFiniteState.hs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/GF/Speech/CFGToFiniteState.hs b/src/GF/Speech/CFGToFiniteState.hs index 0e48c66d3..e1ee48610 100644 --- a/src/GF/Speech/CFGToFiniteState.hs +++ b/src/GF/Speech/CFGToFiniteState.hs @@ -27,6 +27,7 @@ import GF.Formalism.CFG import GF.Formalism.Utilities (Symbol(..), mapSymbol, filterCats, symbol, NameProfile(..)) import GF.Conversion.Types import GF.Infra.Ident (Ident) +import GF.Infra.Option (Options) import GF.Compile.ShellState (StateGrammar) import GF.Speech.FiniteState @@ -57,8 +58,9 @@ data MFA a = MFA (DFA (MFALabel a)) [(String,DFA (MFALabel a))] -cfgToFA :: String -> StateGrammar -> DFA String -cfgToFA start = minimize . compileAutomaton start . makeSimpleRegular +cfgToFA :: Options -> StateGrammar -> DFA String +cfgToFA opts s = minimize $ compileAutomaton start $ makeSimpleRegular s + where start = getStartCatCF opts s makeSimpleRegular :: StateGrammar -> CFRules makeSimpleRegular = makeRegular . removeIdenticalRules . removeEmptyCats . cfgToCFRules @@ -145,12 +147,13 @@ make_fa c@(g,ns) q0 alpha q1 fa = -- * Compile a strongly regular grammar to a DFA with sub-automata -- -cfgToMFA :: String -> StateGrammar -> MFA String -cfgToMFA start g = buildMFA start g +cfgToMFA :: Options -> StateGrammar -> MFA String +cfgToMFA opts s = buildMFA start s + where start = getStartCatCF opts s -- | Build a DFA by building and expanding an MFA -cfgToFA' :: String -> StateGrammar -> DFA String -cfgToFA' start = mfaToDFA . cfgToMFA start +cfgToFA' :: Options -> StateGrammar -> DFA String +cfgToFA' opts s = mfaToDFA $ cfgToMFA opts s buildMFA :: Cat_ -- ^ Start category -> StateGrammar -> MFA String |
