From 3184a038f6d4bd0dc06859966efbb85b24cc64d4 Mon Sep 17 00:00:00 2001 From: aarne Date: Tue, 6 May 2014 07:33:18 +0000 Subject: [PATCH] script to count statistics of implemented and checked words in Dictionary; relies on annotations as comments --- lib/src/translator/CheckDict.hs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/src/translator/CheckDict.hs b/lib/src/translator/CheckDict.hs index 54ee27463..523c89adc 100644 --- a/lib/src/translator/CheckDict.hs +++ b/lib/src/translator/CheckDict.hs @@ -93,3 +93,19 @@ subCats f = case splitFun f of splitFun f = case span (/='_') (reverse f) of (tac,nuf) -> (reverse nuf, reverse tac) + +------ word statistics + +isUnchecked line = isInfixOf "--" line -- checked = no comments +isUnknown line = isInfixOf "variants" line -- known = not variants {} + +statLang lang = do + dict <- readFile (gfFile "Dictionary" lang) >>= return . lines + let lins = filter ((==["lin"]) . take 1 . words) dict + let nall = length $ filter (not . isUnknown) lins + let nchecked = length $ filter (not . (\x -> isUnknown x || isUnchecked x)) lins + putStrLn $ lang ++ "\t" ++ show nall ++ "\t" ++ show nchecked + +statAll = mapM_ statLang langs + +