1
0
forked from GitHub/gf-core

some new opers in ParadigmsFin, and 200 more words in DictEngFin: out of 3220 Penn trees now 2721 are completely translated (but mostly not so well...)

This commit is contained in:
aarne
2013-03-29 10:13:04 +00:00
parent 27a1811446
commit eb791244bd
5 changed files with 334 additions and 12 deletions

View File

@@ -0,0 +1,29 @@
-- convert annotated word list to GF lexicon
import Data.Char
main =
interact (unlines . map (unwords . mkEntry . words) . lines)
-- [bare_A] paljas
mkEntry (fun_:trans) = [fun, "=", oper, args, ";"] where
fun = tail (init fun_) -- unbracket
(name,cat) = let (tac,eman) = span (/= '_') (reverse fun) in (reverse (tail eman),reverse tac)
oper = "mk" ++ cat
args = case cat of
'V':_ -> unwords (map quoteIf trans)
"Prep" -> unwords (map quoteIf trans)
_ | null trans -> quote (mkUpper name)
_ -> quote (unwords trans)
quote s = "\"" ++ s ++ "\""
-- [absent_Prep] poissa +elative
quoteIf s = case s of
'+':cs -> cs
_ -> quote s
mkUpper w = case w of
c:cs -> toUpper c : cs
_ -> w