mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
"Committed_by_peb"
This commit is contained in:
@@ -5,9 +5,9 @@
|
||||
-- Stability : (stable)
|
||||
-- Portability : (portable)
|
||||
--
|
||||
-- > CVS $Date: 2005/02/18 19:21:07 $
|
||||
-- > CVS $Date: 2005/03/21 13:54:24 $
|
||||
-- > CVS $Author: peb $
|
||||
-- > CVS $Revision: 1.5 $
|
||||
-- > CVS $Revision: 1.6 $
|
||||
--
|
||||
-- Bottom-up Kilbury chart parser from "Pure Functional Parsing", chapter 5.
|
||||
-- OBSOLETE -- should use new MCFG parsers instead
|
||||
@@ -15,9 +15,9 @@
|
||||
|
||||
module ChartParser (chartParser) where
|
||||
|
||||
import Tracing
|
||||
import PrintParser
|
||||
import PrintSimplifiedTerm
|
||||
-- import Tracing
|
||||
-- import PrintParser
|
||||
-- import PrintSimplifiedTerm
|
||||
|
||||
import Operations
|
||||
import CF
|
||||
@@ -117,11 +117,11 @@ chartParser0 (productions, terminal) = cparse
|
||||
| otherwise = [cats]
|
||||
|
||||
cparse :: Category -> [Token] -> ([ParseTree], String)
|
||||
cparse start input = trace "ChartParser" $
|
||||
cparse start input = -- trace "ChartParser" $
|
||||
case lookup (0, length input, start) $
|
||||
tracePrt "#edgeTrees" (prt . map (length.snd)) $
|
||||
-- tracePrt "#edgeTrees" (prt . map (length.snd)) $
|
||||
edgeTrees of
|
||||
Just trees -> tracePrt "#trees" (prt . length . fst) $
|
||||
Just trees -> -- tracePrt "#trees" (prt . length . fst) $
|
||||
(trees, "Chart:" ++++ prChart passiveEdges)
|
||||
Nothing -> ([], "Chart:" ++++ prChart passiveEdges)
|
||||
where
|
||||
@@ -136,7 +136,7 @@ chartParser0 (productions, terminal) = cparse
|
||||
(i, b, a:bs) <- elems state ]
|
||||
|
||||
initialChart :: Chart
|
||||
initialChart = tracePrt "#initialChart" (prt . map (length.elems)) $
|
||||
initialChart = -- tracePrt "#initialChart" (prt . map (length.elems)) $
|
||||
emptySet : map initialState (zip [0..] input)
|
||||
where initialState (j, sym) = makeSet [ (j, cat, []) |
|
||||
(cat, _) <- terminal sym ]
|
||||
@@ -151,12 +151,12 @@ chartParser0 (productions, terminal) = cparse
|
||||
a `elemSet` emptyCats ]
|
||||
|
||||
passiveEdges :: [Passive]
|
||||
passiveEdges = tracePrt "#passiveEdges" (prt . length) $
|
||||
passiveEdges = -- tracePrt "#passiveEdges" (prt . length) $
|
||||
[ (i, j, cat) |
|
||||
(j, state) <- zip [0..] $
|
||||
tracePrt "#passiveChart"
|
||||
(prt . map (length.filter (\(_,_,x)->null x).elems)) $
|
||||
tracePrt "#activeChart" (prt . map (length.elems)) $
|
||||
-- tracePrt "#passiveChart"
|
||||
-- (prt . map (length.filter (\(_,_,x)->null x).elems)) $
|
||||
-- tracePrt "#activeChart" (prt . map (length.elems)) $
|
||||
finalChart,
|
||||
(i, cat, []) <- elems state ]
|
||||
++
|
||||
@@ -190,9 +190,11 @@ chartParser0 (productions, terminal) = cparse
|
||||
tree <- trees ]
|
||||
|
||||
|
||||
{-
|
||||
instance Print ParseTree where
|
||||
prt (Node name cat trees) = prt name++"."++prt cat++"^{"++prtSep "," trees++"}"
|
||||
prt (Leaf token) = prt token
|
||||
-}
|
||||
|
||||
-- AR 10/12/2002
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
-- Stability : (stable)
|
||||
-- Portability : (portable)
|
||||
--
|
||||
-- > CVS $Date: 2005/03/18 10:17:10 $
|
||||
-- > CVS $Date: 2005/03/21 13:54:24 $
|
||||
-- > CVS $Author: peb $
|
||||
-- > CVS $Revision: 1.8 $
|
||||
-- > CVS $Revision: 1.9 $
|
||||
--
|
||||
-- Handles printing a CFGrammar in CFGM format.
|
||||
-----------------------------------------------------------------------------
|
||||
@@ -19,13 +19,13 @@ import qualified PrintCFG
|
||||
import Ident
|
||||
import GFC
|
||||
import Modules
|
||||
import qualified ConvertGrammar as Cnv
|
||||
import qualified PrintParser as Prt
|
||||
import qualified CFGrammar
|
||||
import qualified GrammarTypes as GT
|
||||
import qualified GF.Conversion.ConvertGrammar as Cnv
|
||||
import qualified GF.Parsing.PrintParser as Prt
|
||||
import qualified GF.Conversion.CFGrammar as CFGrammar
|
||||
import qualified GF.Conversion.GrammarTypes as GT
|
||||
import qualified AbsCFG
|
||||
import qualified Parser
|
||||
import qualified PrintParser
|
||||
import qualified GF.Parsing.Parser as Parser
|
||||
import qualified GF.Parsing.PrintParser as PrintParser
|
||||
import ErrM
|
||||
import qualified Option
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
-- Stability : (stable)
|
||||
-- Portability : (portable)
|
||||
--
|
||||
-- > CVS $Date: 2005/03/18 10:17:10 $
|
||||
-- > CVS $Date: 2005/03/21 13:54:24 $
|
||||
-- > CVS $Author: peb $
|
||||
-- > CVS $Revision: 1.38 $
|
||||
-- > CVS $Revision: 1.39 $
|
||||
--
|
||||
-- (Description of the module)
|
||||
-----------------------------------------------------------------------------
|
||||
@@ -36,7 +36,7 @@ import Arch (ModTime)
|
||||
|
||||
-- peb 25/5-04
|
||||
-- import CFtoCFG
|
||||
import qualified ConvertGrammar as Cnv
|
||||
import qualified GF.Conversion.ConvertGrammar as Cnv
|
||||
|
||||
import List (nub,nubBy)
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
-- Stability : (stable)
|
||||
-- Portability : (portable)
|
||||
--
|
||||
-- > CVS $Date: 2005/03/18 10:17:10 $
|
||||
-- > CVS $Date: 2005/03/21 13:54:44 $
|
||||
-- > CVS $Author: peb $
|
||||
-- > CVS $Revision: 1.11 $
|
||||
-- > CVS $Revision: 1.12 $
|
||||
--
|
||||
-- This module prints a CFG as a Nuance GSL 2.0 grammar.
|
||||
--
|
||||
@@ -19,10 +19,10 @@ module PrGSL (gslPrinter) where
|
||||
|
||||
import SRG
|
||||
import Ident
|
||||
import CFGrammar
|
||||
import Parser (Symbol(..))
|
||||
import GrammarTypes
|
||||
import PrintParser
|
||||
import GF.Conversion.CFGrammar
|
||||
import GF.Parsing.Parser (Symbol(..))
|
||||
import GF.Conversion.GrammarTypes
|
||||
import GF.Parsing.PrintParser
|
||||
import Option
|
||||
|
||||
import Data.Char (toUpper,toLower)
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
-- Stability : (stable)
|
||||
-- Portability : (portable)
|
||||
--
|
||||
-- > CVS $Date: 2005/03/18 10:17:11 $
|
||||
-- > CVS $Date: 2005/03/21 13:54:44 $
|
||||
-- > CVS $Author: peb $
|
||||
-- > CVS $Revision: 1.5 $
|
||||
-- > CVS $Revision: 1.6 $
|
||||
--
|
||||
-- This module prints a CFG as a JSGF grammar.
|
||||
--
|
||||
@@ -21,10 +21,10 @@ module PrJSGF (jsgfPrinter) where
|
||||
|
||||
import SRG
|
||||
import Ident
|
||||
import CFGrammar
|
||||
import Parser (Symbol(..))
|
||||
import GrammarTypes
|
||||
import PrintParser
|
||||
import GF.Conversion.CFGrammar
|
||||
import GF.Parsing.Parser (Symbol(..))
|
||||
import GF.Conversion.GrammarTypes
|
||||
import GF.Parsing.PrintParser
|
||||
import Option
|
||||
|
||||
jsgfPrinter :: Ident -- ^ Grammar name
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
-- Stability : (stable)
|
||||
-- Portability : (portable)
|
||||
--
|
||||
-- > CVS $Date: 2005/03/18 10:17:11 $
|
||||
-- > CVS $Date: 2005/03/21 13:54:44 $
|
||||
-- > CVS $Author: peb $
|
||||
-- > CVS $Revision: 1.7 $
|
||||
-- > CVS $Revision: 1.8 $
|
||||
--
|
||||
-- Representation of, conversion to, and utilities for
|
||||
-- printing of a general Speech Recognition Grammar.
|
||||
@@ -21,10 +21,10 @@
|
||||
module SRG where
|
||||
|
||||
import Ident
|
||||
import CFGrammar
|
||||
import Parser (Symbol(..))
|
||||
import GrammarTypes
|
||||
import PrintParser
|
||||
import GF.Conversion.CFGrammar
|
||||
import GF.Parsing.Parser (Symbol(..))
|
||||
import GF.Conversion.GrammarTypes
|
||||
import GF.Parsing.PrintParser
|
||||
import TransformCFG
|
||||
import Option
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
-- Stability : (stable)
|
||||
-- Portability : (portable)
|
||||
--
|
||||
-- > CVS $Date: 2005/03/18 10:17:11 $
|
||||
-- > CVS $Date: 2005/03/21 13:54:44 $
|
||||
-- > CVS $Author: peb $
|
||||
-- > CVS $Revision: 1.5 $
|
||||
-- > CVS $Revision: 1.6 $
|
||||
--
|
||||
-- This module does some useful transformations on CFGs.
|
||||
--
|
||||
@@ -17,10 +17,10 @@
|
||||
module TransformCFG (makeNice, CFRule_) where
|
||||
|
||||
import Ident
|
||||
import CFGrammar
|
||||
import Parser (Symbol(..))
|
||||
import GrammarTypes
|
||||
import PrintParser
|
||||
import GF.Conversion.CFGrammar
|
||||
import GF.Parsing.Parser (Symbol(..))
|
||||
import GF.Conversion.GrammarTypes
|
||||
import GF.Parsing.PrintParser
|
||||
|
||||
import Data.FiniteMap
|
||||
import Data.List
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
-- Stability : (stable)
|
||||
-- Portability : (portable)
|
||||
--
|
||||
-- > CVS $Date: 2005/03/02 14:25:45 $
|
||||
-- > CVS $Author: aarne $
|
||||
-- > CVS $Revision: 1.44 $
|
||||
-- > CVS $Date: 2005/03/21 13:54:44 $
|
||||
-- > CVS $Author: peb $
|
||||
-- > CVS $Revision: 1.45 $
|
||||
--
|
||||
-- A database for customizable GF shell commands.
|
||||
--
|
||||
@@ -66,15 +66,15 @@ import GrammarToHaskell
|
||||
|
||||
-- the cf parsing algorithms
|
||||
import ChartParser -- or some other CF Parser
|
||||
import qualified ParseCF as PCF
|
||||
import qualified GF.Parsing.ParseCF as PCF
|
||||
--import qualified ParseGFCviaCFG as PGFC
|
||||
--import NewChartParser
|
||||
--import NewerChartParser
|
||||
|
||||
-- grammar conversions -- peb 19/4-04
|
||||
-- see also customGrammarPrinter
|
||||
import qualified ConvertGrammar as Cnv
|
||||
import qualified PrintParser as Prt
|
||||
import qualified GF.Conversion.ConvertGrammar as Cnv
|
||||
import qualified GF.Parsing.PrintParser as Prt
|
||||
|
||||
import GFC
|
||||
import qualified MkGFC as MC
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
-- Stability : (stable)
|
||||
-- Portability : (portable)
|
||||
--
|
||||
-- > CVS $Date: 2005/02/24 11:46:39 $
|
||||
-- > CVS $Date: 2005/03/21 13:54:45 $
|
||||
-- > CVS $Author: peb $
|
||||
-- > CVS $Revision: 1.14 $
|
||||
-- > CVS $Revision: 1.15 $
|
||||
--
|
||||
-- (Description of the module)
|
||||
-----------------------------------------------------------------------------
|
||||
@@ -35,7 +35,7 @@ import Custom
|
||||
import ShellState
|
||||
|
||||
import PPrCF (prCFTree)
|
||||
import qualified ParseGFC as N
|
||||
import qualified GF.Parsing.ParseGFC as N
|
||||
|
||||
import Operations
|
||||
|
||||
|
||||
Reference in New Issue
Block a user