From 8db4f97bcebf4551f4f05eab4ac90d5d0bd13d59 Mon Sep 17 00:00:00 2001 From: aarne Date: Wed, 26 Feb 2014 18:24:48 +0000 Subject: [PATCH] simple-minded transformer of constructor counts, to adapt a treebank quickly --- .../experimental/transfer/CountTransfer.hs | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 lib/src/experimental/transfer/CountTransfer.hs diff --git a/lib/src/experimental/transfer/CountTransfer.hs b/lib/src/experimental/transfer/CountTransfer.hs new file mode 100644 index 000000000..f26ffb28c --- /dev/null +++ b/lib/src/experimental/transfer/CountTransfer.hs @@ -0,0 +1,63 @@ +module Main where + +main = interact (unlines . map changeCounts . lines) + +changeCounts = unlexer . concatMap counts . lexer + +lexer s = case lex s of + (t,s2@(_:_)):_ -> t:lexer s2 + _ -> [] + +unlexer = unwords + +counts t = case t of + "UttImpPl" -> ["PrImpPl"] + "UttImpPol" -> ["PrImpPol"] + "UttImpSg" -> ["PrImpSg"] + "ImpVP" -> [] + "UttQS" -> ["UttPrS","UseQCl_none"] + "UttS" -> ["UttPrS"] + "UttVP" -> ["UttPrVPI","InfVP_none"] + "UseRCl" -> [] + "TTAnt" -> [] + "RelVP" -> ["RelVP_none"] + "RelSlash" -> ["RelSlash_none"] + "ConjS" -> ["UseClC_none"] + "PredVPS" -> ["UseCl_none","PredVP_none","UseVPC_none"] + "BaseVPS" -> ["StartVPC_none"] + "ConsVPS" -> ["ContVPC_none"] + "BaseS" -> ["StartClC_none"] + "ConsS" -> ["ContClC_none"] + "PredVP" -> ["PredVP_none"] + "AdvVP" -> ["AdvCl_none","LiftAdv"] ---- some for Cl, some for QCl + "AdVVP" -> ["AdvQCl_none","LiftAdV"] ---- + "QuestVP" -> ["QuestVP_none"] + "QuestSlash" -> ["QuestSlash_none"] + "QuestCl" -> ["QuestCl_none"] + "QuestIAdv" -> ["QuestIAdv_none"] + "QuestIComp" -> ["QuestIComp_none"] + "UseV" -> ["UseV_none"] + "ComplVS" -> ["ComplVS_none","UseV_s","LiftVS"] + "ComplVQ" -> ["ComplVQ_none","UseV_q","LiftVQ"] + "ComplVA" -> ["ComplVA_none","UseV_a","LiftVA"] + "ComplVV" -> ["ComplVV_none","UseV_v","LiftVV","InfVP_none"] + "ComplSlash" -> ["ComplV2_none"] + "UseComp" -> [] + "CompAP" -> ["UseAP_none","LiftAP"] + "CompAdv" -> ["UseAdv_none","LiftAdv"] + "CompCN" -> ["UseCN_none","LiftCN"] + "CompNP" -> ["UseNP_none"] + "CompVP" -> ["UseAP_none","InfAP_none"] + "CompQS" -> ["UseQ_none"] + "CompS" -> ["UseS_none"] + "SlashV2a" -> ["UseV_np","LiftV2"] + "SlashV2S" -> ["SlashV2S_none","UseV_np_s","LiftV2S"] + "SlashV2Q" -> ["SlashV2Q_none","UseV_np_q","LiftV2Q"] + "SlashV2A" -> ["SlashV2A_none","UseV_np_a","LiftV2A"] + "SlashV2V" -> ["SlashV2V_none","UseV_np_v","LiftV2V","InfVP_none"] + "SlashVV" -> ["ComplVV_np","UseV_v","LiftVV","InfVP_none"] + "SlashVP" -> ["PredVP_np"] + "UseCl" -> [] + "UseQCl" -> [] + + t -> [t]