summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbjorn <bjorn@bringert.net>2008-09-26 09:28:03 +0000
committerbjorn <bjorn@bringert.net>2008-09-26 09:28:03 +0000
commit1bcffdce301addfd99f526af23e4cdf88611027b (patch)
tree68e15405b94d886691bab8249a676c17c7f066ee
parent92c76a626571fd2ccc50641595cbfec9681656dc (diff)
Change category naming in CFG generation: the number now starts from 1 for each GF category, instead of being the FCFG category number.
-rw-r--r--src/GF/Speech/PGFToCFG.hs14
1 files 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