From 47dedcf256976495f405a802920fa3012f683a52 Mon Sep 17 00:00:00 2001 From: bringert Date: Thu, 13 Apr 2006 14:18:13 +0000 Subject: [PATCH] Fixed bug in SRG top-down filtering where the start category would be removed if it wasn't referenced by itself. --- src/GF/Speech/SRG.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/GF/Speech/SRG.hs b/src/GF/Speech/SRG.hs index 0334c1301..8080b941f 100644 --- a/src/GF/Speech/SRG.hs +++ b/src/GF/Speech/SRG.hs @@ -140,7 +140,11 @@ topDownFilter srg@(SRG { startCat = start, rules = rs }) = srg { rules = rs' } rhsCats = [ (c,c') | r@(SRGRule c _ ps) <- rs, SRGAlt _ _ ss <- ps, c' <- filterCats ss] - keep = allRelated (transitiveClosure $ mkRel rhsCats) start + uses = reflexiveClosure_ (allSRGCats srg) $ transitiveClosure $ mkRel rhsCats + keep = allRelated uses start + +allSRGCats :: SRG -> [String] +allSRGCats SRG { rules = rs } = [c | SRGRule c _ _ <- rs] -- -- * Utilities for building and printing SRGs