mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-26 13:02:50 -06:00
preparing resource api for multilingual documentation
This commit is contained in:
71
lib/doc/MkExx.hs
Normal file
71
lib/doc/MkExx.hs
Normal file
@@ -0,0 +1,71 @@
|
||||
-- make a script for computing examples
|
||||
-- usage: runghc MkExx.hs <koe.txt >koe.gfs
|
||||
-- then: gf -retain -s ../alltenses/TryRon.gfo <koe.gfs
|
||||
|
||||
|
||||
main = interact (unlines . concatMap mkScript . lines)
|
||||
|
||||
mkScript l = case l of
|
||||
' ':_ ->
|
||||
let ident = mkIdent $ unwords $ takeWhile (/="--") $ words l
|
||||
in [add $ psq ident]
|
||||
'-':_ -> []
|
||||
_ -> [
|
||||
add $ psq l,
|
||||
add $ "cc -one " ++ l
|
||||
]
|
||||
|
||||
add = ('\n':)
|
||||
|
||||
psq s = "ps \"" ++ s ++ "\""
|
||||
|
||||
-- makes mkUtt : QS -> Utt to mkUtt-QS-Utt
|
||||
mkIdent :: String -> String
|
||||
mkIdent = concatMap unspec where
|
||||
unspec c = case c of
|
||||
' ' -> ""
|
||||
'>' -> ""
|
||||
'(' -> ""
|
||||
')' -> ""
|
||||
':' -> "-"
|
||||
_ -> [c]
|
||||
|
||||
|
||||
|
||||
langsCoding = [
|
||||
(("amharic", "Amh"),""),
|
||||
(("arabic", "Ara"),""),
|
||||
(("bulgarian","Bul"),""),
|
||||
(("catalan", "Cat"),"Romance"),
|
||||
(("danish", "Dan"),"Scand"),
|
||||
(("dutch", "Dut"),""),
|
||||
(("english", "Eng"),""),
|
||||
(("finnish", "Fin"),""),
|
||||
(("french", "Fre"),"Romance"),
|
||||
(("hindi", "Hin"),"Hindustani"),
|
||||
(("german", "Ger"),""),
|
||||
(("interlingua","Ina"),""),
|
||||
(("italian", "Ita"),"Romance"),
|
||||
(("latin", "Lat"),""),
|
||||
(("norwegian","Nor"),"Scand"),
|
||||
(("polish", "Pol"),""),
|
||||
(("punjabi", "Pnb"),""),
|
||||
(("romanian", "Ron"),""),
|
||||
(("russian", "Rus"),""),
|
||||
(("spanish", "Spa"),"Romance"),
|
||||
(("swedish", "Swe"),"Scand"),
|
||||
(("thai", "Tha"),""),
|
||||
(("turkish", "Tur"),""),
|
||||
(("urdu", "Urd"),"Hindustani")
|
||||
]
|
||||
|
||||
|
||||
langs = map fst langsCoding
|
||||
|
||||
-- languagues for which Try is normally compiled
|
||||
langsLang = langs `except` langsIncomplete
|
||||
|
||||
-- languages for which Lang can be compiled but which are incomplete
|
||||
langsIncomplete = ["Amh","Ara","Hin","Lat","Pnb","Rus","Tha","Tur","Urd"]
|
||||
|
||||
except ls es = filter (flip notElem es . snd) ls
|
||||
Reference in New Issue
Block a user