summaryrefslogtreecommitdiff
path: root/src/GF
diff options
context:
space:
mode:
authorbringert <bringert@cs.chalmers.se>2006-01-20 18:20:02 +0000
committerbringert <bringert@cs.chalmers.se>2006-01-20 18:20:02 +0000
commit92f22c8f5c13c381d323caeffe17b6dab4c2d927 (patch)
tree781df98a6d12fc280e09b8b7758cf28eabf082da /src/GF
parent0f6c51f741668adc68491c79ca94cc4b98f5d154 (diff)
Use right start category names in si command.
Diffstat (limited to 'src/GF')
-rw-r--r--src/GF/API.hs2
-rw-r--r--src/GF/Data/Utilities.hs4
-rw-r--r--src/GF/Speech/CFGToFiniteState.hs2
-rw-r--r--src/GF/Speech/TransformCFG.hs2
4 files changed, 5 insertions, 5 deletions
diff --git a/src/GF/API.hs b/src/GF/API.hs
index 9ad5c7a3f..c15d03b6a 100644
--- a/src/GF/API.hs
+++ b/src/GF/API.hs
@@ -216,7 +216,7 @@ speechInput opt s = recognizeSpeech name language cfg cat number
name = cncId s
cfg = stateCFG s -- FIXME: use lang flag to select grammar
language = fromMaybe "en_UK" (getOptVal opts speechLanguage)
- cat = fromMaybe "S" (getOptVal opts gStartCat)
+ cat = fromMaybe "S" (getOptVal opts gStartCat) ++ "{}.s"
number = optIntOrN opts flagNumber 1
optLinearizeTreeVal :: Options -> GFGrammar -> Tree -> String
diff --git a/src/GF/Data/Utilities.hs b/src/GF/Data/Utilities.hs
index a5ceb08d2..aaadad1fe 100644
--- a/src/GF/Data/Utilities.hs
+++ b/src/GF/Data/Utilities.hs
@@ -81,8 +81,8 @@ unionAll = nub . concat
-- | Like 'lookup', but fails if the argument is not found,
-- instead of returning Nothing.
-lookup' :: Eq a => a -> [(a,b)] -> b
-lookup' x = fromJust . lookup x
+lookup' :: (Show a, Eq a) => a -> [(a,b)] -> b
+lookup' x = fromMaybe (error $ "Not found: " ++ show x) . lookup x
-- | Like 'find', but fails if nothing is found.
find' :: (a -> Bool) -> [a] -> a
diff --git a/src/GF/Speech/CFGToFiniteState.hs b/src/GF/Speech/CFGToFiniteState.hs
index 2fe3dabb1..7876f637d 100644
--- a/src/GF/Speech/CFGToFiniteState.hs
+++ b/src/GF/Speech/CFGToFiniteState.hs
@@ -229,7 +229,7 @@ compileAutomata g = [(c, makeOneFA c) | c <- allCats g]
-- | The make_fa algorithm from \"Regular approximation of CFLs: a grammatical view\",
-- Mark-Jan Nederhof. International Workshop on Parsing Technologies, 1997,
-- adapted to build a finite automaton for a single (mutually recursive) set only.
--- Categories not in the set (fromJustMap.lookup c mrs)will result in category-labelled edges.
+-- Categories not in the set will result in category-labelled edges.
make_fa1 :: MutRecSet -- ^ The set of (mutually recursive) categories for which
-- we are building the automaton.
-> State -- ^ State to come from
diff --git a/src/GF/Speech/TransformCFG.hs b/src/GF/Speech/TransformCFG.hs
index f2a3a2fba..08aae8897 100644
--- a/src/GF/Speech/TransformCFG.hs
+++ b/src/GF/Speech/TransformCFG.hs
@@ -36,7 +36,7 @@ import GF.Speech.FiniteState
import Control.Monad
import Data.FiniteMap
import Data.List
-import Data.Maybe (fromJust, fromMaybe)
+import Data.Maybe (fromMaybe)
import Data.Set (Set)
import qualified Data.Set as Set