From a47fcbcbf23ead0cf3d7144ee23906bd5f6cb440 Mon Sep 17 00:00:00 2001 From: bjorn Date: Mon, 16 Jun 2008 16:44:33 +0000 Subject: Handled renaming external SRG categories centrally. --- src-3.0/GF/Speech/CFG.hs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src-3.0/GF/Speech/CFG.hs') diff --git a/src-3.0/GF/Speech/CFG.hs b/src-3.0/GF/Speech/CFG.hs index a99a9d011..dfcecf913 100644 --- a/src-3.0/GF/Speech/CFG.hs +++ b/src-3.0/GF/Speech/CFG.hs @@ -242,6 +242,11 @@ catRules gr c = Set.toList $ Map.findWithDefault Set.empty c (cfgRules gr) catSetRules :: CFG -> Set Cat -> [CFRule] catSetRules gr cs = allRules $ filterCFGCats (`Set.member` cs) gr +mapCFGCats :: (Cat -> Cat) -> CFG -> CFG +mapCFGCats f cfg = mkCFG (f (cfgStartCat cfg)) + (Set.map f (cfgExternalCats cfg)) + [CFRule (f lhs) (map (mapSymbol f id) rhs) t | CFRule lhs rhs t <- allRules cfg] + onCFG :: (Map Cat (Set CFRule) -> Map Cat (Set CFRule)) -> CFG -> CFG onCFG f cfg = cfg { cfgRules = f (cfgRules cfg) } -- cgit v1.2.3