mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-22 19:22:50 -06:00
Add LPGF function for catching errors. Manual fixes to Phrasebook treebank.
This commit is contained in:
@@ -68,13 +68,14 @@ doGrammar' path gname cncs = do
|
||||
results <- forM gs $ \grp -> do
|
||||
let ast = drop 2 $ dropWhile (/=':') $ head grp
|
||||
printf "- %s: %s\n" gname ast
|
||||
let
|
||||
Just tree = readExpr ast
|
||||
-- Linearization into all languages
|
||||
outs =
|
||||
[ printf "%s: %s" (showLanguage lang) (linearizeConcrete concr tree)
|
||||
| (lang,concr) <- Map.toList (concretes lpgf)
|
||||
]
|
||||
let Just tree = readExpr ast
|
||||
|
||||
-- Linearization into all languages
|
||||
outs <- forM (Map.toList (concretes lpgf)) $ \(lang,concr) -> do
|
||||
e <- try $ linearizeConcrete concr tree
|
||||
return $ case e of
|
||||
Right s -> printf "%s: %s" (showLanguage lang) s
|
||||
Left e -> printf "%s: ERROR: %s" (showLanguage lang) e
|
||||
|
||||
-- filter out missing langs from treebank
|
||||
let golds = [ g | o <- outs, g <- tail grp, takeWhile (/=':') o == takeWhile (/=':') g ]
|
||||
|
||||
Reference in New Issue
Block a user