mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-27 03:38:55 -06:00
Latvian: 1) added some extra things that are used by the Attempto grammar; 2) added notpresent tags; 3) compiles with Setup.hs and lib/src/Make.hs
This commit is contained in:
29
Setup.hs
29
Setup.hs
@@ -73,7 +73,7 @@ rglCommands =
|
|||||||
do let dir = getRGLBuildDir lbi mode
|
do let dir = getRGLBuildDir lbi mode
|
||||||
createDirectoryIfMissing True dir
|
createDirectoryIfMissing True dir
|
||||||
sequence_ [run_gfc pkg lbi ["-s","-make","-name=Lang"++la,
|
sequence_ [run_gfc pkg lbi ["-s","-make","-name=Lang"++la,
|
||||||
dir ++ "/Lang" ++ la ++ ".gfo"]
|
dir ++ "/Lang" ++ la ++ ".gfo"]
|
||||||
| (_,la) <- optl langsPGF args]
|
| (_,la) <- optl langsPGF args]
|
||||||
run_gfc pkg lbi (["-s","-make","-name=Lang"]++
|
run_gfc pkg lbi (["-s","-make","-name=Lang"]++
|
||||||
["Lang" ++ la ++ ".pgf"|(_,la)<-optl langsPGF args])
|
["Lang" ++ la ++ ".pgf"|(_,la)<-optl langsPGF args])
|
||||||
@@ -190,7 +190,7 @@ rgl_dst_dir lbi = buildDir lbi </> "rgl"
|
|||||||
-- the languages have long directory names and short ISO codes (3 letters)
|
-- the languages have long directory names and short ISO codes (3 letters)
|
||||||
-- we also give the decodings for postprocessing linearizations, as long as grammars
|
-- we also give the decodings for postprocessing linearizations, as long as grammars
|
||||||
-- don't support all flags needed; they are used in tests
|
-- don't support all flags needed; they are used in tests
|
||||||
|
|
||||||
langsCoding = [
|
langsCoding = [
|
||||||
(("amharic", "Amh"),""),
|
(("amharic", "Amh"),""),
|
||||||
(("arabic", "Ara"),""),
|
(("arabic", "Ara"),""),
|
||||||
@@ -206,13 +206,14 @@ langsCoding = [
|
|||||||
(("interlingua","Ina"),""),
|
(("interlingua","Ina"),""),
|
||||||
(("italian", "Ita"),""),
|
(("italian", "Ita"),""),
|
||||||
(("latin", "Lat"),""),
|
(("latin", "Lat"),""),
|
||||||
|
(("latvian", "Lav"),""),
|
||||||
(("norwegian","Nor"),""),
|
(("norwegian","Nor"),""),
|
||||||
(("polish", "Pol"),""),
|
(("polish", "Pol"),""),
|
||||||
(("punjabi", "Pnb"),""),
|
(("punjabi", "Pnb"),""),
|
||||||
(("romanian", "Ron"),""),
|
(("romanian", "Ron"),""),
|
||||||
(("russian", "Rus"),""),
|
(("russian", "Rus"),""),
|
||||||
(("spanish", "Spa"),""),
|
(("spanish", "Spa"),""),
|
||||||
(("swedish", "Swe"),""),
|
(("swedish", "Swe"),""),
|
||||||
(("thai", "Tha"),"to_thai"),
|
(("thai", "Tha"),"to_thai"),
|
||||||
(("turkish", "Tur"),""),
|
(("turkish", "Tur"),""),
|
||||||
(("urdu", "Urd"),"")
|
(("urdu", "Urd"),"")
|
||||||
@@ -227,14 +228,14 @@ langs = map fst langsCoding
|
|||||||
langsLang = langs `except` ["Amh","Ara","Lat","Hin","Tha","Tur"]
|
langsLang = langs `except` ["Amh","Ara","Lat","Hin","Tha","Tur"]
|
||||||
--langsLang = langs `only` ["Fin"] --test
|
--langsLang = langs `only` ["Fin"] --test
|
||||||
|
|
||||||
-- languages for which to compile Try
|
-- languages for which to compile Try
|
||||||
langsAPI = langsLang `except` ["Hin","Ina","Tha"]
|
langsAPI = langsLang `except` ["Hin","Ina","Tha"]
|
||||||
|
|
||||||
-- languages for which to compile Symbolic
|
-- languages for which to compile Symbolic
|
||||||
langsSymbolic = langsAPI -- `except` ["Rus"]
|
langsSymbolic = langsAPI -- `except` ["Rus"]
|
||||||
|
|
||||||
-- languages for which to run demo test
|
-- languages for which to run demo test
|
||||||
langsDemo = langsLang `except` ["Ara","Hin","Ina","Tha"]
|
langsDemo = langsLang `except` ["Ara","Hin","Ina","Lav","Tha"]
|
||||||
|
|
||||||
-- languages for which to compile parsing grammars
|
-- languages for which to compile parsing grammars
|
||||||
langsParse = langs `only` ["Eng"]
|
langsParse = langs `only` ["Eng"]
|
||||||
@@ -243,7 +244,7 @@ langsParse = langs `only` ["Eng"]
|
|||||||
langsPGF = langsLang `except` ["Ara","Hin","Ron","Tha"]
|
langsPGF = langsLang `except` ["Ara","Hin","Ron","Tha"]
|
||||||
|
|
||||||
-- languages for which Compatibility exists (to be extended)
|
-- languages for which Compatibility exists (to be extended)
|
||||||
langsCompat = langsLang `only` ["Cat","Eng","Fin","Fre","Ita","Spa","Swe"]
|
langsCompat = langsLang `only` ["Cat","Eng","Fin","Fre","Ita","Lav","Spa","Swe"]
|
||||||
|
|
||||||
gfc modes pkg lbi file = sequence_ [gfc1 mode pkg lbi file | mode<-modes]
|
gfc modes pkg lbi file = sequence_ [gfc1 mode pkg lbi file | mode<-modes]
|
||||||
gfc1 mode pkg lbi file = do
|
gfc1 mode pkg lbi file = do
|
||||||
@@ -264,7 +265,7 @@ gf comm files pkg lbi = do
|
|||||||
out <- readProcess gf ("-s":files) comm
|
out <- readProcess gf ("-s":files) comm
|
||||||
putStrLn out
|
putStrLn out
|
||||||
|
|
||||||
demos abstr ls = "gr -number=100 | l -treebank " ++ unlexer abstr ls ++
|
demos abstr ls = "gr -number=100 | l -treebank " ++ unlexer abstr ls ++
|
||||||
" | ps -to_html | wf -file=resdemo.html"
|
" | ps -to_html | wf -file=resdemo.html"
|
||||||
|
|
||||||
lang (lla,la) = rgl_src_dir </> lla </> ("All" ++ la ++ ".gf")
|
lang (lla,la) = rgl_src_dir </> lla </> ("All" ++ la ++ ".gf")
|
||||||
@@ -285,7 +286,7 @@ getOptMode args =
|
|||||||
then default_modes
|
then default_modes
|
||||||
else explicit_modes
|
else explicit_modes
|
||||||
where
|
where
|
||||||
explicit_modes =
|
explicit_modes =
|
||||||
[Minimal|have "minimal"]++
|
[Minimal|have "minimal"]++
|
||||||
[Present|have "present"]++
|
[Present|have "present"]++
|
||||||
[AllTenses|have "alltenses"]
|
[AllTenses|have "alltenses"]
|
||||||
@@ -330,17 +331,17 @@ getRGLCommands args =
|
|||||||
langs_prefix = "langs="
|
langs_prefix = "langs="
|
||||||
rgl_prefix = "rgl-"
|
rgl_prefix = "rgl-"
|
||||||
|
|
||||||
unlexer abstr ls =
|
unlexer abstr ls =
|
||||||
"-unlexer=\\\"" ++ unwords
|
"-unlexer=\\\"" ++ unwords
|
||||||
[abstr ++ la ++ "=" ++ unl |
|
[abstr ++ la ++ "=" ++ unl |
|
||||||
lla@(_,la) <- ls, let unl = unlex lla, not (null unl)] ++
|
lla@(_,la) <- ls, let unl = unlex lla, not (null unl)] ++
|
||||||
"\\\""
|
"\\\""
|
||||||
where
|
where
|
||||||
unlex lla = maybe "" id $ lookup lla langsCoding
|
unlex lla = maybe "" id $ lookup lla langsCoding
|
||||||
|
|
||||||
-- | Runs the gf executable in compile mode with the given arguments.
|
-- | Runs the gf executable in compile mode with the given arguments.
|
||||||
run_gfc :: PackageDescription -> LocalBuildInfo -> [String] -> IO ()
|
run_gfc :: PackageDescription -> LocalBuildInfo -> [String] -> IO ()
|
||||||
run_gfc pkg lbi args =
|
run_gfc pkg lbi args =
|
||||||
do let args' = ["-batch","-gf-lib-path="++rgl_src_dir,"+RTS","-K32M","-RTS"] ++ filter (not . null) args
|
do let args' = ["-batch","-gf-lib-path="++rgl_src_dir,"+RTS","-K32M","-RTS"] ++ filter (not . null) args
|
||||||
gf = default_gf pkg lbi
|
gf = default_gf pkg lbi
|
||||||
gf_cmdline = gf ++ " " ++ unwords (map showArg args')
|
gf_cmdline = gf ++ " " ++ unwords (map showArg args')
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ import System.Environment
|
|||||||
import System.Exit
|
import System.Exit
|
||||||
|
|
||||||
-- Make commands for compiling and testing resource grammars.
|
-- Make commands for compiling and testing resource grammars.
|
||||||
-- usage: runghc Make (((present|alltenses)? OPT?) | (clone FILE))? LANGS?
|
-- usage: runghc Make (((present|alltenses)? OPT?) | (clone FILE))? LANGS?
|
||||||
-- where
|
-- where
|
||||||
-- - OPT = (lang | api | pgf | test | parse | clean | clone)
|
-- - OPT = (lang | api | pgf | test | parse | clean | clone)
|
||||||
-- - LANGS has the form e.g. langs=Eng,Fin,Rus
|
-- - LANGS has the form e.g. langs=Eng,Fin,Rus
|
||||||
-- - clone with a flag file=FILENAME clones the file to the specified languages,
|
-- - clone with a flag file=FILENAME clones the file to the specified languages,
|
||||||
-- by replacing the 3-letter language name of the original in both
|
-- by replacing the 3-letter language name of the original in both
|
||||||
-- the filename and the body
|
-- the filename and the body
|
||||||
-- with each name in the list (default: all languages)
|
-- with each name in the list (default: all languages)
|
||||||
-- With no argument, lang and api are done, in this order.
|
-- With no argument, lang and api are done, in this order.
|
||||||
@@ -21,12 +21,12 @@ import System.Exit
|
|||||||
|
|
||||||
default_gf = "../../dist/build/gf/gf"
|
default_gf = "../../dist/build/gf/gf"
|
||||||
|
|
||||||
presApiPath = "-path=api:present"
|
presApiPath = "-path=api:present:../present"
|
||||||
presSymbolPath = "" -- "-path=.:abstract:present:common:romance:scandinavian" ----
|
presSymbolPath = "" -- "-path=.:abstract:present:common:romance:scandinavian" ----
|
||||||
|
|
||||||
-- the languages have long directory names and short ISO codes (3 letters)
|
-- the languages have long directory names and short ISO codes (3 letters)
|
||||||
-- we also give the functors implied
|
-- we also give the functors implied
|
||||||
|
|
||||||
langsCoding = [
|
langsCoding = [
|
||||||
(("afrikaans","Afr"),""),
|
(("afrikaans","Afr"),""),
|
||||||
(("amharic", "Amh"),""),
|
(("amharic", "Amh"),""),
|
||||||
@@ -52,7 +52,7 @@ langsCoding = [
|
|||||||
(("romanian", "Ron"),""),
|
(("romanian", "Ron"),""),
|
||||||
(("russian", "Rus"),""),
|
(("russian", "Rus"),""),
|
||||||
(("spanish", "Spa"),"Romance"),
|
(("spanish", "Spa"),"Romance"),
|
||||||
(("swedish", "Swe"),"Scand"),
|
(("swedish", "Swe"),"Scand"),
|
||||||
(("thai", "Tha"),""),
|
(("thai", "Tha"),""),
|
||||||
(("thai", "Thb"),""), -- Thai pronunciation
|
(("thai", "Thb"),""), -- Thai pronunciation
|
||||||
(("turkish", "Tur"),""),
|
(("turkish", "Tur"),""),
|
||||||
@@ -70,25 +70,25 @@ langsLangAll = langs
|
|||||||
langsLang = langs `except` langsIncomplete
|
langsLang = langs `except` langsIncomplete
|
||||||
|
|
||||||
-- languagues that have notpresent marked
|
-- languagues that have notpresent marked
|
||||||
langsPresent = langsLang `except` ["Lav","Nep","Pes","Tha"]
|
langsPresent = langsLang `except` ["Nep","Pes","Tha"]
|
||||||
|
|
||||||
-- languages for which Lang can be compiled but which are incomplete
|
-- languages for which Lang can be compiled but which are incomplete
|
||||||
langsIncomplete = ["Amh","Ara","Hin","Lat","Tur"]
|
langsIncomplete = ["Amh","Ara","Hin","Lat","Tur"]
|
||||||
|
|
||||||
-- languages for which to compile Try
|
-- languages for which to compile Try
|
||||||
langsAPI = langsLang `except` langsIncomplete
|
langsAPI = langsLang `except` langsIncomplete
|
||||||
|
|
||||||
-- languages for which to compile Symbolic
|
-- languages for which to compile Symbolic
|
||||||
langsSymbolic = langsLang `except` (langsIncomplete ++ ["Afr","Ina","Lav","Nep","Pes","Pnb","Rus"])
|
langsSymbolic = langsLang `except` (langsIncomplete ++ ["Afr","Ina","Nep","Pes","Pnb","Rus"])
|
||||||
|
|
||||||
-- languages for which to compile minimal Syntax
|
-- languages for which to compile minimal Syntax
|
||||||
langsMinimal = langs `only` ["Ara","Eng","Bul","Rus"]
|
langsMinimal = langs `only` ["Ara","Eng","Bul","Rus"]
|
||||||
|
|
||||||
-- languages for which to run treebank test
|
-- languages for which to run treebank test
|
||||||
langsTest = langsLang `except` ["Ara","Bul","Cat","Hin","Rus","Spa","Tha"]
|
langsTest = langsLang `except` ["Ara","Bul","Cat","Hin","Lav","Rus","Spa","Tha"]
|
||||||
|
|
||||||
-- languages for which to run demo test
|
-- languages for which to run demo test
|
||||||
langsDemo = langsLang `except` ["Ara","Hin","Ina","Lat","Tha"]
|
langsDemo = langsLang `except` ["Ara","Hin","Ina","Lat","Lav","Tha"]
|
||||||
|
|
||||||
-- languages for which to compile parsing grammars
|
-- languages for which to compile parsing grammars
|
||||||
langsParse = langs `only` ["Eng"]
|
langsParse = langs `only` ["Eng"]
|
||||||
@@ -97,7 +97,7 @@ langsParse = langs `only` ["Eng"]
|
|||||||
langsPGF = langsTest `only` ["Eng","Fre","Swe"]
|
langsPGF = langsTest `only` ["Eng","Fre","Swe"]
|
||||||
|
|
||||||
-- languages for which Compatibility exists (to be extended)
|
-- languages for which Compatibility exists (to be extended)
|
||||||
langsCompat = langsLang `only` ["Cat","Eng","Fin","Fre","Ita","Spa","Swe"]
|
langsCompat = langsLang `only` ["Cat","Eng","Fin","Fre","Ita","Lav","Spa","Swe"]
|
||||||
|
|
||||||
treebankExx = "exx-resource.gft"
|
treebankExx = "exx-resource.gft"
|
||||||
treebankResults = "exx-resource.gftb"
|
treebankResults = "exx-resource.gftb"
|
||||||
@@ -108,14 +108,14 @@ main = do
|
|||||||
|
|
||||||
make :: [String] -> IO ()
|
make :: [String] -> IO ()
|
||||||
make xx = do
|
make xx = do
|
||||||
let ifx opt act = if null xx || elem opt xx then act >> return () else return ()
|
let ifx opt act = if null xx || elem opt xx then act >> return () else return ()
|
||||||
let ifxx opt act = if elem opt xx then act >> return () else return ()
|
let ifxx opt act = if elem opt xx then act >> return () else return ()
|
||||||
let pres
|
let pres
|
||||||
| elem "present" xx = 1
|
| elem "present" xx = 1
|
||||||
| elem "alltenses" xx = 2
|
| elem "alltenses" xx = 2
|
||||||
| otherwise = 0
|
| otherwise = 0
|
||||||
let dir = case pres of
|
let dir = case pres of
|
||||||
1 -> "../present"
|
1 -> "../present"
|
||||||
2 -> "../alltenses"
|
2 -> "../alltenses"
|
||||||
_ -> "../full"
|
_ -> "../full"
|
||||||
|
|
||||||
@@ -150,7 +150,7 @@ make xx = do
|
|||||||
++ [dir ++ "/Lang" ++ la ++ ".gfo" | (_,la) <- optl langsPGF]
|
++ [dir ++ "/Lang" ++ la ++ ".gfo" | (_,la) <- optl langsPGF]
|
||||||
ifxx "test" $ do
|
ifxx "test" $ do
|
||||||
let ls = optl langsTest
|
let ls = optl langsTest
|
||||||
gf (treeb "Lang" ls) $ unwords [dir ++ "/Lang" ++ la ++ ".gfo" | (_,la) <- ls]
|
gf (treeb "Lang" ls) $ unwords [dir ++ "/Lang" ++ la ++ ".gfo" | (_,la) <- ls]
|
||||||
ifxx "parse" $ do
|
ifxx "parse" $ do
|
||||||
mapM_ (gfc pres [] . parse) (optl langsParse)
|
mapM_ (gfc pres [] . parse) (optl langsParse)
|
||||||
copy "parse/*.gfo parse/oald/*.gfo" dir
|
copy "parse/*.gfo parse/oald/*.gfo" dir
|
||||||
@@ -169,7 +169,7 @@ gfc pres ppath file = do
|
|||||||
let preproc = if (pres==1) then "-preproc=mkPresent" else ""
|
let preproc = if (pres==1) then "-preproc=mkPresent" else ""
|
||||||
let path = if (pres==1) then ppath else ""
|
let path = if (pres==1) then ppath else ""
|
||||||
putStrLn $ "Compiling " ++ file
|
putStrLn $ "Compiling " ++ file
|
||||||
if pres == 0
|
if pres == 0
|
||||||
then run_gfc ["-s","-src",preproc, path, file]
|
then run_gfc ["-s","-src",preproc, path, file]
|
||||||
else run_gfc ["-s","-src","-no-pmcfg",preproc, path, file]
|
else run_gfc ["-s","-src","-no-pmcfg",preproc, path, file]
|
||||||
|
|
||||||
@@ -185,10 +185,10 @@ gf comm file = do
|
|||||||
putStrLn cmd
|
putStrLn cmd
|
||||||
system cmd
|
system cmd
|
||||||
|
|
||||||
treeb abstr ls = "rf -lines -tree -file=" ++ treebankExx ++
|
treeb abstr ls = "rf -lines -tree -file=" ++ treebankExx ++
|
||||||
" | l -treebank " ++ unlexer abstr ls ++ " | wf -file=" ++ treebankResults
|
" | l -treebank " ++ unlexer abstr ls ++ " | wf -file=" ++ treebankResults
|
||||||
|
|
||||||
demos abstr ls = "gr -number=100 | l -treebank " ++ unlexer abstr ls ++
|
demos abstr ls = "gr -number=100 | l -treebank " ++ unlexer abstr ls ++
|
||||||
" | ps -to_html | wf -file=resdemo.html"
|
" | ps -to_html | wf -file=resdemo.html"
|
||||||
|
|
||||||
lang (lla,la) = lla ++ "/All" ++ la ++ ".gf"
|
lang (lla,la) = lla ++ "/All" ++ la ++ ".gf"
|
||||||
@@ -214,7 +214,7 @@ getOptLangs args = case [ls | a <- args, let (f,ls) = splitAt 6 a, f=="langs="]
|
|||||||
|
|
||||||
-- the file name has the form p....pLLL.gf, i.e. 3-letter lang name, suffix .gf
|
-- the file name has the form p....pLLL.gf, i.e. 3-letter lang name, suffix .gf
|
||||||
getLangName args = case [ls | a <- args, let (f,ls) = splitAt 5 a, f=="file="] of
|
getLangName args = case [ls | a <- args, let (f,ls) = splitAt 5 a, f=="file="] of
|
||||||
fi:_ -> let (nal,ferp) = splitAt 3 (drop 3 (reverse fi)) in return (reverse ferp,reverse nal)
|
fi:_ -> let (nal,ferp) = splitAt 3 (drop 3 (reverse fi)) in return (reverse ferp,reverse nal)
|
||||||
_ -> Nothing
|
_ -> Nothing
|
||||||
|
|
||||||
replaceLang s1 s2 = repl where
|
replaceLang s1 s2 = repl where
|
||||||
@@ -225,19 +225,19 @@ replaceLang s1 s2 = repl where
|
|||||||
_ -> s
|
_ -> s
|
||||||
lgs = 3 -- length s1
|
lgs = 3 -- length s1
|
||||||
|
|
||||||
unlexer abstr ls =
|
unlexer abstr ls =
|
||||||
"-unlexer=\\\"" ++ unwords
|
"-unlexer=\\\"" ++ unwords
|
||||||
[abstr ++ la ++ "=" ++ unl |
|
[abstr ++ la ++ "=" ++ unl |
|
||||||
lla@(_,la) <- ls, let unl = unlex lla, not (null unl)] ++
|
lla@(_,la) <- ls, let unl = unlex lla, not (null unl)] ++
|
||||||
"\\\""
|
"\\\""
|
||||||
where
|
where
|
||||||
unlex lla = maybe "" id $ lookup lla langsCoding
|
unlex lla = maybe "" id $ lookup lla langsCoding
|
||||||
|
|
||||||
-- | Runs the gf executable in compile mode with the given arguments.
|
-- | Runs the gf executable in compile mode with the given arguments.
|
||||||
run_gfc :: [String] -> IO ()
|
run_gfc :: [String] -> IO ()
|
||||||
run_gfc args =
|
run_gfc args =
|
||||||
do let args' = ["-batch"] ++ filter (not . null) args ++ ["+RTS"] ++ rts_flags ++ ["-RTS"]
|
do let args' = ["-batch"] ++ filter (not . null) args ++ ["+RTS"] ++ rts_flags ++ ["-RTS"]
|
||||||
--- do let args' = ["-batch","-gf-lib-path=."] ++ filter (not . null) args ++ ["+RTS"] ++ rts_flags ++ ["-RTS"] --- why path? AR
|
--- do let args' = ["-batch","-gf-lib-path=."] ++ filter (not . null) args ++ ["+RTS"] ++ rts_flags ++ ["-RTS"] --- why path? AR
|
||||||
putStrLn $ "Running: " ++ default_gf ++ " " ++ unwords (map showArg args')
|
putStrLn $ "Running: " ++ default_gf ++ " " ++ unwords (map showArg args')
|
||||||
e <- rawSystem default_gf args'
|
e <- rawSystem default_gf args'
|
||||||
case e of
|
case e of
|
||||||
@@ -247,24 +247,24 @@ run_gfc args =
|
|||||||
showArg arg = "'" ++ arg ++ "'"
|
showArg arg = "'" ++ arg ++ "'"
|
||||||
|
|
||||||
copy :: String -> String -> IO ()
|
copy :: String -> String -> IO ()
|
||||||
copy from to =
|
copy from to =
|
||||||
do system $ "cp " ++ from ++ " " ++ to
|
do system $ "cp " ++ from ++ " " ++ to
|
||||||
return ()
|
return ()
|
||||||
|
|
||||||
copyl :: [(String,String)] -> String -> String -> IO ()
|
copyl :: [(String,String)] -> String -> String -> IO ()
|
||||||
copyl lans from to = do
|
copyl lans from to = do
|
||||||
echosystem $ "cp abstract/" ++ from ++ " " ++ to
|
echosystem $ "cp abstract/" ++ from ++ " " ++ to
|
||||||
echosystem $ "cp common/" ++ from ++ " " ++ to
|
echosystem $ "cp common/" ++ from ++ " " ++ to
|
||||||
mapM_ (\lan -> echosystem $ "cp */*" ++ lan ++ from ++ " " ++ to)
|
mapM_ (\lan -> echosystem $ "cp */*" ++ lan ++ from ++ " " ++ to)
|
||||||
(map snd lans ++ concatMap implied lans)
|
(map snd lans ++ concatMap implied lans)
|
||||||
return ()
|
return ()
|
||||||
|
|
||||||
copyld :: [(String,String)] -> String -> String -> String -> IO ()
|
copyld :: [(String,String)] -> String -> String -> String -> IO ()
|
||||||
copyld lans dir from to = do
|
copyld lans dir from to = do
|
||||||
mapM_ (\lan -> echosystem $ "cp " ++ dir ++ lan ++ from ++ " " ++ to)
|
mapM_ (\lan -> echosystem $ "cp " ++ dir ++ lan ++ from ++ " " ++ to)
|
||||||
(map snd lans ++ if (take 3 dir == "api") then [] else concatMap implied lans)
|
(map snd lans ++ if (take 3 dir == "api") then [] else concatMap implied lans)
|
||||||
return ()
|
return ()
|
||||||
|
|
||||||
echosystem c = do
|
echosystem c = do
|
||||||
putStrLn c
|
putStrLn c
|
||||||
system c
|
system c
|
||||||
|
|||||||
5
lib/src/api/SymbolicLav.gf
Normal file
5
lib/src/api/SymbolicLav.gf
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
--# -path=.:present:mathematical:prelude:../latvian
|
||||||
|
|
||||||
|
resource SymbolicLav = Symbolic with
|
||||||
|
(Symbol = SymbolLav),
|
||||||
|
(Grammar = GrammarLav) ;
|
||||||
@@ -1,8 +1,11 @@
|
|||||||
--# -path=.:../abstract:../common:../prelude
|
--# -path=.:../abstract:../common:../prelude
|
||||||
|
|
||||||
concrete ExtraLav of ExtraLavAbs = CatLav ** {
|
concrete ExtraLav of ExtraLavAbs = CatLav ** open ResLav in {
|
||||||
|
|
||||||
flags
|
flags
|
||||||
coding = utf8 ;
|
coding = utf8 ;
|
||||||
|
|
||||||
|
lin
|
||||||
|
GenNP np = {s = \\_,_,_ => np.s ! Gen ; d = Def} ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
--# -path=.:../abstract:../common:../prelude
|
--# -path=.:../abstract:../common:../prelude
|
||||||
|
|
||||||
abstract ExtraLavAbs = {}
|
abstract ExtraLavAbs = Extra ** {}
|
||||||
|
|||||||
@@ -58,11 +58,9 @@ lin
|
|||||||
s =
|
s =
|
||||||
vp.v.s ! Pos ! (Indicative P1 Pl Pres) ++ -- Verb
|
vp.v.s ! Pos ! (Indicative P1 Pl Pres) ++ -- Verb
|
||||||
vp.s2 ! a -- Object(s), complements, adverbial modifiers
|
vp.s2 ! a -- Object(s), complements, adverbial modifiers
|
||||||
} | {
|
}
|
||||||
s =
|
| { s = vp.v.s ! Pos ! (Indicative P1 Pl Fut) ++ vp.s2 ! a } --# notpresent
|
||||||
vp.v.s ! Pos ! (Indicative P1 Pl Fut) ++
|
;
|
||||||
vp.s2 ! a
|
|
||||||
} ;
|
|
||||||
|
|
||||||
ImpP3 np vp = {
|
ImpP3 np vp = {
|
||||||
s = "lai" ++ np.s ! Nom ++ buildVerb vp.v (Ind Simul Pres) Pos np.a ++ vp.s2 ! np.a ;
|
s = "lai" ++ np.s ! Nom ++ buildVerb vp.v (Ind Simul Pres) Pos np.a ++ vp.s2 ! np.a ;
|
||||||
|
|||||||
15
lib/src/latvian/MakeStructuralLav.gf
Normal file
15
lib/src/latvian/MakeStructuralLav.gf
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
--# -path=.:../common:../abstract
|
||||||
|
|
||||||
|
resource MakeStructuralLav = open CatLav, ParadigmsLav, ResLav, Prelude in {
|
||||||
|
|
||||||
|
flags
|
||||||
|
coding = utf8 ;
|
||||||
|
|
||||||
|
oper
|
||||||
|
mkSubj : Str -> Subj = \x ->
|
||||||
|
lin Subj {s = x} ;
|
||||||
|
|
||||||
|
mkIDet : Str -> ParadigmsLav.Number -> IDet = \s,n ->
|
||||||
|
lin IDet {s = \\_ => s ; n = n} ;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -32,6 +32,14 @@ flags
|
|||||||
coding = utf8 ;
|
coding = utf8 ;
|
||||||
|
|
||||||
oper
|
oper
|
||||||
|
Number : Type ;
|
||||||
|
singular : Number ;
|
||||||
|
plural : Number ;
|
||||||
|
|
||||||
|
Number = ResLav.Number ;
|
||||||
|
singular = Sg ;
|
||||||
|
plural = Pl ;
|
||||||
|
|
||||||
second_conjugation : VerbConj = C2 ;
|
second_conjugation : VerbConj = C2 ;
|
||||||
third_conjugation : VerbConj = C3 ;
|
third_conjugation : VerbConj = C3 ;
|
||||||
|
|
||||||
|
|||||||
@@ -32,11 +32,24 @@ param
|
|||||||
-- Deb = Debitive (Latvian specific: http://www.isocat.org/rest/dc/3835)
|
-- Deb = Debitive (Latvian specific: http://www.isocat.org/rest/dc/3835)
|
||||||
-- Condit = Conditional
|
-- Condit = Conditional
|
||||||
-- DebitiveRelative = the relative subtype of debitive
|
-- DebitiveRelative = the relative subtype of debitive
|
||||||
VerbForm = Infinitive | Indicative Person Number Tense | Relative Tense | Debitive |
|
VerbForm =
|
||||||
Imperative Number | DebitiveRelative | Participle Gender Number Case ;
|
Infinitive
|
||||||
|
| Indicative Person Number Tense
|
||||||
|
| Relative Tense
|
||||||
|
| Debitive
|
||||||
|
| Imperative Number
|
||||||
|
| DebitiveRelative
|
||||||
|
| Participle Gender Number Case
|
||||||
|
;
|
||||||
-- TODO: divdabim noteiktā forma un arī pārākā / vispārākā pakāpe
|
-- TODO: divdabim noteiktā forma un arī pārākā / vispārākā pakāpe
|
||||||
|
|
||||||
VerbMood = Ind Anteriority Tense | Rel Anteriority Tense | Deb Anteriority Tense | Condit Anteriority ;
|
VerbMood =
|
||||||
|
Ind Anteriority Tense
|
||||||
|
| Rel Anteriority Tense --# notpresent
|
||||||
|
| Deb Anteriority Tense --# notpresent
|
||||||
|
| Condit Anteriority --# notpresent
|
||||||
|
;
|
||||||
|
|
||||||
VerbConj = C2 | C3 ;
|
VerbConj = C2 | C3 ;
|
||||||
|
|
||||||
--Agr = Ag Gender Number ;
|
--Agr = Ag Gender Number ;
|
||||||
|
|||||||
@@ -42,8 +42,9 @@ lin
|
|||||||
UseQCl t p cl = { s = t.s ++ p.s ++ cl.s ! (Ind t.a t.t) ! p.p } ;
|
UseQCl t p cl = { s = t.s ++ p.s ++ cl.s ! (Ind t.a t.t) ! p.p } ;
|
||||||
|
|
||||||
UseRCl t p cl =
|
UseRCl t p cl =
|
||||||
{ s = \\ag => t.s ++ p.s ++ cl.s ! (Ind t.a t.t) ! p.p ! ag } |
|
{ s = \\ag => t.s ++ p.s ++ cl.s ! (Ind t.a t.t) ! p.p ! ag }
|
||||||
{ s = \\ag => t.s ++ p.s ++ cl.s ! (Rel t.a t.t) ! p.p ! ag } ;
|
| { s = \\ag => t.s ++ p.s ++ cl.s ! (Rel t.a t.t) ! p.p ! ag } --# notpresent
|
||||||
|
;
|
||||||
|
|
||||||
UseSlash t p slash = { s = t.s ++ p.s ++ slash.s ! (Ind t.a t.t) ! p.p ; p = slash.p } ;
|
UseSlash t p slash = { s = t.s ++ p.s ++ slash.s ! (Ind t.a t.t) ! p.p ; p = slash.p } ;
|
||||||
|
|
||||||
@@ -55,7 +56,7 @@ oper
|
|||||||
s = \\mood,pol =>
|
s = \\mood,pol =>
|
||||||
case mood of { -- Subject
|
case mood of { -- Subject
|
||||||
-- FIXME: jāčeko valences, reizēm arī īstenības izteiksmē - 'man patīk kaut kas'
|
-- FIXME: jāčeko valences, reizēm arī īstenības izteiksmē - 'man patīk kaut kas'
|
||||||
Deb _ _ => np.s ! Dat ;
|
Deb _ _ => np.s ! Dat ; --# notpresent
|
||||||
_ => np.s ! Nom
|
_ => np.s ! Nom
|
||||||
} ++
|
} ++
|
||||||
buildVerb vp.v mood pol np.a ++ -- Verb
|
buildVerb vp.v mood pol np.a ++ -- Verb
|
||||||
|
|||||||
@@ -450,37 +450,4 @@ oper
|
|||||||
|
|
||||||
no_Utt = ss "nē" ;
|
no_Utt = ss "nē" ;
|
||||||
|
|
||||||
{-
|
|
||||||
can8know_VV, can_VV = {
|
|
||||||
s = table {
|
|
||||||
VVF VInf => ["be able to"] ;
|
|
||||||
VVF VPres => "can" ;
|
|
||||||
VVF VPPart => ["been able to"] ;
|
|
||||||
VVF VPresPart => ["being able to"] ;
|
|
||||||
VVF VPast => "could" ; --# notpresent
|
|
||||||
VVPastNeg => "couldn't" ; --# notpresent
|
|
||||||
VVPresNeg => "can't"
|
|
||||||
} ;
|
|
||||||
isAux = True
|
|
||||||
} ;
|
|
||||||
must_VV = {
|
|
||||||
s = table {
|
|
||||||
VVF VInf => ["have to"] ;
|
|
||||||
VVF VPres => "must" ;
|
|
||||||
VVF VPPart => ["had to"] ;
|
|
||||||
VVF VPresPart => ["having to"] ;
|
|
||||||
VVF VPast => ["had to"] ; --# notpresent
|
|
||||||
VVPastNeg => ["hadn't to"] ; --# notpresent
|
|
||||||
VVPresNeg => "mustn't"
|
|
||||||
} ;
|
|
||||||
isAux = True
|
|
||||||
} ;
|
|
||||||
|
|
||||||
not_Predet = {s = "not" ; lock_Predet = <>} ;
|
|
||||||
no_Quant = mkQuant "no" "no" "none" "none" ;
|
|
||||||
|
|
||||||
have_V2 = dirV2 (mk5V "have" "has" "had" "had" "having") ;
|
|
||||||
|
|
||||||
-}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,4 +8,38 @@ concrete SymbolLav of Symbol = CatLav ** open
|
|||||||
flags
|
flags
|
||||||
coding = utf8 ;
|
coding = utf8 ;
|
||||||
|
|
||||||
|
lin
|
||||||
|
SymbPN i = {s = \\_ => i.s ; g = Masc ; n = Sg} ;
|
||||||
|
IntPN i = {s = \\_ => i.s ; g = Masc ; n = Pl} ;
|
||||||
|
FloatPN i = {s = \\_ => i.s ; g = Masc ; n = Pl} ;
|
||||||
|
NumPN i = {s = \\_ => i.s ! Masc ! Nom ; g = Masc ; n = Pl} ;
|
||||||
|
|
||||||
|
CNIntNP cn i = {
|
||||||
|
s = \\_ => cn.s ! Indef ! Sg ! Nom ++ i.s ;
|
||||||
|
a = agrgP3 Sg cn.g
|
||||||
|
} ;
|
||||||
|
CNSymbNP det cn xs = {
|
||||||
|
s = \\_ => det.s ! cn.g ! Nom ++ cn.s ! det.d ! det.n ! Nom ++ xs.s ;
|
||||||
|
a = agrgP3 det.n cn.g
|
||||||
|
} ;
|
||||||
|
CNNumNP cn i = {
|
||||||
|
s = \\_ => cn.s ! Indef ! Sg ! Nom ++ i.s ! Masc ! Nom ;
|
||||||
|
a = agrgP3 Sg cn.g
|
||||||
|
} ;
|
||||||
|
|
||||||
|
SymbS sy = sy ;
|
||||||
|
|
||||||
|
SymbNum sy = { s = \\_,_ => sy.s ; n = Pl } ;
|
||||||
|
SymbOrd sy = { s = \\_,_ => sy.s ++ "."} ;
|
||||||
|
|
||||||
|
lincat
|
||||||
|
|
||||||
|
Symb, [Symb] = SS ;
|
||||||
|
|
||||||
|
lin
|
||||||
|
MkSymb s = s ;
|
||||||
|
|
||||||
|
BaseSymb = infixSS "un" ;
|
||||||
|
ConsSymb = infixSS "," ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
-- Not so simple since morphology itself needs ResLav & friends.
|
-- Not so simple since morphology itself needs ResLav & friends.
|
||||||
|
|
||||||
concrete VerbLav of Verb = CatLav ** open
|
concrete VerbLav of Verb = CatLav ** open
|
||||||
|
ParamX,
|
||||||
ResLav,
|
ResLav,
|
||||||
ParadigmsVerbsLav,
|
ParadigmsVerbsLav,
|
||||||
StructuralLav
|
StructuralLav
|
||||||
@@ -74,22 +75,27 @@ oper
|
|||||||
|
|
||||||
buildVerb : Verb -> VerbMood -> Polarity -> Agr -> Str = \v,mood,pol,ag ->
|
buildVerb : Verb -> VerbMood -> Polarity -> Agr -> Str = \v,mood,pol,ag ->
|
||||||
let
|
let
|
||||||
ag = fromAgr ag ;
|
ag = fromAgr ag
|
||||||
part = v.s ! ResLav.Pos ! (Participle ag.g ag.n Nom)
|
; --# notpresent
|
||||||
|
part = v.s ! ResLav.Pos ! (Participle ag.g ag.n Nom) --# notpresent
|
||||||
in case mood of {
|
in case mood of {
|
||||||
Ind Simul tense => v.s ! pol ! (Indicative ag.p ag.n tense) ;
|
Ind Simul tense => v.s ! pol ! (Indicative ag.p ag.n tense)
|
||||||
Ind Anter tense => mkVerb_toBe.s ! pol ! (Indicative ag.p ag.n tense) ++ part ;
|
; --# notpresent
|
||||||
|
Ind Anter tense => mkVerb_toBe.s ! pol ! (Indicative ag.p ag.n tense) ++ part ; --# notpresent
|
||||||
|
|
||||||
Rel _ Past => ResLav.NON_EXISTENT ; -- FIXME (?)
|
-- FIXME(?): Rel _ Past => ...
|
||||||
Rel Simul tense => v.s ! pol ! (Relative tense) ;
|
Rel _ Past => ResLav.NON_EXISTENT ; --# notpresent
|
||||||
Rel Anter tense => mkVerb_toBe.s ! pol ! (Relative tense) ++ part ;
|
Rel Simul tense => v.s ! pol ! (Relative tense) ; --# notpresent
|
||||||
|
Rel Anter tense => mkVerb_toBe.s ! pol ! (Relative tense) ++ part ; --# notpresent
|
||||||
|
|
||||||
Deb Simul tense => mkVerb_toBe.s ! pol ! (Indicative P3 Sg tense) ++ v.s ! ResLav.Pos ! Debitive ;
|
Deb Simul tense => mkVerb_toBe.s ! pol ! (Indicative P3 Sg tense) ++ --# notpresent
|
||||||
Deb Anter tense => mkVerb_toBe.s ! pol ! (Indicative P3 Sg tense) ++
|
v.s ! ResLav.Pos ! Debitive ; --# notpresent
|
||||||
mkVerb_toBe.s ! ResLav.Pos ! (Participle Masc Sg Nom) ++ v.s ! ResLav.Pos ! Debitive ;
|
Deb Anter tense => mkVerb_toBe.s ! pol ! (Indicative P3 Sg tense) ++ --# notpresent
|
||||||
|
mkVerb_toBe.s ! ResLav.Pos ! (Participle Masc Sg Nom) ++ --# notpresent
|
||||||
|
v.s ! ResLav.Pos ! Debitive ; --# notpresent
|
||||||
|
|
||||||
Condit Simul => v.s ! pol ! (Indicative ag.p ag.n Cond) ;
|
Condit Simul => v.s ! pol ! (Indicative ag.p ag.n ParamX.Cond) ; --# notpresent
|
||||||
Condit Anter => mkVerb_toBe.s ! pol ! (Indicative ag.p ag.n Cond) ++ part
|
Condit Anter => mkVerb_toBe.s ! pol ! (Indicative ag.p ag.n ParamX.Cond) ++ part --# notpresent
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
-- TODO: nav testēts
|
-- TODO: nav testēts
|
||||||
|
|||||||
Reference in New Issue
Block a user