From 1bcffdce301addfd99f526af23e4cdf88611027b Mon Sep 17 00:00:00 2001 From: bjorn Date: Fri, 26 Sep 2008 09:28:03 +0000 Subject: [PATCH] Change category naming in CFG generation: the number now starts from 1 for each GF category, instead of being the FCFG category number. --- src/GF/Speech/PGFToCFG.hs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/GF/Speech/PGFToCFG.hs b/src/GF/Speech/PGFToCFG.hs index c11f647d6..0602e5a58 100644 --- a/src/GF/Speech/PGFToCFG.hs +++ b/src/GF/Speech/PGFToCFG.hs @@ -61,14 +61,16 @@ pgfToCFG pgf lang = mkCFG (lookStartCat pgf) extCats (startRules ++ concatMap fr rules :: [FRule] rules = Array.elems (PGF.allRules pinfo) - fcatGFCats :: Map FCat CId - fcatGFCats = Map.fromList [(fc,c) | (c,fcs) <- Map.toList (startupCats pinfo), fc <- fcs] - - fcatGFCat :: FCat -> CId - fcatGFCat c = fromMaybe (mkCId "Unknown") (Map.lookup c fcatGFCats) + fcatCats :: Map FCat Cat + fcatCats = Map.fromList [(fc, prCId c ++ "_" ++ show i) + | (c,fcs) <- Map.toList (startupCats pinfo), + (fc,i) <- zip fcs [1..]] + + fcatCat :: FCat -> Cat + fcatCat c = Map.findWithDefault ("Unknown_" ++ show c) c fcatCats fcatToCat :: FCat -> FIndex -> Cat - fcatToCat c l = prCId (fcatGFCat c) ++ "_" ++ show c ++ row + fcatToCat c l = fcatCat c ++ row where row = if catLinArity c == 1 then "" else "_" ++ show l -- gets the number of fields in the lincat for the given category