From c7df9f4167f7b554a93a216245a013e16cca420d Mon Sep 17 00:00:00 2001 From: bringert Date: Sun, 17 Dec 2006 19:18:28 +0000 Subject: Added still unused implementation of Moore's LCLR algorithm for left recursion elimination. Fixed top category generation for SRG (included LR-elimination-added categories before). --- src/GF/Speech/PrJSGF.hs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/GF/Speech/PrJSGF.hs') diff --git a/src/GF/Speech/PrJSGF.hs b/src/GF/Speech/PrJSGF.hs index 90e8678f1..05aa6562c 100644 --- a/src/GF/Speech/PrJSGF.hs +++ b/src/GF/Speech/PrJSGF.hs @@ -44,7 +44,7 @@ jsgfPrinter name start opts sisr probs cfg = prJSGF srg sisr "" where srg = makeSimpleSRG name start opts probs cfg prJSGF :: SRG -> Maybe SISRFormat -> ShowS -prJSGF (SRG{grammarName=name,startCat=start,origStartCat=origStart,rules=rs}) sisr +prJSGF srg@(SRG{grammarName=name,startCat=start,origStartCat=origStart,rules=rs}) sisr = header . nl . mainCat . nl . unlinesS topCatRules . nl @@ -62,9 +62,8 @@ prJSGF (SRG{grammarName=name,startCat=start,origStartCat=origStart,rules=rs}) si -- FIXME: use the probability prAlt (EBnfSRGAlt mp n rhs) = tag sisr (profileInitSISR n) . showChar ' '. prItem sisr rhs - topCatRules = [rule True (catFormId tc) (map (it tc) cs) | (tc,cs) <- topCats] - where topCats = buildMultiMap [(cfgCatToGFCat origCat, cat) | SRGRule cat origCat _ <- rs] - it i c = prCat c . tag sisr [(EThis :. catFieldId i) := (ERef c)] + topCatRules = [rule True (catFormId tc) (map (it tc) cs) | (tc,cs) <- srgTopCats srg] + where it i c = prCat c . tag sisr [(EThis :. catFieldId i) := (ERef c)] catFormId :: String -> String catFormId = (++ "_cat") -- cgit v1.2.3