tuning resource API

This commit is contained in:
aarne
2005-02-06 09:52:19 +00:00
parent bd432cf147
commit c30eebbba6
35 changed files with 2065 additions and 1432 deletions

View File

@@ -35,3 +35,38 @@ mkLin s =
'V':_ -> "mk" ++ cat ++ " (regV" ++ " \"" ++ w ++ "\")"
_ -> "reg" ++ cat ++ " \"" ++ w ++ "\""
-- normalize identifiers in Structural
mkIdent s = case words s of
w:ws -> if obsolete w then ""
else " " ++ (unwords $ mkId (update w) : ws)
_ -> s
where
mkId name@(c:cs) =
let
(x,y) = span isCat cs
in
toLower c : clean x ++ "_" ++ new y
isCat = flip notElem "PDNVCAIS"
clean x = case span isLower x of
(_,[]) -> x
(u,v) -> u ++ "8" ++ map toLower v
new y = case y of
"NumDet" -> "NDet"
_ -> y
obsolete w = elem w $ words "TheseNumNP ThoseNumNP NobodyNP NeitherNor NoDet AnyDet"
update w = case w of
"EitherOr" -> "EitherOrConjD"
"BothAnd" -> "BothAndConjD"
"PhrYes" -> "YesPhr"
"PhrNo" -> "NoPhr"
"WeNumNP" -> "WeNP"
"YeNumNP" -> "YeNP"
"HowManyDet" -> "HowManyIDet"
"MostsDet" -> "MostManyDet"
"WhichDet" -> "WhichOneIDet"
"WhichNDet" -> "WhichManyIDet"
"EverywhereNP" -> "EverywhereAdv"
"SomewhereNP" -> "SomewhereAdv"
"AgentPrep" -> "By8agentPrep"
_ -> w