1
0
forked from GitHub/gf-rgl

a script for counting lines of code in RGL implementations

This commit is contained in:
Aarne Ranta
2019-02-26 20:12:07 +01:00
parent e7634e9b6c
commit d5ef15c556
2 changed files with 107 additions and 8 deletions

98
doc/CountLines.hs Normal file
View File

@@ -0,0 +1,98 @@
import System.Directory
import Data.Char
import Data.List
-- counting modules and lines in RGL implementations
-- leaving out Lexicon, Structural, dictionaries, Extra, Extend,... (see below the list of prefixes)
main = do
mapM_ getCounts allLanguages
getCounts (lan,language) = do
cs <- mapM (getCount language lan) prefixes
let (ms,ls) = unzip cs
putStrLn $ unwords [language, show (sum ms), show (sum ls)]
getCount language lan pref = do
let file = concat ["../src/",language,"/",pref,lan,".gf"]
--- putStrLn file
ms <- readFileIf file
case ms of
Nothing -> return (0,0)
Just s -> return (1,length (codeLines (lines s)))
codeLines ls = filter (\l -> not (all isSpace l || isPrefixOf "--" l)) ls
readFileIf name = do
b <- doesFileExist name
case b of
True -> readFile name >>= return . Just
False -> return Nothing
prefixes = [
"Adjective"
,"Adverb"
,"Cat"
,"Common"
,"Conjunction"
,"Diff"
,"Grammar"
,"Lang"
-- ,"Lexicon"
,"Noun"
,"Numeral"
,"Phrase"
,"Question"
,"Relative"
,"Sentence"
-- ,"Structural"
,"Tense"
,"Text"
,"Verb"
,"Res"
,"Morpho"
,"Phono"
,"Paradigms"
]
allLanguages = [
("Afr","afrikaans")
,("Ara","arabic")
--- ,("Bul","bulgarian") ---- todo convert to utf8
,("Cat","catalan")
,("Chi","chinese")
,("Dan","danish")
,("Dut","dutch")
,("Eng","english")
,("Est","estonian")
,("Eus","basque")
,("Fin","finnish")
,("Fre","french")
,("Ger","german")
,("Gre","greek")
,("Hin","hindi")
,("Ice","icelandic")
,("Ita","italian")
,("Jpn","japanese")
,("Lav","latvian")
,("Mlt","maltese")
,("Mon","mongolian")
,("Nep","nepali")
,("Nno","nynorsk")
,("Nor","norwegian")
,("Pes","persian")
,("Pnb","punjabi")
,("Pol","polish")
,("Por","portuguese")
---- ,("Ron","romanian")
,("Rus","russian")
,("Snd","sindhi")
,("Spa","spanish")
,("Swe","swedish")
,("Tha","thai")
,("Urd","urdu")
,("Romance","romance")
,("Scand","scandinavian")
,("Hindustani","hindustani")
]

View File

@@ -15,17 +15,18 @@ that are currently available via http://grammaticalframework.org
are marked in the table are marked in the table
|| ISO | Language | Darcs | Mini | Parad | Lex | Lang | API | Symb | Irreg | Dict | Trans | tested | publ | authors || || ISO | Language | Git | Mini | Parad | Lex | Lang | API | Symb | Irreg | Dict | Trans | tested | publ | authors ||
| Afr | Afrikaans | + | - | ++ | + | + | + | - | - | - | - | - | - | *LP,LM | Afr | Afrikaans | + | - | ++ | + | + | + | - | - | - | - | - | - | *LP,LM
| Amh | Amharic | + | + | ++ | + | + | - | - | - | - | - | - | + | *MK | Amh | Amharic | + | + | ++ | + | + | - | - | - | - | - | - | + | *MK
| Ara | Arabic | + | + | + | + | - | - | - | - | - | - | - | + | AD | Ara | Arabic | + | + | + | + | + | + | + | - | - | - | + | + | AD,*IL
| Bul | Bulgarian | + | + | + | + | + | + | + | + | + | + | ++ | + | *KA | Bul | Bulgarian | + | + | + | + | + | + | + | + | + | + | ++ | + | *KA
| Cat | Catalan | + | + | ++ | + | + | + | + | + | - | + | ++ | - | *JS,*IL | Cat | Catalan | + | + | ++ | + | + | + | + | + | - | + | ++ | - | *JS,*IL
| Chi | Chinese | + | - | ++ | + | + | + | - | - | + | + | - | + | ZL,*AR,*CP,QH | Chi | Chinese | + | - | ++ | + | + | + | - | - | + | + | - | + | ZL,*AR,*CP,QH
| Dan | Danish | + | + | ++ | + | + | + | + | + | - | - | + | - | *AR | Dan | Danish | + | + | ++ | + | + | + | + | + | - | - | + | - | *AR
| Dut | Dutch | + | + | ++ | + | + | + | + | + | - | + | + | - | *AR,FJ | Dut | Dutch | + | + | ++ | + | + | + | + | + | - | + | + | - | *AR,FJ
| Eng | English | + | + | ++ | + | + | + | + | + | + | + | ++ | + | *AR,BB,KA | Eng | English | + | + | ++ | + | + | + | + | + | + | + | ++ | + | *AR,BB,KA
| Est | Estonian | + | - | ++ | + | + | + | - | - | - | - | + | + | *KK,*IL | Est | Estonian | + | - | ++ | + | + | + | - | - | + | + | + | + | *KK,*IL
| Eus | Basquw | + | - | ++ | + | + | + | - | - | - | - | - | + | *IL
| Fin | Finnish | + | + | ++ | + | + | + | + | - | + | + | ++ | + | *AR,*IL | Fin | Finnish | + | + | ++ | + | + | + | + | - | + | + | ++ | + | *AR,*IL
| Fre | French | + | + | ++ | + | + | + | + | + | + | + | ++ | - | *AR,RE | Fre | French | + | + | ++ | + | + | + | + | + | + | + | ++ | - | *AR,RE
| Ger | German | + | + | ++ | + | + | + | + | + | + | + | ++ | - | *AR,HH,EG | Ger | German | + | + | ++ | + | + | + | + | + | + | + | ++ | - | *AR,HH,EG
@@ -44,9 +45,10 @@ are marked in the table
| Nep | Nepali | + | + | ++ | + | + | - | - | - | - | - | - | + | *DS | Nep | Nepali | + | + | ++ | + | + | - | - | - | - | - | - | + | *DS
| Nno | Norwegian(n) | + | + | ++ | + | + | + | + | + | - | - | - | - | *SRE | Nno | Norwegian(n) | + | + | ++ | + | + | + | + | + | - | - | - | - | *SRE
| Nor | Norwegian(b) | + | + | ++ | + | + | + | + | + | - | - | + | - | *AR | Nor | Norwegian(b) | + | + | ++ | + | + | + | + | + | - | - | + | - | *AR
| Pes | Persian | + | - | + | + | + | + | - | - | - | - | + | + | *SV,*EA,SM | Pes | Persian | + | - | + | + | + | + | - | - | - | - | + | + | SV,EA,SM,*IL
| Pnb | Punjabi | + | + | + | + | + | + | + | - | - | - | - | + | *SV,MH | Pnb | Punjabi | + | + | + | + | + | + | + | - | - | - | - | + | *SV,MH
| Pol | Polish | + | + | + | + | + | + | + | - | - | - | + | + | IN,*AS | Pol | Polish | + | + | + | + | + | + | + | - | - | - | + | + | IN,*AS
| Por | Portuguese | + | + | ++ | + | + | + | + | + | - | + | + | - | *BC
| Ron | Romanian | + | + | ++ | + | + | + | + | - | - | - | + | + | *RE | Ron | Romanian | + | + | ++ | + | + | + | + | - | - | - | + | + | *RE
| Rus | Russian | + | + | ++ | + | + | + | - | - | + | + | - | + | JK,*NF | Rus | Russian | + | + | ++ | + | + | + | - | - | + | + | - | + | JK,*NF
| Snd | Sindhi | + | + | ++ | + | + | + | + | - | - | - | - | + | *SV,*JD | Snd | Sindhi | + | + | ++ | + | + | + | + | - | - | - | - | + | *SV,*JD
@@ -61,9 +63,7 @@ are marked in the table
ISO = 3-letter ISO language code, used in library file names ISO = 3-letter ISO language code, used in library file names
(mostly ISO 639-2 B (bibliographic)) (mostly ISO 639-2 B (bibliographic))
Darcs = available in the darcs repository of --http://code.haskell.org/gf-- http://www.grammaticalframework.org/ Git = available in the gf-rgl Git repository
Mini = minimal resource, compiles with ``make minimal`` (obsolete)
Parad = ``Paradigms`` file complete for major POS, ++ means with smart paradigms Parad = ``Paradigms`` file complete for major POS, ++ means with smart paradigms
@@ -73,7 +73,7 @@ Lang = the resource ``Syntax`` (nearly) complete
API = the ``Syntax`` compiles API = the ``Syntax`` compiles
API = the ``Symbolic`` API compiles Symb = the ``Symbolic`` API compiles
Irreg = the ``Irreg`` module with irregular verbs exists Irreg = the ``Irreg`` module with irregular verbs exists
@@ -95,6 +95,7 @@ AB Ansu Berg,
AD Ali El Dada, AD Ali El Dada,
AR Aarne Ranta, AR Aarne Ranta,
AS Adam Slaski, AS Adam Slaski,
BC Bruno Cuconato,
BB Björn Bringert, BB Björn Bringert,
BT Bjarki Traustason, BT Bjarki Traustason,
CK Chotiros Kairoje, CK Chotiros Kairoje,