mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 03:32:51 -06:00
Renamed removeEmptyCats to bottomUpFilter.
This commit is contained in:
@@ -63,7 +63,7 @@ cfgToFA opts s = minimize $ compileAutomaton start $ makeSimpleRegular s
|
|||||||
where start = getStartCatCF opts s
|
where start = getStartCatCF opts s
|
||||||
|
|
||||||
makeSimpleRegular :: StateGrammar -> CFRules
|
makeSimpleRegular :: StateGrammar -> CFRules
|
||||||
makeSimpleRegular = makeRegular . removeIdenticalRules . removeEmptyCats . cfgToCFRules
|
makeSimpleRegular = makeRegular . removeIdenticalRules . bottomUpFilter . cfgToCFRules
|
||||||
|
|
||||||
--
|
--
|
||||||
-- * Approximate context-free grammars with regular grammars.
|
-- * Approximate context-free grammars with regular grammars.
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ makeSimpleSRG opt s =
|
|||||||
l = fmap (replace '_' '-') $ getOptVal opts speechLanguage
|
l = fmap (replace '_' '-') $ getOptVal opts speechLanguage
|
||||||
(cats,cfgRules) = unzip $ preprocess $ cfgToCFRules s
|
(cats,cfgRules) = unzip $ preprocess $ cfgToCFRules s
|
||||||
preprocess = removeLeftRecursion origStart
|
preprocess = removeLeftRecursion origStart
|
||||||
. removeEmptyCats
|
. bottomUpFilter
|
||||||
. topDownFilter origStart
|
. topDownFilter origStart
|
||||||
. removeIdenticalRules
|
. removeIdenticalRules
|
||||||
. removeCycles
|
. removeCycles
|
||||||
|
|||||||
@@ -87,8 +87,8 @@ stateGFCC :: StateGrammar -> GFCC
|
|||||||
stateGFCC = mkGFCC . mkCanon2gfcc . stateGrammarST
|
stateGFCC = mkGFCC . mkCanon2gfcc . stateGrammarST
|
||||||
|
|
||||||
-- | Remove productions which use categories which have no productions
|
-- | Remove productions which use categories which have no productions
|
||||||
removeEmptyCats :: CFRules -> CFRules
|
bottomUpFilter :: CFRules -> CFRules
|
||||||
removeEmptyCats = fix removeEmptyCats'
|
bottomUpFilter = fix removeEmptyCats'
|
||||||
where
|
where
|
||||||
removeEmptyCats' :: CFRules -> CFRules
|
removeEmptyCats' :: CFRules -> CFRules
|
||||||
removeEmptyCats' rs = k'
|
removeEmptyCats' rs = k'
|
||||||
|
|||||||
Reference in New Issue
Block a user