mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-11 12:12:51 -06:00
example based also with treebank, with real term parser
This commit is contained in:
@@ -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)]
|
||||
|
||||
Reference in New Issue
Block a user