summaryrefslogtreecommitdiff
path: root/src/GF/UseGrammar
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2006-03-04 22:14:33 +0000
committeraarne <aarne@cs.chalmers.se>2006-03-04 22:14:33 +0000
commit2657c51e040964d9704f5c69945685ebd546eb6a (patch)
treebab26adf8f85c253c50b90ac9cde36d58efa42bd /src/GF/UseGrammar
parent84e01c303dc161c3a811a045cc0c45f3f13e33d6 (diff)
example based also with treebank, with real term parser
Diffstat (limited to 'src/GF/UseGrammar')
-rw-r--r--src/GF/UseGrammar/Treebank.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/GF/UseGrammar/Treebank.hs b/src/GF/UseGrammar/Treebank.hs
index f1dd5b75b..54ac8fb04 100644
--- a/src/GF/UseGrammar/Treebank.hs
+++ b/src/GF/UseGrammar/Treebank.hs
@@ -25,6 +25,7 @@ module GF.UseGrammar.Treebank (
readMultiTreebank,
lookupTreebank,
assocsTreebank,
+ isWordInTreebank,
printAssoc
) where
@@ -45,6 +46,7 @@ import GF.Infra.Ident (Ident)
import GF.Infra.UseIO
import qualified GF.Grammar.Abstract as A
import qualified Data.Map as M
+import qualified Data.Set as S
-- Generate a treebank with a multilingual grammar. AR 8/2/2006
-- (c) Aarne Ranta 2006 under GNU GPL
@@ -142,6 +144,9 @@ ret = [] -- return ()
assocsTreebank :: UniTreebank -> [(String,[String])]
assocsTreebank = M.assocs
+isWordInTreebank :: UniTreebank -> String -> Bool
+isWordInTreebank tb w = S.member w (S.fromList (concatMap words (M.keys tb)))
+
printAssoc (s, ts) = s ++ concat ["\t" ++ t | t <- ts]
getTreebanks :: [String] -> [(String,String,String)]