diff options
| author | bjorn <bjorn@bringert.net> | 2008-06-16 16:44:33 +0000 |
|---|---|---|
| committer | bjorn <bjorn@bringert.net> | 2008-06-16 16:44:33 +0000 |
| commit | a47fcbcbf23ead0cf3d7144ee23906bd5f6cb440 (patch) | |
| tree | b8763526410773fe1eb2220c21c18d0c1957442c /src-3.0/GF/Speech/CFG.hs | |
| parent | 5c7c010f80533fd0909893c878b500ffb00f46bb (diff) | |
Handled renaming external SRG categories centrally.
Diffstat (limited to 'src-3.0/GF/Speech/CFG.hs')
| -rw-r--r-- | src-3.0/GF/Speech/CFG.hs | 5 |
1 files changed, 5 insertions, 0 deletions
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) } |
