1
0
forked from GitHub/gf-rgl
This commit is contained in:
Krasimir Angelov
2018-11-28 13:57:39 +01:00
51 changed files with 2275 additions and 1252 deletions

View File

@@ -1,14 +1,27 @@
sudo: required
language: c
services:
- docker
os:
- linux
- osx
- windows
addons:
apt:
packages:
- ghc
before_install:
- docker pull odanoburu/haskell-gf:3.9
- mkdir rgl
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update && brew install ghc@8.2 && export PATH="/usr/local/opt/ghc@8.2/bin:$PATH" ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl http://www.grammaticalframework.org/download/gf-3.9-bin-intel-mac.tar.gz > gf.tar.gz && sudo tar --no-same-owner --no-same-permissions -C /usr/local -zxf gf.tar.gz && rm gf.tar.gz; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then curl http://www.grammaticalframework.org/download/gf_3.9.1-1_amd64-trusty.deb > gf.deb && sudo dpkg -i gf.deb && rm gf.deb ; fi
- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then choco install ghc --version=8.4.4 && export PATH="/c/ProgramData/chocolatey/lib/ghc/tools/ghc-8.4.4/bin:$PATH"; fi
- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then curl http://www.grammaticalframework.org/download/gf-3.9-bin-windows.zip > gf.zip && unzip gf.zip && rm gf.zip && export PATH="$TRAVIS_BUILD_DIR/gf-3.9/bin:$PATH"; fi
- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then alias gf='gf.exe' && alias runghc='runghc.exe' ; fi
script:
- docker run --mount src="$(pwd)",target=/home,type=bind odanoburu/haskell-gf:3.9 /bin/bash -c "cd /home/; export GF_LIB_PATH=/home/rgl ; runghc Make.hs build prelude all --verbose ;"
- docker run --mount src="$(pwd)",target=/home,type=bind odanoburu/haskell-gf:3.9 /bin/bash -c "cd /home/; export GF_LIB_PATH=/home/rgl; bash Make.sh --dest=rgl --verbose ;"
- runghc Make.hs build prelude all --verbose
- rm -rf dist
- mkdir dist-bash ; bash Make.sh --dest=dist-bash --verbose
- rm -rf dist ; mkdir dist-bat
- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then cmd //c Make.bat --dest=dist-bat --verbose ; fi

70
Config.hs Normal file
View File

@@ -0,0 +1,70 @@
-- | Reading language config file
module Config (
LangInfo (..),
loadLangs, loadLangsFrom, configFile
) where
import Data.List (unfoldr)
import System.IO (hPutStrLn,stderr)
import System.Exit (exitFailure)
-- | Path to language config file
configFile :: FilePath
configFile = "languages.csv"
-- | Information about a language
data LangInfo = LangInfo
{ langCode :: String -- ^ 3-letter ISO 639-2/B code
, langName :: String -- ^ language name
, langDir :: String -- ^ directory name
, langFunctor :: Maybe String -- ^ functor (not used)
, langUnlexer :: Maybe String -- ^ decoding for postprocessing linearizations
, langPresent :: Bool
, langAll :: Bool
, langTry :: Bool
, langSymbolic :: Bool
, langCompatibility :: Bool
, langSynopsis :: Bool -- ^ include in RGL synopsis
} deriving (Show,Eq)
-- | Load language information from default config file
loadLangs :: IO [LangInfo]
loadLangs = loadLangsFrom configFile
-- | Load language information from specified config file
loadLangsFrom:: FilePath -> IO [LangInfo]
loadLangsFrom configFile = do
lns <- readFile configFile >>= return . lines
mapM mkLangInfo (tail lns)
where
maybeBit bits n = if length bits >= (n+1) && length (bits !! n) > 0 then Just (bits !! n) else Nothing
boolBit bits n def = if length bits >= (n+1) && length (bits !! n) > 0 then (if def then bits !! n /= "n" else bits !! n == "y") else def
mkLangInfo s =
let bits = separateBy ',' s in
if length bits < 2
then die $ "Invalid entry in " ++ configFile ++ ": " ++ s
else return $ LangInfo
{ langCode = bits !! 0
, langName = bits !! 1
, langDir = bits !! 2
, langFunctor = maybeBit bits 3
, langUnlexer = maybeBit bits 4
, langPresent = boolBit bits 5 False
, langAll = boolBit bits 6 True
, langTry = boolBit bits 7 True
, langSymbolic = boolBit bits 8 True
, langCompatibility = boolBit bits 9 False
, langSynopsis = boolBit bits 10 False
}
-- | Separate a string on a character
-- Source: https://stackoverflow.com/a/4978733/98600
separateBy :: Eq a => a -> [a] -> [[a]]
separateBy chr = unfoldr sep where
sep [] = Nothing
sep l = Just . fmap (drop 1) . break (== chr) $ l
die :: String -> IO a
die s = do
hPutStrLn stderr s
exitFailure

View File

@@ -27,22 +27,25 @@ It will look for, in this order:
## Language config
A list of all languages and their properties is maintained centrally in `languages.csv`.
A list of all languages and their properties is maintained centrally in [`languages.csv`](languages.csv).
This file should be kept up-to-date and all build methods should read this config file.
**If you see something wrong, please report/fix it.**
Description of columns:
- Code, e,g, `Eng`
- Directory, e.g. `english`
- Functor (not used)
- Unlexer (not used)
- Present: languages that have `--# notpresent` marked
- All: languages for which to compile `All`
- Try: languages for which to compile `Try`
- Symbolic: languages for which to compile `Symbolic`
- Compatibility: languages for which to complile `Compatibility`
| # | Column | Description | Default |
|:---|:--------------|:-----------------------------------------|:-------:|
| 1 | Code | 3-letter language code, e.g. `Eng` | - |
| 2 | Name | language name in English, e.g. `English` | - |
| 3 | Directory | folder name under `src`, e.g. `english` | - |
| 4 | Functor | functor name (not used) | - |
| 5 | Unlexer | unlexer (not used) | - |
| 6 | Present | language is marked with `--# notpresent` | n |
| 7 | All | compile `All` module | y |
| 8 | Try | compile `Try` module | y |
| 9 | Symbolic | compile `Symbolic` module | y |
| 10 | Compatibility | complile `Compatibility` module | n |
| 11 | Synopsis | include language in the RGL synopsis | n |
Columns can be a string, just `y`'s (where nothing means `n`) or just (`n`'s where nothing means `y`).
If default is `y` then anything other than `n`, including the empty string, is treated as true (and vice versa when default is `n`).
## Haskell script: `Setup.hs`
@@ -108,11 +111,9 @@ You can pass the following flags:
## Windows batch file: `Setup.bat`
**This script is still untested.**
This method is provided as an alternative for Windows users who don't have Haskell or Bash installed.
This method is provided as an alternative for Windows users who don't have Haskell installed.
It is supposed to be a port of Setup.sh and works in largely the same way.
It is supposed to be a port of `Setup.sh` and works in largely the same way.
In particular, it accepts the same flags (in the same format) as described above.
However it currently tries to build all modules for all languages and doesn't consider the details of which modules should be compiled for each language (specified in `languages.csv`)

View File

@@ -12,35 +12,45 @@ set modules_langs=All Symbol Compatibility
set modules_api=Try Symbolic
REM Defaults (may be overridden by options)
set gf=gf-default
set gf=gf
set dest=
set verbose=false
REM Check command line options
set arg_gf_next=false
set arg_dest_next=false
for %%i in (%*) do (
if !arg_gf_next!==true (
set gf=%%i
set arg_gf_next=false
)
if !arg_dest_next!==true (
set dest=%%i
set arg_dest_next=false
)
if %%i==-v set verbose=true
if %%i==--verbose set verbose=true
if %%i==--gf set arg_gf_next=true
if %%i==--dest set arg_dest_next=true
)
:Loop
if '%1'=='' goto Continue
if %1==-v set verbose=true
if %1==--verbose set verbose=true
if %1==--gf set gf=%2
if %1==--dest set dest=%2
shift
goto Loop
:Continue
REM Try to determine install location
if "%dest%"=="" (
set dest=%GF_LIB_PATH%
REM Separate paths with search path separator ; and pick first one
for %%p in ("%GF_LIB_PATH:;=";"%") do (
set dest=%%~p
goto BreakLibPath
)
)
:BreakLibPath
set DATA_DIR=..\gf-core\DATA_DIR
if "%dest%"=="" (
REM TODO Look in ../gf-core/DATA=DIR
REM Look in already compiled GF folder
if exist %DATA_DIR% (
for /f "delims=" %%x in (%DATA_DIR%) do (
if not "%%x"=="" (
set dest=%%x\lib
goto BreakDataDir
)
)
)
)
:BreakDataDir
if "%dest%"=="" (
echo Unable to determine where to install the RGL. Please do one of the following:
echo - Pass the --dest=... flag to this script
@@ -52,17 +62,17 @@ if "%dest%"=="" (
REM A few more definitions before we get started
set src=src
set dist=dist
set gfc=gf --batch --gf-lib-path=%src% --quiet
set gfc=%gf% --batch --gf-lib-path=%src%
REM Redirect stderr if not verbose
REM Add quiet flag if not verbose
if %verbose%==false (
set gfc=2>NUL !gfc!
set gfc=%gfc% --quiet
)
REM Make directories if not present
mkdir %dist%\prelude
mkdir %dist%\present
mkdir %dist%\alltenses
if not exist %dist%\prelude mkdir %dist%\prelude
if not exist %dist%\present mkdir %dist%\present
if not exist %dist%\alltenses mkdir %dist%\alltenses
REM Build: prelude
echo Building [prelude]
@@ -74,13 +84,17 @@ REM Gather all language modules for building
set modules=
for %%l in (%langs%) do (
for %%m in (%modules_langs%) do (
for /r %src% %%m in (*%%m%%l.gf) do (
set modules=!modules! %%m
set patt=%%m%%l.gf
for /r %src% %%n in (!patt!) do (
if exist %%n set modules=!modules! %%n
)
)
)
for %%l in (%langs%) do (
for %%m in (%modules_api%) do (
for /r %src%\api %%m in (*%%m%%l.gf) do (
set modules=!modules! %%m
set patt=%%m%%l.gf
for /r %src%\api %%n in (!patt!) do (
if exist %%n set modules=!modules! %%n
)
)
)
@@ -88,15 +102,25 @@ for %%l in (%langs%) do (
REM Build: present
echo Building [present]
for %%m in (%modules%) do (
if %verbose%==true echo %%m
%gfc% --no-pmcfg --gfo-dir=%dist%\present --preproc=mkPresent %%m
)
REM Build: alltenses
echo Building [alltenses]
for %%m in (%modules%) do (
if %verbose%==true echo %%m
%gfc% --no-pmcfg --gfo-dir=%dist%\alltenses %%m
)
REM Make destination directories if not present
if not exist %dest% mkdir %dest%
if not exist %dest%\prelude mkdir %dest%\prelude
if not exist %dest%\present mkdir %dest%\present
if not exist %dest%\alltenses mkdir %dest%\alltenses
REM Copy
echo Copying to %dest%
xcopy %dist% %dest% /d
copy %dist%\prelude\*.gfo %dest%\prelude\
copy %dist%\present\*.gfo %dest%\present\
copy %dist%\alltenses\*.gfo %dest%\alltenses\

View File

@@ -2,19 +2,20 @@
-- | Main build script for RGL
import Data.List (find,isPrefixOf,isSuffixOf,(\\),unfoldr)
import Data.List (find,isPrefixOf,isSuffixOf,(\\))
import Data.Maybe (catMaybes)
import System.IO (hPutStrLn,stderr)
import System.IO.Error (catchIOError)
import System.Exit (ExitCode(..),exitFailure)
import System.Environment (getArgs,lookupEnv)
import System.Process (rawSystem)
import System.FilePath ((</>)) -- ,takeFileName,addExtension,dropExtension)
import System.FilePath ((</>),splitSearchPath) -- ,takeFileName,addExtension,dropExtension)
import System.Directory (createDirectoryIfMissing,copyFile,getDirectoryContents,removeDirectoryRecursive,findFile)
#if __GLASGOW_HASKELL__>=800
import System.Directory (getModificationTime,setModificationTime)
#endif
import Control.Monad (when,unless)
import Config
main :: IO ()
main = do
@@ -118,7 +119,7 @@ mkInfo = do
-- Look for install location in a few different places
let mflag = getFlag destination_flag args
mbuilt <- catchIOError (readFile "../gf-core/DATA_DIR" >>= \d -> return (Just (d </> "lib"))) (\e -> return Nothing)
menvar <- lookupEnv "GF_LIB_PATH"
menvar <- lookupEnv "GF_LIB_PATH" >>= return . fmap (head . splitSearchPath)
let
inst_dir =
case catMaybes [mflag,menvar,mbuilt] of
@@ -347,57 +348,6 @@ verbose_switch_short = "-v"
getFlag :: String -> [String] -> Maybe String
getFlag flag args = fmap (drop (length flag)) $ find (isPrefixOf flag) args
-------------------------------------------------------------------------------
-- Languages of the RGL
-- | Path to language config file
configFile :: FilePath
configFile = "languages.csv"
-- | Information about a language
data LangInfo = LangInfo
{ langCode :: String -- ^ 3-letter ISO 639-2/B code
, langDir :: String -- ^ directory name
, langFunctor :: Maybe String -- ^ functor (not used)
, langUnlexer :: Maybe String -- ^ decoding for postprocessing linearizations
, langPresent :: Bool
, langAll :: Bool
, langTry :: Bool
, langSymbolic :: Bool
, langCompatibility :: Bool
} deriving (Show,Eq)
-- | Load language information from config file
loadLangs :: IO [LangInfo]
loadLangs = do
lns <- readFile configFile >>= return . lines
mapM mkLangInfo (tail lns)
where
maybeBit bits n = if length bits >= (n+1) && length (bits !! n) > 0 then Just (bits !! n) else Nothing
boolBit bits n def = if length bits >= (n+1) && length (bits !! n) > 0 then (if def then bits !! n /= "n" else bits !! n == "y") else def
mkLangInfo s =
let bits = separateBy ',' s in
if length bits < 2
then die $ "Invalid entry in " ++ configFile ++ ": " ++ s
else return $ LangInfo
{ langCode = bits !! 0
, langDir = bits !! 1
, langFunctor = maybeBit bits 2
, langUnlexer = maybeBit bits 3
, langPresent = boolBit bits 4 False
, langAll = boolBit bits 5 True
, langTry = boolBit bits 6 True
, langSymbolic = boolBit bits 7 True
, langCompatibility = boolBit bits 8 False
}
-- | Separate a string on a character
-- Source: https://stackoverflow.com/a/4978733/98600
separateBy :: Eq a => a -> [a] -> [[a]]
separateBy chr = unfoldr sep where
sep [] = Nothing
sep l = Just . fmap (drop 1) . break (== chr) $ l
-------------------------------------------------------------------------------
-- Executing GF
@@ -444,7 +394,7 @@ execute command args = do
-- | For parallel RGL module compilation
-- Unfortunately, this has no effect unless compiled with -threaded
parallel_ :: (Foldable t, Monad m) => t (m a) -> m ()
--parallel_ :: (Foldable t, Monad m) => t (m a) -> m ()
parallel_ ms = sequence_ ms
-- do c <- newChan
-- ts <- sequence [ forkIO (m >> writeChan c ()) | m <- ms]

View File

@@ -6,11 +6,11 @@
set -e
# Get languages from config
langs=$(tail -n +2 languages.csv | awk -F ',' '{ if ($6 != "n") { print $1 } }')
langs_present=$(tail -n +2 languages.csv | awk -F ',' '{ if ($5 == "y") { print $1 } }')
langs_try=$(tail -n +2 languages.csv | awk -F ',' '{ if ($7 != "n") { print $1 } }')
langs_symbolic=$(tail -n +2 languages.csv | awk -F ',' '{ if ($8 != "n") { print $1 } }')
langs_compat=$(tail -n +2 languages.csv | awk -F ',' '{ if ($9 == "y") { print $1 } }')
langs=$(tail -n +2 languages.csv | awk -F ',' '{ if ($7 != "n") { print $1 } }')
langs_present=$(tail -n +2 languages.csv | awk -F ',' '{ if ($6 == "y") { print $1 } }')
langs_try=$(tail -n +2 languages.csv | awk -F ',' '{ if ($8 != "n") { print $1 } }')
langs_symbolic=$(tail -n +2 languages.csv | awk -F ',' '{ if ($9 != "n") { print $1 } }')
langs_compat=$(tail -n +2 languages.csv | awk -F ',' '{ if ($10 == "y") { print $1 } }')
# Modules to compile for each language
modules_langs="All Symbol Compatibility"
@@ -36,7 +36,7 @@ done
# Try to determine install location
if [ -z "$dest" ]; then
dest="$GF_LIB_PATH"
dest=$(echo "$GF_LIB_PATH" | sed 's/:.*$//')
fi
if [ -z "$dest" ] && [ -f "../gf-core/DATA_DIR" ]; then
dest=$(cat ../gf-core/DATA_DIR)

View File

@@ -1,4 +1,4 @@
.PHONY: abstract synopsis index status
.PHONY: all index status synopsis abstract
all: synopsis
@@ -15,17 +15,17 @@ synopsis: synopsis.html
S=../src
# List of languages extracted from MkSynopsis.hs
LANGS=Afr Ara Bul Cat Chi Dan Dut Eng Est Eus Fin Fre Ger Gre Hin Ice Ita Jpn Lav Mlt Mon Nep Nor Nno Pes Pnb Pol Por Ron Rus Snd Spa Swe Tha Urd
# List of languages extracted from languages.csv, with 'Synopsis' column == y
LANGS=$(shell cat ../languages.csv | cut -d',' -f1,11 | grep ',y' | cut -d',' -f1)
# This list was constructed by observing what files MkSynopsis.hs reads
SRC_FILES=$S/abstract/Common.gf $S/abstract/Cat.gf $S/api/Constructors.gf $S/abstract/Structural.gf $(patsubst %,$S/*/Paradigms%.gf,$(LANGS))
SRC_FILES=$(S)/abstract/Common.gf $(S)/abstract/Cat.gf $(S)/api/Constructors.gf $(S)/abstract/Structural.gf $(patsubst %,$S/*/Paradigms%.gf,$(LANGS))
EXAMPLES_OUT=$(patsubst %,api-examples-%.txt,$(LANGS))
INCLUDES=synopsis-intro.txt categories-intro.txt categories-imagemap.html synopsis-additional.txt synopsis-browse.txt synopsis-example.txt
synopsis.html: MkSynopsis.hs MkExxTable.hs $(INCLUDES) $(EXAMPLES_OUT) $(SRC_FILES)
runghc MkSynopsis.hs
runghc -i.. MkSynopsis.hs
categories.png: categories.dot
dot -Tpng $^ > $@
@@ -37,11 +37,9 @@ abstract:
$(GFDOC) -txthtml $S/abstract/*.gf
mv $S/abstract/*.html abstract
api-examples.gfs: api-examples.txt MkExx.hs
runghc MkExx.hs < $< > $@
# Since .gfo files aren't self-contained, the dependencies given here are
# incomplete. But I am thinking that the Try%.gfo file will always be newer
# than any other files it depends on, so the rule will trigger when

View File

@@ -6,7 +6,7 @@
main = interact (unlines . concatMap mkScript . takeWhile (/="--.") . lines)
mkScript l = case l of
' ':_ ->
' ':_ ->
let ident = mkIdent $ unwords $ takeWhile (/="--") $ words l
in [add $ psq ident]
'-':_ -> []
@@ -30,45 +30,3 @@ mkIdent = concatMap unspec where
')' -> ""
':' -> "-"
_ -> [c]
langsCoding = [
(("amharic", "Amh"),""),
(("arabic", "Ara"),""),
(("basque", "Eus"),""),
(("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"),""),
(("portuguese", "Por"), "Romance"),
(("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

View File

@@ -4,10 +4,9 @@ module MkExxTable (getApiExx, ApiExx, prApiEx, mkEx) where
import System.Environment(getArgs)
import Control.Monad(when)
import qualified Data.Map as M
import Data.Char
main = do
xx <- getArgs
xx <- getArgs
aexx <- getApiExx' True xx
return () -- putStrLn $ prApiExx aexx
@@ -16,7 +15,7 @@ getApiExx = getApiExx' False
getApiExx' verbose xx = do
s <- readFile (head xx)
let aet = getApiExxTrees $ filter validOutput $ mergeOutput $ lines s
let aet = getApiExxTrees $ filter validOutput $ mergeOutput $ lines s
aeos <- mapM (readApiExxOne verbose) xx
let aexx = mkApiExx $ ("API",aet) : aeos
-- putStrLn $ prApiExx aexx
@@ -57,7 +56,7 @@ cleanUp = dropWhile (flip elem " >")
--- this makes txt2tags loop...
mergeOutput ls = ls
mergeOutputt ls = case ls of
l@('>':_):ll -> let (ll1,ll2) = span ((/=">") . take 1) ll in unwords (l : map (unwords . words) ll1) : mergeOutput ll2
l@('>':_):ll -> let (ll1,ll2) = span ((/=">") . take 1) ll in unwords (l : map (unwords . words) ll1) : mergeOutput ll2
_:ll -> mergeOutput ll
_ -> []
@@ -65,15 +64,15 @@ mergeOutputt ls = case ls of
validOutput = (==">") . take 1
mkApiExx :: [(String,ApiExxOne)] -> ApiExx
mkApiExx ltes =
M.fromList [(t,
M.fromList [(l,maybe "NONE" id (M.lookup t te)) | (l,te) <- ltes])
mkApiExx ltes =
M.fromList [(t,
M.fromList [(l,maybe "NONE" id (M.lookup t te)) | (l,te) <- ltes])
| t <- M.keys firstL]
where
firstL = snd (head ltes)
prApiExx :: ApiExx -> String
prApiExx aexx = unlines
prApiExx aexx = unlines
[unlines (t:prApiEx lexx) | (t,lexx) <- M.toList aexx]
prApiEx :: M.Map String String -> [String]
@@ -81,7 +80,7 @@ prApiEx apexx = case M.toList apexx of
(a,e):lexx -> (a ++ ": ``" ++ unwords (words e) ++ "``"):
[l ++ ": //" ++ mkEx l e ++ "//" | (l,e) <- lexx]
mkEx l = unws . bind . mkE . words where
mkEx l = unws . bind . mkE . words where
unws = if elem l ["Chi","Jpn","Tha"] then concat else unwords -- remove spaces
mkE e = case e of
"atomic":"term":_ -> ["*"]
@@ -101,6 +100,6 @@ bind ws = case ws of
"&+":ws2 -> bind ws2
"Predef.BIND":ws2 -> bind ws2
"Predef.SOFT_BIND":ws2 -> bind ws2
w : ws2 -> w : bind ws2
w : "++" : ws2 -> w : bind ws2
w : ws2 -> w : bind ws2
_ -> ws

View File

@@ -1,27 +1,35 @@
import MkExxTable
import System.Process(system)
import System.Environment(getArgs)
import System.FilePath((</>),(<.>))
import Data.Char
import Data.List
import qualified Data.ByteString.Char8 as BS
import qualified Data.Map as M
---import Debug.Trace ----
import Text.Printf
import Config
type Cats = [(String,String,String)]
type Rules = [(String,String,String)]
-- the file generated
synopsis :: FilePath
synopsis = "synopsis.txt"
-- the language in which revealed examples are shown
revealedLang :: String
revealedLang = "Eng"
-- all languages shown (a copy of this list appears in Makefile)
apiExxFiles = ["api-examples-" ++ lang ++ ".txt" | lang <- words
-- "Eng Chi"
"Afr Ara Bul Cat Chi Dan Dut Eng Est Eus Fin Fre Ger Gre Hin Ice Ita Jpn Lav Mlt Mon Nep Nor Nno Pes Pnb Pol Por Ron Rus Snd Spa Swe Tha Urd"
]
apiExxFiles :: IO [FilePath]
apiExxFiles = do
langs <- loadLangsFrom (".." </> configFile)
return $
[ "api-examples-" ++ (langCode lang) ++ ".txt"
| lang <- langs
, langSynopsis lang
]
main :: IO ()
main = do
xx <- getArgs
let isLatex = case xx of
@@ -31,7 +39,7 @@ main = do
cs2 <- getCats catAPI
let cs = sortCats (cs1 ++ cs2)
writeFile synopsis "GF Resource Grammar Library: Synopsis"
append "B. Bringert, T. Hallgren, and A. Ranta"
-- append "B. Bringert, T. Hallgren, and A. Ranta"
space
append "%!Encoding:utf-8"
append "%!style(html): ./revealpopup.css"
@@ -66,7 +74,7 @@ main = do
space
link "Source 2:" structuralAPI
space
apiExx <- getApiExx apiExxFiles
apiExx <- apiExxFiles >>= getApiExx
rs <- getRules apiExx syntaxAPI
--- putStrLn $ unlines ["p -cat=" ++ last (words t) ++
--- " \"" ++ e ++ "\"" | (_,t,e) <- rs, not (null e)] ----
@@ -83,7 +91,7 @@ main = do
-- delimit rs
space
title "Lexical Paradigms"
mapM_ (putParadigms isLatex cs) paradigmFiles
paradigmFiles >>= mapM_ (putParadigms isLatex cs)
space
include "synopsis-additional.txt"
space
@@ -227,7 +235,6 @@ mkIdent = concatMap unspec where
':' -> "-"
_ -> [c]
mkCatTable :: Bool -> Cats -> [String]
mkCatTable isLatex cs = inChunks chsize (\rs -> header ++ map mk1 rs) cs
where
@@ -236,49 +243,36 @@ mkCatTable isLatex cs = inChunks chsize (\rs -> header ++ map mk1 rs) cs
mk1 (name,expl,ex) = unwords ["|", showCat cs name, "|", expl, "|", typo ex, "|"]
typo ex = if take 1 ex == "\"" then itf (init (tail ex)) else ex
srcPath = ("../src" ++)
srcPath = ((</>) "../src")
commonAPI = srcPath "/abstract/Common.gf"
catAPI = srcPath "/abstract/Cat.gf"
syntaxAPI = srcPath "/api/Constructors.gf"
structuralAPI = srcPath "/abstract/Structural.gf"
paradigmFiles = [
("Afrikaans", srcPath "/afrikaans/ParadigmsAfr.gf"),
("Arabic", srcPath "/arabic/ParadigmsAra.gf"),
("Basque", srcPath "/basque/ParadigmsEus.gf"),
("Bulgarian", srcPath "/bulgarian/ParadigmsBul.gf"),
("Catalan", srcPath "/catalan/ParadigmsCat.gf"),
("Chinese", srcPath "/chinese/ParadigmsChi.gf"),
("Danish", srcPath "/danish/ParadigmsDan.gf"),
("Dutch", srcPath "/dutch/ParadigmsDut.gf"),
("English", srcPath "/english/ParadigmsEng.gf"),
("Estonian", srcPath "/estonian/ParadigmsEst.gf"),
("Finnish", srcPath "/finnish/ParadigmsFin.gf"),
("French", srcPath "/french/ParadigmsFre.gf"),
("German", srcPath "/german/ParadigmsGer.gf"),
("Greek", srcPath "/greek/ParadigmsGre.gf"),
("Hindi", srcPath "/hindi/ParadigmsHin.gf"),
("Icelandic", srcPath "/icelandic/ParadigmsIce.gf"),
-- ("Interlingua", srcPath "/interlingua/ParadigmsIna.gf"),
("Italian", srcPath "/italian/ParadigmsIta.gf"),
("Japanese", srcPath "/japanese/ParadigmsJpn.gf"),
("Latvian", srcPath "/latvian/ParadigmsLav.gf"),
("Maltese", srcPath "/maltese/ParadigmsMlt.gf"),
("Mongolian", srcPath "/mongolian/ParadigmsMon.gf"),
("Nepali", srcPath "/nepali/ParadigmsNep.gf"),
("Norwegian", srcPath "/norwegian/ParadigmsNor.gf"),
("Nynorsk", srcPath "/nynorsk/ParadigmsNno.gf"),
("Polish", srcPath "/polish/ParadigmsPol.gf"),
("Punjabi", srcPath "/punjabi/ParadigmsPnb.gf"),
("Portuguese", srcPath "/portuguese/ParadigmsPor.gf"),
("Romanian", srcPath "/romanian/ParadigmsRon.gf"),
("Russian", srcPath "/russian/ParadigmsRus.gf"),
("Sindhi", srcPath "/sindhi/ParadigmsSnd.gf"),
("Spanish", srcPath "/spanish/ParadigmsSpa.gf"),
("Swedish", srcPath "/swedish/ParadigmsSwe.gf"),
("Thai", srcPath "/thai/ParadigmsTha.gf"),
("Urdu", srcPath "/urdu/ParadigmsUrd.gf")
]
commonAPI = srcPath "abstract/Common.gf"
catAPI = srcPath "abstract/Cat.gf"
syntaxAPI = srcPath "api/Constructors.gf"
structuralAPI = srcPath "abstract/Structural.gf"
paradigmFiles :: IO [(String,FilePath)]
paradigmFiles = do
langs <- loadLangsFrom (".." </> configFile)
return $
[ (name, srcPath $ printf "%s/Paradigms%s.gf" (langDir lang) (langCode lang))
| lang <- langs
, langSynopsis lang
, let name = formatName (langDir lang)
]
-- | Format language name from directory name
-- "ancient_greek -> Ancient Greek"
formatName :: String -> String
formatName = unwords . map (\(s:ss) -> toUpper s : ss) . splitOn (=='_')
-- | Split a string at given character, similar to words
splitOn :: (Char -> Bool) -> String -> [String]
splitOn _ "" = []
splitOn f s = takeWhile (not.f) s : splitOn f rest
where
rest = case dropWhile (not.f) s of
"" -> []
_:xs -> xs
append s = appendFile synopsis ('\n':s)
title s = append $ "=" ++ s ++ "="
@@ -339,7 +333,7 @@ showTyp cs = unwords . map f . words
-- to work around GHC 6.12 file input
readFileC cod file = do
let tmp = file ++ ".tmp"
let tmp = file <.> "tmp"
case cod of
"utf8" -> readFile file
_ -> do

View File

@@ -1,53 +0,0 @@
<map id="categories" name="categories">
<area shape="poly" href="#Text" title="Text" alt="" coords="690,23 688,17 685,12 679,8 672,5 664,4 656,5 649,8 643,12 640,17 638,23 640,29 643,34 649,38 656,41 664,42 672,41 679,38 685,34 688,29"/>
<area shape="poly" href="#Punct" title="Punct" alt="" coords="657,95 656,89 652,84 646,80 638,77 629,76 620,77 612,80 606,84 602,89 600,95 602,101 606,106 612,110 620,113 629,114 638,113 646,110 652,106 656,101"/>
<area shape="poly" href="#Phr" title="Phr" alt="" coords="726,95 725,89 721,84 715,80 708,77 700,76 692,77 685,80 679,84 676,89 675,95 676,101 679,106 685,110 692,113 700,114 708,113 715,110 721,106 725,101"/>
<area shape="poly" href="#PConj" title="PConj" alt="" coords="658,167 656,162 652,156 645,152 637,150 628,149 619,150 610,152 604,156 600,162 598,167 600,173 604,179 610,183 619,185 628,186 637,185 645,183 652,179 656,173"/>
<area shape="poly" href="#Utt" title="Utt" alt="" coords="726,167 725,162 721,156 715,152 708,150 700,149 692,150 685,152 679,156 676,162 675,167 676,173 679,179 685,183 692,185 700,186 708,185 715,183 721,179 725,173"/>
<area shape="poly" href="#Voc" title="Voc" alt="" coords="794,167 793,162 789,156 784,152 777,150 769,149 761,150 754,152 748,156 744,162 743,167 744,173 748,179 754,183 761,185 769,186 777,185 784,183 789,179 793,173"/>
<area shape="poly" href="#Imp" title="Imp" alt="" coords="657,240 656,234 652,229 647,225 640,222 632,221 624,222 617,225 611,229 607,234 606,240 607,246 611,251 617,255 624,258 632,259 640,258 647,255 652,251 656,246"/>
<area shape="poly" href="#S" title="S" alt="" coords="726,240 725,234 721,229 715,225 708,223 700,222 692,223 685,225 679,229 676,234 675,240 676,245 679,250 685,254 692,257 700,258 708,257 715,254 721,250 725,245"/>
<area shape="poly" href="#QS" title="QS" alt="" coords="870,240 868,234 865,229 859,225 852,222 844,221 836,222 829,225 823,229 819,234 818,240 819,246 823,251 829,255 836,258 844,259 852,258 859,255 865,251 868,246"/>
<area shape="poly" href="#Tense" title="Tense" alt="" coords="521,312 519,306 515,301 509,297 501,294 492,293 483,294 475,297 469,301 464,306 463,312 464,318 469,323 475,327 483,330 492,331 501,330 509,327 515,323 519,318"/>
<area shape="poly" href="#Ant" title="Ant" alt="" coords="589,312 588,306 584,301 578,297 571,294 563,293 555,294 548,297 542,301 539,306 538,312 539,318 542,323 548,327 555,330 563,331 571,330 578,327 584,323 588,318"/>
<area shape="poly" href="#Pol" title="Pol" alt="" coords="657,312 656,306 652,301 647,297 640,294 632,293 624,294 617,297 611,301 607,306 606,312 607,318 611,323 617,327 624,330 632,331 640,330 647,327 652,323 656,318"/>
<area shape="poly" href="#Cl" title="Cl" alt="" coords="726,312 725,306 721,301 715,297 708,294 700,293 692,294 685,297 679,301 676,306 675,312 676,318 679,323 685,327 692,330 700,331 708,330 715,327 721,323 725,318"/>
<area shape="poly" href="#ListS" title="ListS" alt="" coords="798,312 797,306 793,301 787,297 779,294 771,293 762,294 754,297 748,301 745,306 743,312 745,318 748,323 754,327 762,330 771,331 779,330 787,327 793,323 797,318"/>
<area shape="poly" href="#Conj" title="Conj" alt="" coords="867,312 866,306 862,301 856,297 849,294 841,293 833,294 826,297 820,301 816,306 815,312 816,318 820,323 826,327 833,330 841,331 849,330 856,327 862,323 866,318"/>
<area shape="poly" href="#QCl" title="QCl" alt="" coords="945,312 943,306 940,301 934,297 927,294 919,293 911,294 904,297 898,301 895,306 893,312 895,318 898,323 904,327 911,330 919,331 927,330 934,327 940,323 943,318"/>
<area shape="poly" href="#NP" title="NP" alt="" coords="270,384 269,379 265,373 260,369 252,366 244,366 237,366 229,369 224,373 220,379 219,384 220,390 224,395 229,400 237,402 244,403 252,402 260,400 265,395 269,390"/>
<area shape="poly" href="#VP" title="VP" alt="" coords="636,384 634,379 631,373 625,369 618,366 610,366 602,366 595,369 589,373 585,379 584,384 585,390 589,395 595,400 602,402 610,403 618,402 625,400 631,395 634,390"/>
<area shape="rect" href="#Adv" title="Adv" alt="" coords="702,367,753,401"/>
<area shape="poly" href="#Predet" title="Predet" alt="" coords="65,457 63,451 59,446 52,441 44,439 34,438 25,439 16,441 10,446 5,451 4,457 5,462 10,468 16,472 25,475 34,475 44,475 52,472 59,468 63,462"/>
<area shape="poly" href="#Pron" title="Pron" alt="" coords="133,457 132,451 129,446 123,441 116,439 108,438 99,439 92,441 86,446 83,451 82,457 83,462 86,468 92,472 99,475 108,475 116,475 123,472 129,468 132,462"/>
<area shape="rect" href="#PN" title="PN" alt="" coords="150,440,202,474"/>
<area shape="poly" href="#Det" title="Det" alt="" coords="270,457 269,451 265,446 260,441 252,439 244,438 237,439 229,441 224,446 220,451 219,457 220,462 224,468 229,472 237,475 244,475 252,475 260,472 265,468 269,462"/>
<area shape="poly" href="#CN" title="CN" alt="" coords="339,457 337,451 334,446 328,441 321,439 313,438 305,439 298,441 292,446 289,451 287,457 289,462 292,468 298,472 305,475 313,475 321,475 328,472 334,468 337,462"/>
<area shape="poly" href="#ListNP" title="ListNP" alt="" coords="420,457 419,451 414,446 407,441 398,439 388,438 378,439 369,441 362,446 358,451 356,457 358,462 362,468 369,472 378,475 388,475 398,475 407,472 414,468 419,462"/>
<area shape="poly" href="#AdV" title="AdV" alt="" coords="489,457 488,451 484,446 479,441 471,439 463,438 455,439 448,441 442,446 439,451 437,457 439,462 442,468 448,472 455,475 463,475 471,475 479,472 484,468 488,462"/>
<area shape="rect" href="#V" title="V,V2,V3,V*,V2*" alt="" coords="506,440,616,474"/>
<area shape="poly" href="#AP" title="AP" alt="" coords="685,457 684,451 680,446 674,441 667,439 659,438 651,439 644,441 639,446 635,451 634,457 635,462 639,468 644,472 651,475 659,475 667,475 674,472 680,468 684,462"/>
<area shape="poly" href="#Subj" title="Subj" alt="" coords="753,457 752,451 749,446 743,441 736,439 728,438 720,439 713,441 707,446 703,451 702,457 703,462 707,468 713,472 720,475 728,475 736,475 743,472 749,468 752,462"/>
<area shape="poly" href="#ListAdj" title="ListAdj" alt="" coords="837,457 836,451 831,446 824,441 814,439 804,438 794,439 784,441 777,446 772,451 770,457 772,462 777,468 784,472 794,475 804,475 814,475 824,472 831,468 836,462"/>
<area shape="poly" href="#Art" title="Art" alt="" coords="90,529 89,523 85,518 80,514 73,511 65,510 57,511 50,514 44,518 40,523 39,529 40,535 44,540 50,544 57,547 65,548 73,547 80,544 85,540 89,535"/>
<area shape="poly" href="#Quant" title="Quant" alt="" coords="166,529 165,523 161,518 154,514 146,511 137,510 128,511 120,514 113,518 109,523 108,529 109,535 113,540 120,544 128,547 137,548 146,547 154,544 161,540 165,535"/>
<area shape="poly" href="#Num" title="Num" alt="" coords="237,529 235,523 232,518 226,514 218,511 210,510 202,511 195,514 189,518 185,523 184,529 185,535 189,540 195,544 202,547 210,548 218,547 226,544 232,540 235,535"/>
<area shape="poly" href="#Ord" title="Ord" alt="" coords="305,529 304,523 300,518 295,514 288,511 280,510 272,511 265,514 259,518 255,523 254,529 255,535 259,540 265,544 272,547 280,548 288,547 295,544 300,540 304,535"/>
<area shape="rect" href="#N" title="N,N2,N3" alt="" coords="323,512,387,546"/>
<area shape="poly" href="#RS" title="RS" alt="" coords="456,529 454,523 451,518 445,514 438,511 430,510 422,511 415,514 409,518 406,523 404,529 406,535 409,540 415,544 422,547 430,548 438,547 445,544 451,540 454,535"/>
<area shape="poly" href="#Card" title="Card" alt="" coords="236,601 235,595 231,590 226,586 218,583 210,582 202,583 195,586 189,590 186,595 184,601 186,607 189,612 195,616 202,619 210,620 218,619 226,616 231,612 235,607"/>
<area shape="poly" href="#Numeral" title="Numeral,Digits" alt="" coords="216,674 214,668 206,662 194,658 179,656 162,655 145,656 130,658 118,662 110,668 107,674 110,679 118,685 130,689 145,691 162,692 179,691 194,689 206,685 214,679"/>
<area shape="poly" href="#AdN" title="AdN" alt="" coords="285,674 283,668 280,662 274,658 267,656 259,655 251,656 244,658 238,662 234,668 233,674 234,679 238,685 244,689 251,691 259,692 267,691 274,689 280,685 283,679"/>
<area shape="poly" href="#CAdv" title="CAdv" alt="" coords="288,746 286,740 282,735 276,731 268,728 259,727 250,728 242,731 235,735 231,740 230,746 231,752 235,757 242,761 250,764 259,765 268,764 276,761 282,757 286,752"/>
<area shape="poly" href="#RCl" title="RCl" alt="" coords="456,601 454,595 451,590 445,586 438,583 430,582 422,583 415,586 409,590 406,595 404,601 406,607 409,612 415,616 422,619 430,620 438,619 445,616 451,612 454,607"/>
<area shape="poly" href="#AdA" title="AdA" alt="" coords="617,529 615,523 612,518 606,514 599,511 591,510 583,511 576,514 570,518 566,523 565,529 566,535 570,540 576,544 583,547 591,548 599,547 606,544 612,540 615,535"/>
<area shape="rect" href="#A" title="A, A2" alt="" coords="634,512,685,546"/>
<area shape="poly" href="#ListAP" title="ListAP" alt="" coords="767,529 765,523 760,518 753,514 744,511 734,510 725,511 716,514 708,518 704,523 702,529 704,535 708,540 716,544 725,547 734,548 744,547 753,544 760,540 765,535"/>
<area shape="poly" href="#IP" title="IP" alt="" coords="895,384 894,379 890,373 885,369 877,366 870,366 862,366 854,369 849,373 845,379 844,384 845,390 849,395 854,400 862,402 870,403 877,402 885,400 890,395 894,390"/>
<area shape="poly" href="#IAdv" title="IAdv" alt="" coords="966,384 965,379 961,373 955,369 947,366 939,366 931,366 923,369 917,373 913,379 912,384 913,390 917,395 923,400 931,402 939,403 947,402 955,400 961,395 965,390"/>
<area shape="poly" href="#ClSlash" title="ClSlash" alt="" coords="1050,384 1048,379 1043,373 1036,369 1026,366 1016,366 1006,366 996,369 989,373 984,379 982,384 984,390 989,395 996,400 1006,402 1016,403 1026,402 1036,400 1043,395 1048,390"/>
<area shape="poly" href="#IDet" title="IDet" alt="" coords="906,457 904,451 901,446 895,441 888,439 880,438 872,439 865,441 859,446 856,451 854,457 856,462 859,468 865,472 872,475 880,475 888,475 895,472 901,468 904,462"/>
<area shape="poly" href="#VPSlash" title="VPSlash" alt="" coords="1052,457 1050,451 1045,446 1037,441 1027,439 1016,438 1005,439 995,441 987,446 982,451 980,457 982,462 987,468 995,472 1005,475 1016,475 1027,475 1037,472 1045,468 1050,462"/>
<area shape="poly" href="#IQuant" title="IQuant" alt="" coords="912,529 910,523 906,518 899,514 890,511 880,510 870,511 861,514 854,518 850,523 848,529 850,535 854,540 861,544 870,547 880,548 890,547 899,544 906,540 910,535"/>
<area shape="poly" href="#RP" title="RP" alt="" coords="456,674 454,668 451,662 445,658 438,656 430,655 422,656 415,658 409,662 406,668 404,674 406,679 409,685 415,689 422,691 430,692 438,691 445,689 451,685 454,679"/>
</map>

View File

@@ -1,35 +0,0 @@
Afrikaans
Amharic
Arabic
Bulgarian
Catalan
Chinese
Danish
Dutch
English
Finnish
French
German
Greek
Hebrew
Hindi
Interlingua
Japanese
Italian
Latin
Latvian
<li>Maltese
Nepali
Norwegian
Persian
Polish
Punjabi
Romanian
Russian
Sindhi
Spanish
Swahili
Swedish
Thai
Turkish
Urdu

View File

@@ -1,45 +1,45 @@
Code,Directory,Functor,Unlexer,Present,All,Try,Symbolic,Compatibility
Afr,afrikaans,,,,,,n,
Amh,amharic,,,,,n,n,
Ara,arabic,,,,,,y,
Eus,basque,,,,,,,
Bul,bulgarian,,,y,,,,
Cat,catalan,Romance,,y,,,,y
Chi,chinese,,,,,,,
Dan,danish,Scand,,y,,,,
Dut,dutch,,,y,,,,
Eng,english,,,y,,,,y
Est,estonian,,,,,,,
Fin,finnish,,,y,,,,y
Fre,french,Romance,,y,,,,y
Grc,ancient_greek,,,y,,n,n,
Gre,greek,,,,,,,
Heb,hebrew,,,,,n,n,
Hin,hindi,Hindustani,to_devanagari,y,,,,
Hun,hungarian,,,y,n,n,n,
Ger,german,,,,,,,
Ice,icelandic,,,,,,n,
Ina,interlingua,,,y,,n,n,
Ita,italian,Romance,,y,,,,y
Jpn,japanese,,,,,,,
Lat,latin,,,y,,n,n,
Lav,latvian,,,,,,,y
Mlt,maltese,,,,,,,
Mon,mongolian,,,,,,n,
Nep,nepali,,,,,,n,
Nor,norwegian,Scand,,y,,,,
Nno,nynorsk,,,y,,,,
Pes,persian,,,,,,,
Pol,polish,,,,,,,
Por,portuguese,Romance,,y,,,,y
Pnb,punjabi,,,y,,,,
Ron,romanian,,,y,,,,
Rus,russian,,,y,,,,
Snd,sindhi,,,,,,,
Spa,spanish,Romance,,y,,,,y
Swa,swahili,,,,n,n,n,y
Swe,swedish,Scand,,y,,,,y
Tel,telugu,,,y,n,n,n,
Tha,thai,,to_thai,,,,,
Tur,turkish,,,,,n,n,
Urd,urdu,Hindustani,,,,,,
Code,Name,Directory,Functor,Unlexer,Present,All,Try,Symbolic,Compatibility,Synopsis
Afr,Afrikaans,afrikaans,,,,,,n,,y
Amh,Amharic,amharic,,,,,n,n,,n
Ara,Arabic,arabic,,,,,,y,,y
Bul,Bulgarian,bulgarian,,,y,,,,,y
Cat,Catalan,catalan,Romance,,y,,,,y,y
Chi,Chinese (simplified),chinese,,,,,,,,y
Dan,Danish,danish,Scand,,y,,,,,y
Dut,Dutch,dutch,,,y,,,,,y
Eng,English,english,,,y,,,,y,y
Est,Estonian,estonian,,,,,,,,y
Eus,Basque,basque,,,,,,,,y
Fin,Finnish,finnish,,,y,,,,y,y
Fre,French,french,Romance,,y,,,,y,y
Ger,German,german,,,,,,,,y
Grc,Ancient Greek,ancient_greek,,,y,,n,n,,n
Gre,Greek,greek,,,,,,,,y
Heb,Hebrew,hebrew,,,,,n,n,,n
Hin,Hindi,hindi,Hindustani,to_devanagari,y,,,,,y
Hun,Hungarian,hungarian,,,y,n,n,n,,n
Ice,Icelandic,icelandic,,,,,,n,,y
Ina,Interlingua,interlingua,,,y,,n,n,,n
Ita,Italian,italian,Romance,,y,,,,y,y
Jpn,Japanese,japanese,,,,,,,,y
Lat,Latin,latin,,,y,,n,n,,n
Lav,Latvian,latvian,,,,,,,y,y
Mlt,Maltese,maltese,,,,,,,,y
Mon,Mongolian,mongolian,,,,,,n,,y
Nep,Nepali,nepali,,,,,,n,,y
Nno,Norwegian (nynorsk),nynorsk,,,y,,,,,y
Nor,Norwegian (bokmål),norwegian,Scand,,y,,,,,y
Pes,Persian,persian,,,,,,,,y
Pnb,Punjabi,punjabi,,,y,,,,,y
Pol,Polish,polish,,,,,,,,y
Por,Portuguese,portuguese,Romance,,y,,,,y,y
Ron,Pomanian,romanian,,,y,,,,,y
Rus,Russian,russian,,,y,,,,,y
Snd,Sindhi,sindhi,,,,,,,,y
Spa,Spanish,spanish,Romance,,y,,,,y,y
Swa,Swahili,swahili,,,,n,n,n,y,n
Swe,Swedish,swedish,Scand,,y,,,,y,y
Tel,Telugu,telugu,,,y,n,n,n,,n
Tha,Thai,thai,,to_thai,,,,,,y
Tur,Turkish,turkish,,,,,n,n,,n
Urd,Urdu,urdu,Hindustani,,,,,,,y
1 Code Name Directory Functor Unlexer Present All Try Symbolic Compatibility Synopsis
2 Afr Afrikaans afrikaans n y
3 Amh Amharic amharic n n n
4 Ara Arabic arabic y y
5 Eus Bul Bulgarian basque bulgarian y y
6 Bul Cat Catalan bulgarian catalan Romance y y y
7 Cat Chi Chinese (simplified) catalan chinese Romance y y y
8 Chi Dan Danish chinese danish Scand y y
9 Dan Dut Dutch danish dutch Scand y y
10 Dut Eng English dutch english y y y
11 Eng Est Estonian english estonian y y y
12 Est Eus Basque estonian basque y
13 Fin Finnish finnish y y y
14 Fre French french Romance y y y
15 Grc Ger German ancient_greek german y n n y
16 Gre Grc Ancient Greek greek ancient_greek y n n n
17 Heb Gre Greek hebrew greek n n y
18 Hin Heb Hebrew hindi hebrew Hindustani to_devanagari y n n n
19 Hun Hin Hindi hungarian hindi Hindustani to_devanagari y n n n y
20 Ger Hun Hungarian german hungarian y n n n n
21 Ice Icelandic icelandic n y
22 Ina Interlingua interlingua y n n n
23 Ita Italian italian Romance y y y
24 Jpn Japanese japanese y
25 Lat Latin latin y n n n
26 Lav Latvian latvian y y
27 Mlt Maltese maltese y
28 Mon Mongolian mongolian n y
29 Nep Nepali nepali n y
30 Nor Nno Norwegian (nynorsk) norwegian nynorsk Scand y y
31 Nno Nor Norwegian (bokmål) nynorsk norwegian Scand y y
32 Pes Persian persian y
33 Pol Pnb Punjabi polish punjabi y y
34 Por Pol Polish portuguese polish Romance y y y
35 Pnb Por Portuguese punjabi portuguese Romance y y y
36 Ron Pomanian romanian y y
37 Rus Russian russian y y
38 Snd Sindhi sindhi y
39 Spa Spanish spanish Romance y y y
40 Swa Swahili swahili n n n y n
41 Swe Swedish swedish Scand y y y
42 Tel Telugu telugu y n n n n
43 Tha Thai thai to_thai y
44 Tur Turkish turkish n n n
45 Urd Urdu urdu Hindustani y

View File

@@ -1,7 +1,7 @@
--1 Common: Structures with Common Implementations.
-- This module defines the categories that uniformly have the
-- linearization type ${s:Str}$ in all languages.
-- This module defines the categories that uniformly have the same
-- linearization type (usually ${s:Str}$) in all languages.
abstract Common = {

View File

@@ -78,7 +78,8 @@ cat
Year ;
fun
timeunitAdv : Card -> Timeunit -> Adv ; -- (for) three hours
timeunitAdv : Card -> Timeunit -> Adv ; -- (for) three hours
timeunitRange : Card -> Card -> Timeunit -> Adv ; -- (cats live) ten to twenty years
oneHour : Hour ;
twoHour : Hour ;
@@ -105,8 +106,8 @@ fun
twentyThreeHour : Hour ;
twentyFourHour : Hour ;
timeHour : Hour -> Adv ; -- at three (o'clock / am / pm)
timeHourMinute : Hour -> Card -> Adv ; -- at forty past six
timeHour : Hour -> Adv ; -- at three a.m./p.m.
timeHourMinute : Hour -> Card -> Adv ; -- at six forty a.m./p.m.
weekdayPunctualAdv : Weekday -> Adv ; -- on Monday
weekdayHabitualAdv : Weekday -> Adv ; -- on Mondays

View File

@@ -70,7 +70,7 @@ abstract Sentence = Cat ** {
-- This covers subjunctive clauses, but they can also be added to the end.
SSubjS : S -> Subj -> S -> S ; -- I go home if she comes
SSubjS : S -> Subj -> S -> S ; -- I go home, if she comes
-- A sentence can be modified by a relative clause referring to its contents.

View File

@@ -21,7 +21,7 @@ concrete AdjectiveAra of Adjective = CatAra ** open ResAra, Prelude in {
-- $SuperlA$ belongs to determiner syntax in $Noun$.
--
ComplA2 a np = {
s = \\sp,g,n,st,c => a.s ! APosit g n st c ++ a.c2 ++ np.s ! Gen ;
s = \\sp,g,n,st,c => a.s ! APosit g n st c ++ a.c2.s ++ np.s ! a.c2.c ;
} ;
--
-- ReflA2 a = {
@@ -37,7 +37,13 @@ concrete AdjectiveAra of Adjective = CatAra ** open ResAra, Prelude in {
AdAP ada ap = {
s = \\sp,g,n,st,c => ada.s ++ ap.s ! sp ! g ! n ! st ! c
} ;
--
-- UseA2 a = a ;
--
UseA2 = PositA ;
UseComparA a = {
s = \\h,g,n,d,c => a.s ! AComp d c
};
-- : Ord -> AP ; -- warmest
AdjOrd ord = {s = \\h,g,n,s,c => ord.s ! g ! s ! c} ;
}

View File

@@ -2,21 +2,24 @@ concrete AdverbAra of Adverb = CatAra ** open ResAra, Prelude in {
flags coding=utf8;
lin
PositAdvAdj a = {s = a.s ! APosit Masc Sg Indef Acc} ;
-- ComparAdvAdj cadv a np = {
-- s = cadv.s ++ a.s ! AAdv ++ "مِنْ" ++ np.s ! Gen
-- } ;
-- ComparAdvAdjS cadv a s = {
-- s = cadv.s ++ a.s ! AAdv ++ "تهَن" ++ s.s
-- } ;
-- ComparAdvAdj cadv a np = {
-- s = cadv.s ++ a.s ! AAdv ++ "مِنْ" ++ np.s ! Gen
-- } ;
-- ComparAdvAdjS cadv a s = {
-- s = cadv.s ++ a.s ! AAdv ++ "مِنْ" ++ s.s
-- } ;
PrepNP prep np = {s = prep.s ++ np.s ! Gen} ;
PrepNP prep np = {s = prep.s ++ np.s ! prep.c} ;
AdAdv ad av = cc2 av ad ;
-- : Subj -> S -> Adv ; -- when she sleeps
SubjS subj s = {s = subj.s ++ s.s ! subj.o} ;
-- AdAdv = cc2 ;
--
-- SubjS = cc2 ;
-- AdvSC s = s ; --- this rule give stack overflow in ordinary parsing
--
-- AdnCAdv cadv = {s = cadv.s ++ "تهَن"} ;
--
AdnCAdv cadv = {s = cadv.s ++ "مِنْ"} ;
}

View File

@@ -1,3 +1,3 @@
--# -path=.:../abstract:../common:../prelude
--# -path=.:../abstract:../common:../api:../prelude
concrete AllAra of AllAraAbs = LangAra ;

View File

@@ -10,35 +10,35 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in {
-- Tensed/Untensed
S = {s : Str} ;
SSlash,
S = {s : Order => Str} ; -- subordinate clause has nominal word order and subject in acc
QS = {s : QForm => Str} ;
-- RS = {s : Agr => Str} ;
RS = {s : Agr => Case => Str} ; -- case because the relative pronoun inflects in case
-- Sentence
Cl = ResAra.Cl ; -- {s : ResAra.Tense => Polarity => Order => Str} ;
Cl = ResAra.Cl ; -- {s : Tense => Polarity => Order => Str} ;
ClSlash = ResAra.ClSlash ;
Imp = {s : Polarity => Gender => ResAra.Number => Str} ;
-- Question
QCl = ResAra.QCl ; -- {s : ResAra.Tense => Polarity => QForm => Str} ;
IP,
IDet,
IComp = ResAra.IP ; -- {s : Gender => State => Case => Str ; n : ResAra.Number} ;
-- IAdv = {s : Str} ;
QCl = ResAra.QCl ; -- {s : Tense => Polarity => QForm => Str} ;
IDet = ResAra.IDet ; -- {s : Gender => State => Case => Str ; n : Number} ;
IP = ResAra.IP ; -- {s : (isPred : Bool) => State => Case => Str ; n : Number} ;
IComp = ResAra.IComp ; --
IQuant = {s : State => Case => Str} ;
--
---- Relative
--
-- RCl = {s : Tense => Anteriority => Polarity => Agr => Str} ;
-- RP = {s : Case => Str ; a : RAgr} ;
--
-- Relative
RCl = ResAra.RCl ;
RP = ResAra.RP ;
-- Verb
VP = ResAra.VP ;
VPSlash = ResAra.VPSlash ; -- VP ** {c2:Str}
Comp = ResAra.Comp ; --{s : AAgr => Case => Str} ;
VPSlash = ResAra.VPSlash ; -- VP ** {c2:Preposition}
Comp = ResAra.Comp ** {obj : Obj ; isNP : Bool} ;
-- SC = {s : Str} ;
--
-- Adjective
@@ -72,26 +72,30 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in {
Conj = {s : Str ; n : ResAra.Number} ;
-- DConj = {s1,s2 : Str ; n : ResAra.Number} ;
-- Subj = {s : Str} ;
Prep = {s : Str} ;
Subj = {s : Str ; o : Order} ;
Prep = ResAra.Preposition ;
-- Open lexical classes, e.g. Lexicon
V, VS, VQ, VA = ResAra.Verb ; -- = {s : VForm => Str} ;
V2, V2A = ResAra.Verb ** {c2 : Str} ;
VV, V2V, V2S, V2Q = ResAra.Verb ** {c2 : Str} ; --- AR
V3 = ResAra.Verb ** {c2, c3 : Str} ;
V2, V2A = ResAra.Verb2 ;
VV = ResAra.Verb2 ** {sc : Preposition} ; -- c2 is for verb
V2S, V2Q = ResAra.Verb2 ;
V3 = ResAra.Verb3 ;
V2V = ResAra.Verb3 ** {sc : Preposition} ; -- c3 is for verb, c2 is for dir.obj
A = ResAra.Adj ;
A2 = ResAra.Adj ** {c2 : Str} ;
A2 = ResAra.Adj2 ;
N = ResAra.Noun ;
N2 = ResAra.Noun ** {c2 : Str} ;
N3 = ResAra.Noun ** {c2, c3 : Str} ;
N2 = ResAra.Noun2 ;
N3 = ResAra.Noun3 ;
PN = {s : Case => Str; g : Gender; h : Species} ;
linref
CN = \cn -> uttCN cn ! Masc ;
N = \n -> uttCN (useN n) ! Masc ;
VP = \vp -> uttVP vp ! Masc ;
}

View File

@@ -1,45 +1,82 @@
concrete ConjunctionAra of Conjunction =
CatAra ** open ResAra, Coordination, Prelude in {
--
-- flags optimize=all_subs ;
--
-- lin
--
-- ConjS = conjunctSS ;
-- DConjS = conjunctDistrSS ;
--
-- ConjAdv = conjunctSS ;
-- DConjAdv = conjunctDistrSS ;
--
-- ConjNP conj ss = conjunctTable Case conj ss ** {
-- a = {n = conjNumber conj.n ss.a.n ; p = ss.a.p}
-- } ;
-- DConjNP conj ss = conjunctDistrTable Case conj ss ** {
-- a = {n = conjNumber conj.n ss.a.n ; p = ss.a.p}
-- } ;
--
-- ConjAP conj ss = conjunctTable Agr conj ss ** {
-- isPre = ss.isPre
-- } ;
-- DConjAP conj ss = conjunctDistrTable Agr conj ss ** {
-- isPre = ss.isPre
-- } ;
--
---- These fun's are generated from the list cat's.
--
-- BaseS = twoSS ;
-- ConsS = consrSS comma ;
-- BaseAdv = twoSS ;
-- ConsAdv = consrSS comma ;
-- BaseNP x y = twoTable Case x y ** {a = conjAgr x.a y.a} ;
-- ConsNP xs x = consrTable Case comma xs x ** {a = conjAgr xs.a x.a} ;
-- BaseAP x y = twoTable Agr x y ** {isPre = andB x.isPre y.isPre} ;
-- ConsAP xs x = consrTable Agr comma xs x ** {isPre = andB xs.isPre x.isPre} ;
--
-- lincat
-- [S] = {s1,s2 : Str} ;
-- [Adv] = {s1,s2 : Str} ;
-- [NP] = {s1,s2 : Case => Str ; a : Agr} ;
-- [AP] = {s1,s2 : Agr => Str ; isPre : Bool} ;
--
lincat
[S] = {s1,s2 : Order => Str} ;
[Adv] = {s1,s2 : Str} ;
[NP] = {s1,s2 : Case => Str ; a : Agr ; empty : Str} ;
[AP] = {s1,s2 : Species => Gender => Number => State => Case => Str} ;
lin
BaseAdv = twoSS ;
ConsAdv = consrSS comma ;
ConjAdv = conjunctSS ;
BaseS = twoTable Order ;
ConsS = consrTable Order comma ;
ConjS = conjunctTable Order ;
BaseNP x y = twoTable Case x y ** {
a = conjAgr x.a y.a ;
empty = []
} ;
ConsNP xs x = consrTable Case comma xs x ** {
a = conjAgr xs.a x.a ;
empty = []
} ;
ConjNP conj ss = conjunctTable Case conj ss ** {
a = let gn = pgn2gn ss.a.pgn in
{pgn = Per3 gn.g (conjNumber conj.n gn.n) ; isPron = False} ;
empty = []
} ;
BaseAP = twoTable5 Species Gender Number State Case ;
ConsAP = consrTable5 Species Gender Number State Case comma ;
ConjAP = conjunctTable5 Species Gender Number State Case ;
oper
conjAgr : Agr -> Agr -> Agr = \a,b -> {
isPron = False ;
pgn = let gnA = pgn2gn a.pgn ; gnB = pgn2gn b.pgn in
Per3 (conjGender gnA.g gnB.g) (conjNumber gnA.n gnB.n)
} ;
conjGender : Gender -> Gender -> Gender = \g,h ->
case g of {Fem => h ; _ => Masc} ;
conjNumber : Number -> Number -> Number = \m,n ->
case m of {Sg => n ; _ => Pl} ;
-- move to predef?
ListTable5 : PType -> PType -> PType -> PType -> PType -> Type = \P,Q,R,T,S ->
{s1,s2 : P => Q => R => T => S => Str} ;
twoTable5 : (P,Q,R,T,S : PType) -> (_,_ : {s : P => Q => R => T => S => Str}) ->
ListTable5 P Q R T S =
\_,_,_,_,_,x,y ->
{s1 = x.s ; s2 = y.s} ;
consrTable5 :
(P,Q,R,T,S : PType) -> Str -> {s : P => Q => R => T => S => Str} ->
ListTable5 P Q R T S -> ListTable5 P Q R T S =
\P,Q,R,T,S,c,x,xs ->
{s1 = \\p,q,r,t,s => xs.s1 ! p ! q ! r ! t ! s ++ c ++ xs.s2 ! p ! q ! r ! t ! s ;
s2 = x.s
} ;
conjunctTable5 :
(P,Q,R,T,S : PType) -> Conjunction -> ListTable5 P Q R T S -> {s : P => Q => R => T => S => Str} =
\P,Q,R,T,S,or,xs ->
{s = \\p,q,r,t,s => xs.s1 ! p ! q ! r ! t ! s ++ or.s ++ xs.s2 ! p ! q ! r ! t ! s} ;
-- conjunctDistrTable5 :
-- (P,Q,R,T,S : PType) -> ConjunctionDistr -> ListTable5 P Q R T S ->
-- {s : P => Q => R => T => S => Str} =
-- \P,Q,R,T,S,or,xs ->
-- {s = \\p,q,r,t,s => or.s1++ xs.s1 ! p ! q ! r ! t ! s ++ or.s2 ++ xs.s2 ! p ! q ! r ! t ! s} ;
}

View File

@@ -0,0 +1,156 @@
concrete ConstructionAra of Construction = CatAra ** open
Prelude,
ParadigmsAra,
SyntaxAra,
SymbolicAra,
StructuralAra,
(E=ExtendAra),
(R=ResAra),
(L=LexiconAra) in {
lincat
Timeunit = N ;
Weekday = N ;
Monthday = NP ;
Month = N ;
Year = NP ;
lin
timeunitAdv n time =
let n_card : Card = n ;
n_hours_NP : NP = mkNP n_card time ;
in SyntaxAra.mkAdv during_Prep n_hours_NP | ParadigmsAra.mkAdv (n_hours_NP.s ! R.Nom) ;
-- random guesses
weekdayPunctualAdv w = SyntaxAra.mkAdv on_Prep (mkNP w) ; -- on Sunday
weekdayHabitualAdv w = SyntaxAra.mkAdv on_Prep (mkNP w) ; -- on Sundays
weekdayNextAdv w = SyntaxAra.mkAdv on_Prep (mkNP w) ; -- next Sunday
weekdayLastAdv w = SyntaxAra.mkAdv on_Prep (mkNP w) ; -- last Sunday
monthAdv m = SyntaxAra.mkAdv in_Prep (mkNP m) ;
yearAdv y = SyntaxAra.mkAdv in_Prep y ;
-- dummy
dayMonthAdv d m = SyntaxAra.mkAdv on_Prep (mkNP d) ; -- on 17 May
monthYearAdv m y = SyntaxAra.mkAdv on_Prep (mkNP m) ; -- in May 2012
dayMonthYearAdv d m y = SyntaxAra.mkAdv on_Prep y ; -- on 17 May 2013
intYear = symb ;
intMonthday = symb ;
-- n_units_AP
oper
-- hack used in the name constructions
toNP : Bool -> NP -> NP = \b -> if_then_else NP b R.emptyNP ;
lin
-- : NP -> NP -> Cl
have_name_Cl np nm =
let subjPron : Pron = R.np2pron np ;
me : NP = toNP np.a.isPron np ;
myName : NP = E.ApposNP me (mkNP (mkDet subjPron) L.name_N) ;
in mkCl myName nm ;
-- : NP -> QCl
what_name_QCl np =
let subjPron : Pron = R.np2pron np ;
me : R.NP = toNP np.a.isPron np ;
myName : NP = E.ApposNP me (mkNP (mkDet subjPron) L.name_N) ;
what_IP : R.IP = R.mkIP "مَا هُوَ" R.Sg ;
in mkQCl what_IP myName ;
-- how_old_QCl
-- hungry_VP =
-- thirsty_VP =
lincat Language = N ;
lin InLanguage l = mkAdv in_Prep (mkNP l) ;
lin
weekdayN w = w ;
monthN m = m ;
weekdayPN w = mkPN w ;
monthPN m = mkPN m ;
languageCN l = mkCN l ;
languageNP l = mkNP l ;
oper mkLanguage : Str -> N = mkN ;
----------------------------------------------
---- lexicon of snpcial names
-- TODO in arabic
lin second_Timeunit = mkN "second" ;
lin minute_Timeunit = mkN "minute" ;
lin hour_Timeunit = mkN "hour" ;
lin day_Timeunit = mkN "day" ;
lin week_Timeunit = mkN "week" ;
lin month_Timeunit = mkN "month" ;
lin year_Timeunit = mkN "year" ;
lin monday_Weekday = mkN "Monday" ;
lin tuesday_Weekday = mkN "Tuesday" ;
lin wednesday_Weekday = mkN "Wednesday" ;
lin thursday_Weekday = mkN "Thursday" ;
lin friday_Weekday = mkN "Friday" ;
lin saturday_Weekday = mkN "Saturday" ;
lin sunday_Weekday = mkN "Sunday" ;
lin january_Month = mkN "January" ;
lin february_Month = mkN "February" ;
lin march_Month = mkN "March" ;
lin april_Month = mkN "April" ;
lin may_Month = mkN "May" ;
lin june_Month = mkN "June" ;
lin july_Month = mkN "July" ;
lin august_Month = mkN "August" ;
lin september_Month = mkN "September" ;
lin october_Month = mkN "October" ;
lin november_Month = mkN "November" ;
lin december_Month = mkN "December" ;
-- lin afrikaans_Language = mkLanguage "Afrikaans" ;
-- lin amharic_Language = mkLanguage "Amharic" ;
lin arabic_Language = mkLanguage "عَرَبِيَّة" ;
-- lin bulgarian_Language = mkLanguage "Bulgarian" ;
-- lin catalan_Language = mkLanguage "Catalan" ;
-- lin chinese_Language = mkLanguage "Chinese" ;
-- lin danish_Language = mkLanguage "Danish" ;
-- lin dutch_Language = mkLanguage "Dutch" ;
lin english_Language = mkLanguage "إنْجلِيزيْة" ;
-- lin estonian_Language = mkLanguage "Estonian" ;
lin finnish_Language = mkLanguage "فِنْلَنْدِيّة" ;
-- lin french_Language = mkLanguage "French" ;
-- lin german_Language = mkLanguage "German" ;
-- lin greek_Language = mkLanguage "Greek" ;
-- lin hebrew_Language = mkLanguage "Hebrew" ;
-- lin hindi_Language = mkLanguage "Hindi" ;
-- lin japanese_Language = mkLanguage "Japanese" ;
-- lin italian_Language = mkLanguage "Italian" ;
-- lin latin_Language = mkLanguage "Latin" ;
-- lin latvian_Language = mkLanguage "Latvian" ;
-- lin maltese_Language = mkLanguage "Maltese" ;
-- lin nepali_Language = mkLanguage "Nepali" ;
-- lin norwegian_Language = mkLanguage "Norwegian" ;
lin nprsian_Language = mkLanguage "فَارِسيّة" ;
-- lin polish_Language = mkLanguage "Polish" ;
-- lin punjabi_Language = mkLanguage "Punjabi" ;
-- lin romanian_Language = mkLanguage "Romanian" ;
-- lin russian_Language = mkLanguage "Russian" ;
-- lin sindhi_Language = mkLanguage "Sindhi" ;
-- lin spanish_Language = mkLanguage "Spanish" ;
-- lin swahili_Language = mkLanguage "Swahili" ;
lin swedish_Language = mkLanguage "سُويدِيّة" ;
-- lin thai_Language = mkLanguage "Thai" ;
-- lin turkish_Language = mkLanguage "Turkish" ;
-- lin urdu_Language = mkLanguage "Urdu" ;
}

View File

@@ -4,16 +4,56 @@ concrete ExtendAra of Extend =
CatAra ** ExtendFunctor - [
GenNP, SlashBareV2S, PredAPVP, GenModNP, ExistsNP,
StrandRelSlash, ExistPluralCN, ExistMassCN, ExistCN, EmptyRelSlash, DetNPMasc, DetNPFem,
ComplBareVS, ComplDirectVS, ComplDirectVQ
ComplBareVS, ComplDirectVS, ComplDirectVQ,
ICompAP,
VPS, MkVPS, PredVPS, BaseVPS, ConsVPS, ConjVPS,
ApposNP
]
with (Grammar=GrammarAra)
** open
ParamX,
ResAra,
Prelude,
ResAra
Coordination
in {
lin
GenNP np = { s = \\_,_,_,_ => np.s ! Gen ; d = Const ; isNum, isPron = False } ;
} ;
GenNP np = {s = \\_,_,_,_ => np.s ! Gen ; d = Const ; isNum,isPron,is1sg = False} ;
-- : NP -> NP -> NP
ApposNP np1 np2 = np2 ** {s = \\c => np1.s ! c ++ np2.s ! c} ;
-- : AP -> IComp ; -- "how old"
ICompAP ap = {s = \\gn => "كَمْ" ++ ap.s ! NoHum ! gn.g ! gn.n ! Indef ! Acc} ;
lincat
VPS = {s : PerGenNum => Str} ; -- finite VP's with tense and polarity
[VPS] = {s1,s2 : PerGenNum => Str} ;
lin
-- : Temp -> Pol -> VP -> VPS ; -- hasn't slept
MkVPS t p vp = {
s = \\pgn => let vps =
wordOrderNoSubj
Nominal -- Nominal (=SVO) generalises best for ConjVPS.
vp.obj.a.isPron
(vStr vp pgn t.t p.p)
(case <vp.isPred,vp.obj.a.isPron> of {
<False,True> => BIND ++ vp.obj.s ;
_ => vp.obj.s })
(pred vp pgn t.t p.p)
vp.s2
in vps.before ++ vps.after -- word order is SVO, so this is safe for just this case.
} ;
BaseVPS = twoTable PerGenNum ;
ConsVPS = consrTable PerGenNum comma ;
ConjVPS = conjunctTable PerGenNum ;
PredVPS np vps = {
s = \\_ => np.s ! Nom ++ vps.s ! np.a.pgn -- first quick version with order always Nominal.
} ; -- if necessary, change VPS into {s : PerGenNum => Order => {before,after : Str}}
}

View File

@@ -1,15 +1,63 @@
concrete IdiomAra of Idiom = CatAra ** open Prelude, ResAra in {
flags coding=utf8;
--
-- flags optimize=all_subs ;
--
-- lin
-- ExistNP np =
-- mkClause "تهري" (agrP3 np.a.n) (insertObj (\\_ => np.s ! Acc) (predAux auxBe)) ;
-- ImpersCl vp = mkClause "ِت" (agrP3 Sg) vp ;
-- GenericCl vp = mkClause "ْني" (agrP3 Sg) vp ;
--
-- ProgrVP vp = insertObj (\\a => vp.ad ++ vp.prp ++ vp.s2 ! a) (predAux auxBe) ;
--
}
concrete IdiomAra of Idiom = CatAra ** open
Prelude,
ResAra,
VerbAra,
ParadigmsAra
in {
lin
-- : VP -> Cl ; -- it is hot
ImpersCl vp =
let it : ResAra.NP = case vp.isPred of {
True => pron2np (pgn2pron vp.obj.a.pgn) ;
False => pgn2pron vp.obj.a.pgn } ; -- if no obj, Per3 Masc Sg chosen by default
in predVP it vp ;
-- : VP -> Cl ; -- one sleeps
GenericCl = predVP (regNP "المَرْء" Sg) ;
-- : NP -> RS -> Cl ; -- it is I who did it
--CleftNP np rs =
-- : Adv -> S -> Cl ; -- it is here she slept
CleftAdv adv s =
let comp : Comp = CompAdv (lin Adv {s = adv.s ++ s.s ! Verbal}) ; -- no idea about word order /IL
pass_V = mkV "مضي" va vi ; -- switch to copula or some other verb if better /IL
in predVP emptyNP (UseV pass_V ** {isPred=True ; pred=comp}) ; -- very hacky /IL
-- : NP -> Cl ; -- there is a house
ExistNP np =
predVP (emptyNP ** {s=\\c=>"هُنَاكَ"}) (UseComp (CompNP np)) ; -- IL
-- ExistIP : IP -> QCl ; -- which houses are there
-- 7/12/2012 generalizations of these
-- : NP -> Adv -> Cl ; -- there is a house in Paris
ExistNPAdv np adv =
predVP (emptyNP ** {s=\\c=>"هُنَاكَ"}) (AdvVP (UseComp (CompNP np)) adv) ; -- IL
-- ExistIPAdv : IP -> Adv -> QCl ; -- which houses are there in Paris
-- ProgrVP : VP -> VP ; -- be sleeping
-- ImpPl1 : VP -> Utt ; -- let's go
-- ImpP3 : NP -> VP -> Utt ; -- let John walk
-- 3/12/2013 non-reflexive uses of "self"
-- : VP -> VP ; -- is at home himself; is himself at home
SelfAdvVP,
SelfAdVVP = \vp -> vp ** {
s = \\pgn,vf => vp.s ! pgn ! vf ++ reflPron Nom pgn
} ;
-- : NP -> NP ; -- the president himself (is at home)
SelfNP np = np ** {
s = \\c => np.s ! c ++ reflPron c (np.a.pgn)
} ;
}

View File

@@ -1,8 +1,9 @@
--# -path=.:../abstract:../common:../prelude
--# -path=.:../abstract:../common:../api:../prelude
concrete LangAra of Lang =
GrammarAra,
LexiconAra
LexiconAra,
ConstructionAra
** {
flags startcat = Phr ; unlexer = text ; lexer = text ; coding = utf8 ;

View File

@@ -3,7 +3,6 @@
concrete LexiconAra of Lexicon = CatAra ** open
ParadigmsAra,
ResAra,
MorphoAra, --shouldn't open it here, only needed reg &sndf
Prelude in {
flags
@@ -19,13 +18,13 @@ flags
ask_V2Q = dirV2 (regV "يَسءَل") ;
-- ask_V2Q = dirV2 (v1 "سءل" a a) ;
baby_N = brkN "طفل" "فِعل" "أَفعَال" Masc Hum;
-- bad_A = sndA "سوء" "فَيِّع" ;
bad_A = degrA "سَيِّئ" "سَيِّئَة" "سَيِّئِين" ;
-- bad_A = sndA "سوء" "فَيِّع" ;
bad_A = degrA "سَيِّئ" "سَيِّئَة" "سَيِّئِين" ;
bank_N = brkN "بنك" "فَعل" "فُعُول" Masc NoHum ;
beautiful_A = sndA "جمل" "فَعِيل" ;
become_VA = mkVA (v4 "صبح") ;
beer_N = sdfN "بير" "فِعلة" Fem NoHum ;
beg_V2V = dirV2 (v5 "وسل") ;
beg_V2V = mkV2V (mkVV (v5 "وسل")) noPrep ;
big_A = sndA "كبر" "فَعِيل" ;
bike_N = sdfN "درج" "فَعّالة" Fem NoHum ;
bird_N = brkN "طير" "فَعل" "فُعُول" Masc NoHum;
@@ -42,11 +41,11 @@ flags
-- break_V2 = dirV2 (v1 "كسر" a u) ;
broad_A = sndA "وسع" "فاعِل" ;
brother_N2 = mkN2 (brkN "ءخو" "فَع" "فِعلة" Masc Hum) ; --FIXME dual
brown_A = sndA "بني" "فُعِّل";
brown_A = sndA "بني" "فُعِّل";
butter_N = sdfN "سبد" "فُعلة" Fem NoHum ;
buy_V2 = dirV2 (v8 "شري") ;
camera_N = sdfN "كمر" "فاعِيلا" Fem NoHum ; -- |Alö taSwIr
cap_N = sdfN "قبع" "فُعَّلة" Fem NoHum ; --qalnUsö
cap_N = sdfN "قبع" "فُعَّلة" Fem NoHum ; --qalnUsö
car_N = sdfN "سير" "فَعّالة" Fem NoHum ;
carpet_N = sdfN "سجد" "فَعّالة" Fem NoHum ;
cat_N = brkN "هرّ" "فِعّ" "فِعَلَة" Fem NoHum ;
@@ -74,7 +73,7 @@ flags
door_N = brkN "بوب" "فاع" "أَفعَال" Masc NoHum ;
drink_V2 = dirV2 (regV "شَرِب") ;
-- drink_V2 = dirV2 (v1 "شرب" i a) ;
easy_A2V = mkA2 (sndA "سهل" "فَعل") "لِ" ;
easy_A2V = mkA2 (sndA "سهل" "فَعل") liPrep ;
eat_V2 = dirV2 (mkV "ءكل" FormI) ;
empty_A = sndA "فرغ" "فاعِل" ;
enemy_N = brkN "عدو" "فَعُلّ" "أَفعَاء" Masc Hum ;
@@ -93,13 +92,13 @@ flags
girl_N = brkN "بنت" "فِعل" "فَعَال" Fem Hum ;
glove_N = sdfN "قفز" "فُعّال" Masc NoHum ;
gold_N = sdfN "ذهب" "فَعَل" Masc NoHum ;
good_A = sndA "جود" "فَيِّع" ; -- Hasan, HisAn
good_A = sndA "جود" "فَيِّع" ; -- Hasan, HisAn
go_V = regV "يَذهَب" ;
-- go_V = v1 "ذهب" a a ;
green_A = clrA "خضر" ;
harbour_N = brkN "رفء" "مَفعَل" "مَفاعِل" Masc NoHum ; --mInA', marsaY
hate_V2 = dirV2 (regV "كَرِه") ;
hat_N = sdfN "قبع" "فُعَّلة" Fem NoHum ;
hat_N = sdfN "قبع" "فُعَّلة" Fem NoHum ;
-- have_V2 = dirV2 (v1 "ملك" a i) ;
hear_V2 = dirV2 (regV "سَمِع") ;
-- hear_V2 = dirV2 (v1 "سمع" i a) ;
@@ -130,14 +129,14 @@ flags
love_N = brkN "حبّ" "فُعّ" "فُعّ" Masc NoHum ; -- no plur
love_V2 = dirV2 (v1 "حبّ" a i) ;
man_N = brkN "رجل" "فَعُل" "فِعَال" Masc Hum ;
married_A2 = mkA2 (sndA "زوج" "مُتَفَعِّل") "مِن" ;
married_A2 = mkA2 (sndA "زوج" "مُتَفَعِّل") "مِن" ;
meat_N = brkN "لحم" "فَعلة" "فُعُول" Masc NoHum ;
milk_N = brkN "حلب" "فَعِيل" "فَعِيل" Masc NoHum ; --no plur
moon_N = brkN "قمر" "فَعَل" "أَفعَال" Masc NoHum ;
mother_N2 = mkN2 (sdfN "ءم" "فُعَّ" Fem Hum) ;
mother_N2 = mkN2 (sdfN "ءم" "فُعَّ" Fem Hum) ;
mountain_N = brkN "جبل" "فَعَل" "فِعَال" Masc NoHum ;
music_N = mkN (reg "مُوسِيقَى" "مُوسِيقَى") Fem NoHum ; --no plur
narrow_A = sndA "ضيق" "فَعِّل" ;
narrow_A = sndA "ضيق" "فَعِّل" ;
new_A = mkA "جدد" "فَعِيل" "فُعُل" ;
newspaper_N = brkN "صحف" "فَعِيلة" "فُعُل" Fem NoHum ;
oil_N = brkN "زيت" "فَعل" "فُعُول" Masc NoHum ;
@@ -155,7 +154,7 @@ flags
play_V2 = dirV2 (regV "لَعِب") ;
-- play_V2 = dirV2 (v1 "لعب" i a) ;
policeman_N = sdmN "شرط" "فِعلِي" Masc Hum ;
priest_N = brkN "قسّ" "فِعِّيل" "أَفِعّة" Masc Hum ;
priest_N = brkN "قسّ" "فِعِّيل" "أَفِعّة" Masc Hum ;
probable_AS = mkAS (sndA "مكن" "مُفعِل") ;
queen_N = sdfN "ملك" "فَعِلة" Fem Hum ;
radio_N = mkN (sndf "راديُو") Masc NoHum ;
@@ -169,7 +168,7 @@ flags
river_N = brkN "نهر" "فَعل" "أَفعَال" Masc NoHum ;
rock_N = brkN "صخر" "فَعلة" "فُعُول" Fem NoHum ;
roof_N = brkN "سطح" "فَعل" "أَفعُل" Masc NoHum ;
rubber_N = brkN "مطط" "فَعَّال" "فَعَّال" Masc NoHum ; -- no hum
rubber_N = brkN "مطط" "فَعَّال" "فَعَّال" Masc NoHum ; -- no hum
run_V = regV "يَركُض" ;
-- run_V = v1 "ركض" a u ;
say_VS = mkVS (v1 "قول" a u) ; --check
@@ -187,11 +186,11 @@ flags
shoe_N = brkN "حذو" "فِعَاء" "أَفعِية" Masc NoHum ;
shop_N = brkN "تجر" "مَفعَل" "مَفاعِل" Masc NoHum ;
short_A = sndA "قصر" "فَعِيل" ;
silver_N = brkN "فضض" "فِعَّة" "فِعَل" Fem NoHum ;
silver_N = brkN "فضض" "فِعَّة" "فِعَل" Fem NoHum ;
sister_N = brkN "ءخو" "فُعت" "فَعَوَات" Fem Hum ; --FIXME
sleep_V = v1 "نوم" i a ; --check
small_A = sndA "صغر" "فَعِيل" ;
snake_N = sdfN "حيّ" "فَعَّة" Fem NoHum ;
snake_N = sdfN "حيّ" "فَعَّة" Fem NoHum ;
sock_N = brkN "جرب" "فَوعَل" "فَواعِل" Masc NoHum ;
speak_V2 = dirV2 (v5 "كلم") ;
star_N = brkN "نجم" "فَعل" "فُعُول" Masc NoHum ; --najmö
@@ -204,8 +203,8 @@ flags
switch8off_V2 = dirV2 (v4 "طفء") ;
switch8on_V2 = dirV2 (v4 "شعل") ;
table_N = sdfN "طول" "فاعِلة" Fem NoHum ;
talk_V3 = mkV3 (v5 "حدث") "لِ" "عَن" ;
teacher_N = sdmN "علم" "مُفَعِّل" Masc Hum ; --mucal~imö
talk_V3 = mkV3 (v5 "حدث") liPrep (mkPrep "عَن") ;
teacher_N = sdmN "علم" "مُفَعِّل" Masc Hum ; --mucal~imö
teach_V2 = dirV2 (v2 "علم") ;
television_N = mkN (sndf "تِلِفِزيُون") Masc NoHum ;
thick_A = sndA "سمك" "فَعِيل" ;
@@ -261,7 +260,7 @@ flags
heavy_A = sndA "ثقل" "فَعِيل" ;
near_A = sndA "قرب" "فَعِيل" ;
rotten_A = sndA "فسد" "فاعِل" ;
round_A = sndA "دور" "مُفَعَّل" ;
round_A = sndA "دور" "مُفَعَّل" ;
sharp_A = sndA "حدّ" "فاعّ" ;
smooth_A = sndA "نعم" "فاعِل" ;
straight_A = sndA "قوم" "مُستَفِيع" ;
@@ -277,7 +276,7 @@ flags
bone_N = brkN "عظم" "فَعلة" "فِعَال" Fem NoHum;
breast_N = brkN "صدر" "فَعل" "فُعُول" Masc NoHum;
cloud_N = brkN "غيم" "فَعلة" "فُعُول" Fem NoHum;
day_N = brkN "يوم" "فَعل" "أَفَّاع" Masc NoHum;
day_N = brkN "يوم" "فَعل" "أَفَّاع" Masc NoHum;
dust_N = brkN "غبر" "فُعَال" "أَفعِلة" Masc NoHum;
ear_N = brkN "ءذن" "فُعل" "أَفعَال" Fem NoHum;
earth_N = brkN "ترب" "فُعلة" "فُعَل" Fem NoHum;
@@ -296,7 +295,7 @@ flags
hair_N = sdfN "شعر" "فَعلة" Fem NoHum ;
hand_N = brkN "يد" "فَع" "أَفَاعِي" Fem NoHum ;
head_N = brkN "رءس" "فَعل" "فُعُول" Masc NoHum;
heart_N = brkN "قلب" "فَعل" "فُعُول" Masc NoHum;
heart_N = brkN "قلب" "فَعْل" "فُعُول" Masc NoHum;
horn_N = brkN "قرن" "فَعل" "فُعُول" Masc NoHum;
husband_N = brkN "زوج" "فَعل" "أَفعَال" Masc NoHum;
ice_N = brkN "ثلج" "فَعل" "فُعُول" Masc NoHum;

View File

@@ -3,43 +3,21 @@ resource MissingAra = open GrammarAra, Prelude in {
-- temporary definitions to enable the compilation of RGL API
oper AdAdv : AdA -> Adv -> Adv = notYet "AdAdv" ;
oper AdVVP : AdV -> VP -> VP = notYet "AdVVP" ;
oper AdjOrd : Ord -> AP = notYet "AdjOrd" ;
oper AdnCAdv : CAdv -> AdN = notYet "AdnCAdv" ;
oper AdvCN : CN -> Adv -> CN = notYet "AdvCN" ;
oper AdvIAdv : IAdv -> Adv -> IAdv = notYet "AdvIAdv" ;
oper AdvS : Adv -> S -> S = notYet "AdvS" ;
oper BaseAP : AP -> AP -> ListAP = notYet "BaseAP" ;
oper BaseAdv : Adv -> Adv -> ListAdv = notYet "BaseAdv" ;
oper BaseNP : NP -> NP -> ListNP = notYet "BaseNP" ;
oper BaseRS : RS -> RS -> ListRS = notYet "BaseRS" ;
oper BaseS : S -> S -> ListS = notYet "BaseS" ;
oper CAdvAP : CAdv -> AP -> NP -> AP = notYet "CAdvAP" ;
oper CleftAdv : Adv -> S -> Cl = notYet "CleftAdv" ;
oper CleftNP : NP -> RS -> Cl = notYet "CleftNP" ;
oper ComparAdvAdj : CAdv -> A -> NP -> Adv = notYet "ComparAdvAdj" ;
oper ComparAdvAdjS : CAdv -> A -> S -> Adv = notYet "ComparAdvAdjS" ;
oper ComplVA : VA -> AP -> VP = notYet "ComplVA" ;
oper ComplVQ : VQ -> QS -> VP = notYet "ComplVQ" ;
oper ComplVS : VS -> S -> VP = notYet "ComplVS" ;
oper ConjAP : Conj -> ListAP -> AP = notYet "ConjAP" ;
oper ConjAdv : Conj -> ListAdv -> Adv = notYet "ConjAdv" ;
oper ConjNP : Conj -> ListNP -> NP = notYet "ConjNP" ;
oper ConjRS : Conj -> ListRS -> RS = notYet "ConjRS" ;
oper ConjS : Conj -> ListS -> S = notYet "ConjS" ;
oper ConsAP : AP -> ListAP -> ListAP = notYet "ConsAP" ;
oper ConsAdv : Adv -> ListAdv -> ListAdv = notYet "ConsAdv" ;
oper ConsNP : NP -> ListNP -> ListNP = notYet "ConsNP" ;
oper ConsRS : RS -> ListRS -> ListRS = notYet "ConsRS" ;
oper ConsS : S -> ListS -> ListS = notYet "ConsS" ;
oper DetNP : Det -> NP = notYet "DetNP" ;
oper EmbedQS : QS -> SC = notYet "EmbedQS" ;
oper EmbedS : S -> SC = notYet "EmbedS" ;
oper EmbedVP : VP -> SC = notYet "EmbedVP" ;
oper ExistIP : IP -> QCl = notYet "ExistIP" ;
oper ExistNP : NP -> Cl = notYet "ExistNP" ;
oper FunRP : Prep -> NP -> RP -> RP = notYet "FunRP" ;
oper GenericCl : VP -> Cl = notYet "GenericCl" ;
oper IdRP : RP = notYet "IdRP" ;
oper ImpPl1 : VP -> Utt = notYet "ImpPl1" ;
oper ImpersCl : VP -> Cl = notYet "ImpersCl" ;
oper PConjConj : Conj -> PConj = notYet "PConjConj" ;
@@ -48,25 +26,15 @@ oper PredSCVP : SC -> VP -> Cl = notYet "PredSCVP" ;
oper ProgrVP : VP -> VP = notYet "ProgrVP" ;
oper ReflA2 : A2 -> AP = notYet "ReflA2" ;
oper ReflVP : VPSlash -> VP = notYet "ReflVP" ;
oper RelCN : CN -> RS -> CN = notYet "RelCN" ;
oper RelCl : Cl -> RCl = notYet "RelCl" ;
oper RelNP : NP -> RS -> NP = notYet "RelNP" ;
oper RelSlash : RP -> ClSlash -> RCl = notYet "RelSlash" ;
oper RelVP : RP -> VP -> RCl = notYet "RelVP" ;
oper SentAP : AP -> SC -> AP = notYet "SentAP" ;
oper SentCN : CN -> SC -> CN = notYet "SentCN" ;
oper SlashPrep : Cl -> Prep -> ClSlash = notYet "SlashPrep" ;
oper Slash2V3 : V3 -> NP -> VPSlash = notYet "Slash2V3" ;
oper SlashV2A : V2A -> AP -> VPSlash = notYet "SlashV2A" ;
oper SlashV2Q : V2Q -> QS -> VPSlash = notYet "SlashV2Q" ;
oper SlashV2S : V2S -> S -> VPSlash = notYet "SlashV2S" ;
oper SlashV2V : V2V -> VP -> VPSlash = notYet "SlashV2V" ;
oper SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash = notYet "SlashV2VNP" ;
oper SlashVS : NP -> VS -> SSlash -> ClSlash = notYet "SlashVS" ;
oper SubjS : Subj -> S -> Adv = notYet "SubjS" ;
oper UseA2 : A2 -> AP = notYet "UseA2" ;
oper UseComparA : A -> AP = notYet "UseComparA" ;
oper UseRCl : Temp -> Pol -> RCl -> RS = notYet "UseRCl" ;
oper UseSlash : Temp -> Pol -> ClSlash -> SSlash = notYet "UseSlash" ;
oper VocNP : NP -> Voc = notYet "VocNP" ;
oper pot3plus : Sub1000 -> Sub1000 -> Sub1000000 = notYet "pot3plus" ;

View File

@@ -34,7 +34,7 @@ flags optimize = all ;--noexpand;
case g of {
Masc => waHid;
Fem => waHida
} in defArt state waHid + word + dec1sg ! state ! c;
} in defArt state c waHid + word + dec1sg ! state ! c;
n = num;
d = state;
isPron = False;

View File

@@ -6,7 +6,12 @@ lin
DetCN det cn = let {
cas : Case -> Case = if_then_else Case det.is1sg Bare ;
number = sizeToNumber det.n ;
number = case cn.isDual of {
True =>
case sizeToNumber det.n of {
Sg => Sg ;
_ => Dl } ;
False => sizeToNumber det.n } ;
determiner : Case -> Str = \c ->
det.s ! cn.h ! (detGender cn.g det.n) ! c ;
noun : Case -> Str = \c ->
@@ -14,9 +19,9 @@ lin
! nounState det.d number
! nounCase c det.n det.d ;
adj : Case -> Str = \c ->
cn.adj ! number
! (definite ! det.d) -- Indef remains Indef, rest become Def
! c
cn.s2 ! number
! (definite ! det.d) -- Indef remains Indef, rest become Def
! c
} in {
s = \\c =>
case cnB4det det.isPron det.isNum det.n det.d of {
@@ -25,27 +30,31 @@ lin
++ adj c
++ cn.np ! c ;
True => noun (cas c) -- deal with possessive suffix
++ determiner c
++ adj c
++ determiner c -- (nounCase c det.n det.d) --??
++ adj c
++ cn.np ! c
};
a = { pgn = agrP3 cn.h cn.g number;
isPron = False }
isPron = False } ;
empty = []
};
UsePN pn = {
s = pn.s;
a = {pgn = (Per3 pn.g Sg); isPron = False }
a = {pgn = Per3 pn.g Sg ; isPron = False} ;
empty = []
};
UsePron p = p ;
PredetNP pred np = {
DetNP det = emptyNP ** {s = det.s ! NoHum ! Masc} ; ----
PredetNP pred np = np ** {
s = \\c => case pred.isDecl of {
True => pred.s!c ++ np.s ! Gen ; -- akvaru l-awlAdi
False => pred.s!c ++ np.s ! c
};
a = np.a
} ;
a = np.a ** {isPron=False}
} ;
{-
@@ -62,26 +71,15 @@ lin
AdvNP np adv = np ** {
s = \\c => np.s ! c ++ adv.s
};
{-
DetSg quant ord = {
s = \\h,g,c =>
quant.s ! Sg ! h ! g ! c ++ ord.s ! g ! quant.d ! c ;
n = One;
d = quant.d;
isPron = quant.isPron;
isNum =
case ord.n of {
None => False;
_ => True
}
} ;
-}
DetQuantOrd quant num ord = quant ** {
s = \\h,g,c => quant.s ! Pl ! h ! g ! c
++ num.s ! g ! (toDef quant.d num.n) ! c
s = \\h,g,c => let d = toDef quant.d num.n in
quant.s ! Pl ! h ! g ! c
++ num.s ! g ! d ! c
--FIXME check this:
++ ord.s ! g ! (toDef quant.d num.n) ! c ;
++ ord.s ! g
! case d of {Poss => Def ; _ => d}
! c ;
n = num.n;
isNum = orB num.isNum ord.isNum ;
-- ord may come from OrdDigits or OrdNumeral
@@ -90,7 +88,7 @@ lin
} ;
DetQuant quant num = quant ** {
s = \\h,g,c => quant.s ! Pl ! h ! g ! c
s = \\h,g,c => quant.s ! sizeToNumber num.n ! h ! g ! c
++ num.s ! g ! (toDef quant.d num.n) ! c ;
n = num.n;
isNum = -- Num may come from NumCard : Card -> Num
@@ -101,7 +99,7 @@ lin
} ;
PossPron p = {
s = \\_,_,_,_ => p.s ! Gen;
s = \\_,_,_,_ => BIND ++ p.s ! Gen;
d = Poss;
is1sg = case p.a.pgn of { Per1 Sing => True ; _ => False } ;
isPron = True;
@@ -165,42 +163,42 @@ lin
isNum,isPron,is1sg = False
} ;
MassNP cn = ---- AR
{s = \\c => cn.s ! Sg ! Indef ! c ++ cn.np ! c ++ cn.adj ! Sg ! Indef ! c ;
a = {pgn = Per3 cn.g Sg ; isPron = False}} ;
MassNP cn =
{s = \\c => cn2str cn Sg Indef c ;
a = {pgn = Per3 cn.g Sg ; isPron = False} ;
empty = []} ;
-- MassDet = {s = \\_,_,_,_ => [] ; d = Indef;
-- isNum = False; isPron = False} ;
UseN,
UseN2 = \n -> n ** {
adj = \\_,_,_ => [];
np = \\_ => []};
UseN2 = useN ;
Use2N3 n3 = n3 ;
Use3N3 n3 = n3 ** {c2 = n3.c3} ;
ComplN2 n2 np = UseN n2 ** --- IL
{s = \\n,s,c => n2.s ! n ! s ! c ++ n2.c2 ++ np.s ! Gen} ;
ComplN2 n2 np = UseN n2 ** {np = \\c => n2.c2.s ++ np.s ! n2.c2.c} ;
ComplN3 n3 np = ComplN2 n3 np ** {c2 = n3.c3} ;
AdjCN ap cn = cn ** {
adj = \\n,d,c => ap.s ! cn.h ! cn.g ! n ! (definite ! d) ! c
s2 = \\n,d,c => cn.s2 ! n ! d ! c ++ ap.s ! cn.h ! cn.g ! n ! (definite ! d) ! c
};
-- RelCN cn rs = {s = \\n,c => cn.s ! n ! c ++ rs.s ! {n = n ; p = P3}} ;
-- AdvCN cn ad = {s = \\n,c => cn.s ! n ! c ++ ad.s} ;
--
-- SentCN cn sc = {s = \\n,c => cn.s ! n ! c ++ sc.s} ;
RelCN cn rs = cn ** {
s2 = \\n,s,c => cn.s2 ! n ! s ! c ++ rs.s ! {pgn=Per3 cn.g n ; isPron=False} ! c};
RelNP np rs = np ** {s = \\c => np.s ! c ++ rs.s ! np.a ! c} ;
AdvCN,
SentCN = \cn,ss -> cn ** {s2 = \\n,d,c => cn.s2 ! n ! d ! c ++ ss.s} ;
ApposCN cn np = cn ** { np = \\c => cn.np ! c ++ np.s ! c } ;
-- : CN -> NP -> CN ; -- house of Paris, house of mine
PossNP cn np = cn ** {
s = \\n,_d,c => cn.s ! n ! Const ! c ;
s = \\n,_d,c => cn.s ! n ! Const ! c ;
s2 = \\n,_d,c => cn.s2 ! n ! Const ! Gen ; -- unsure about this /IL
np = \\c => cn.np ! c ++ np.s ! Gen
};
-- : CN -> NP -> CN ; -- glass of wine
--PartNP
}

View File

@@ -2,58 +2,76 @@ resource OrthoAra = open Prelude, Predef in {
flags coding=utf8 ;
oper
oper
vow : pattern Str = #("َ" | "ِ" | "ُ" | "ً" | "ٍ" | "ٌ") ;
vow : pattern Str = #("َ" | "ِ" | "ُ" | "ً" | "ٍ" | "ٌ") ;
-- "Sun letters": assimilate with def. article
sun : pattern Str = #("ت"|"ث"|"د"|"ذ"|"ر"|"ز"|"س"|"ش"|"ص"|"ض"|"ط"|"ظ"|"ل"|"ن") ;
weak : pattern Str = #("و"|"ي") ;
-- Shadda: https://www.unicode.org/L2/L2017/17253-arabic-ordering.pdf
fixShd : Str -> Str -> Str = \word,suffix ->
case <word,suffix> of {
<x + "ّ", v@#vow + y> => x + v + "ّ" + y ;
_ => word + suffix
} ;
-- "Sun letters": assimilate with def. article
sun : pattern Str = #("ت"|"ث"|"د"|"ذ"|"ر"|"ز"|"س"|"ش"|"ص"|"ض"|"ط"|"ظ"|"ل"|"ن") ;
-- Hamza
hamza : pattern Str = #("ء"|"؟") ;
-- Shadda: https://www.unicode.org/L2/L2017/17253-arabic-ordering.pdf
fixShd : Str -> Str -> Str = \word,suffix ->
case <word,suffix> of {
-- <x + "ّ", v@#vow + y> => x + v + "ّ" + y ;
<x + v@#vow, "ّ" + y> => x + "ّ" + v + y ;
_ => word + suffix
} ;
rectifyHmz: Str -> Str = \word ->
case word of {
l@(""|"ال") + ("أ"|"أَ") + #hamza + "ْ" + tail => l + "آ" + tail;
l@(""|"ال") + ("أ"|"أَ") + #hamza + tail => l + "آ" + tail;
l@(""|"ال") + #hamza + v@("َ"|"ُ") + tail => l + "أ" + v + tail;
l@(""|"ال") + #hamza + v@("ِ") + tail => l + "إ" + v + tail;
-- IL: using this to reuse patterns for weak verbs, might be strange/wrong
rmSukun : Str -> Str = \s -> case s of {
x + "ْ" + y => x + y ;
_ => s
} ;
head + v1@("ِ"|"ُ"|"َ"|"ْ"|"ا"|"ي"|"و") + #hamza + v2@(""|"ُ"|"َ"|"ْ"|"ِ") => head + v1 + (tHmz v1) + v2;
head + #hamza + tail => head + (bHmz (dp 2 head) (take 2 tail)) + tail; --last head , take 1 tail
_ => word
};
-- Hamza
hamza : pattern Str = #("ء"|"؟") ;
--hamza at beginning of word (head)
hHmz : Str -> Str = \d ->
case d of {
"ِ" => "إ";
_ => "أ"
};
rectifyHmz : Str -> Str = \word ->
case word of {
l@(""|"ال") + ("أ"|"أَ") + #hamza + "ْ" + tail => l + "آ" + tail;
l@(""|"ال") + ("أ"|"أَ") + #hamza + tail => l + "آ" + tail;
l@(""|"ال") + #hamza + v@("َ"|"ُ") + tail => l + "أ" + v + tail;
l@(""|"ال") + #hamza + v@("ِ") + tail => l + "إ" + v + tail;
head + v1@(#vow|"ْ"|"ا"|"ي"|"و")
+ #hamza + v2@(#vow|"ْ") + tail =>
case v2 of { "ْ" => head + v1 + bHmz v1 v2 + tail ; -- unsure about this /IL
_ => head + v1 + bHmz v1 v2 + v2 + tail } ;
head + v1@(#vow|"ْ"|"ا"|"ي"|"و") -- the same but it ends in vowel
+ #hamza + v2@(#vow|"ْ") =>
case v2 of { "ْ" => head + v1 + tHmz v1 ;
_ => head + v1 + tHmz v1 + v2 } ;
head + v1@(#vow|"ْ"|"ا"|"ي"|"و") -- the same but it ends without vowel
+ #hamza => head + v1 + tHmz v1 ;
--hamza in middle of word (body)
bHmz : Str -> Str -> Str = \d1,d2 ->
case <d1,d2> of {
<"ِ",_> | <_,"ِ"> => "ئ";
<"ُ",_> | <_,"ُ"> => "ؤ";
<"َ",_> | <_,"َ"> => "أ";
_ => "ء"
};
head + #hamza + tail => head + (bHmz (dp 2 head) (take 2 tail)) + tail; --last head , take 1 tail
_ => word
};
--hamza carrier sequence
tHmz : Str -> Str = \d ->
case d of {
"ِ" => "ئ";
"ُ" => "ؤ";
"َ" => "أ";
"ْ"|"ا"|"و"|"ي" => "ء"
};
--hamza at beginning of word (head)
hHmz : Str -> Str = \d ->
case d of {
"ِ" => "إ";
_ => "أ"
};
--hamza in middle of word (body)
bHmz : Str -> Str -> Str = \d1,d2 ->
case <d1,d2> of {
<"ِ",_> | <_,"ِ"> => "ئ";
<"ُ",_> | <_,"ُ"> => "ؤ";
<"َ",_> | <_,"َ"> => "أ";
_ => "ء"
};
--hamza carrier sequence
tHmz : Str -> Str = \d ->
case d of {
"ِ" => "ئ";
"ُ" => "ؤ";
"َ" => "أ";
"ْ"|"ا"|"و"|"ي" => "ء"
};
}

View File

@@ -35,31 +35,54 @@ resource ParadigmsAra = open
oper
-- Prepositions are used in many-argument functions for rection.
Case : Type ;
nom : Case ;
acc : Case ;
gen : Case ;
-- Prepositions are used in many-argument functions for rection.
Preposition : Type ;
noPrep : Preposition ;
casePrep : Case -> Preposition ;
--- TODO: continue, add all over the grammar
Gender : Type ;
masc : Gender ;
fem : Gender ;
Number : Type ;
sg : Number ;
pl : Number ;
Species : Type ;
hum : Species ;
nohum : Species ;
Vowel : Type ;
va : Vowel ;
vi : Vowel ;
vu : Vowel ;
--2 Nouns
-- Overloaded operator for main cases
mkN = overload {
mkN : (sg : Str) -> N -- non-human regular nouns
= smartN ;
mkN : Species -> N -> N
= \p,n -> n ** {h = p} ;
mkN : (sg,pl : Str) -> Gender -> Species -> N
= \sg,pl -> mkFullN (reg sg pl) ;
mkN : NTable -> Gender -> Species -> N -- loan words, irregular
= mkFullN ;
mkN : (root,sgPatt,brokenPlPatt : Str) -> Gender -> Species -> N -- broken plural
= brkN ;
mkN : N -> (attr : Str) -> N -- Compound nouns
= \n,attr -> n ** { s = \\num,s,c => n.s ! num ! s ! c ++ attr } ; --- IL (TODO: all kinds of compounds)
mkN : overload {
mkN : (sg : Str) -> N ; -- non-human regular nouns
mkN : Species -> N -> N ;
mkN : (sg,pl : Str) -> Gender -> Species -> N ;
mkN : NTable -> Gender -> Species -> N ; -- loan words, irregular
mkN : (root,sgPatt,brokenPlPatt : Str) -> Gender -> Species -> N ; -- broken plural
mkN : N -> (attr : Str) -> N ; -- Compound noun with invariant attribute
mkN : N -> N -> N ; -- Compound noun where attribute inflects in state and case. Attribute in singular.
mkN : Number -> N -> N -> N ; -- Compound noun where attribute inflects in state and case. Attribute's number specified by 1st arg.
--- mkN : (root,sgPatt : Str) -> Gender -> Species -> N -- sound feminine plural
--- = sdfN ;
} ;
dualN : N -> N ; -- Force the plural of the N into dual (e.g. "twins")
--This is used for loan words or anything that has untreated irregularities
--in the interdigitization process of its words
mkFullN : NTable -> Gender -> Species -> N ;
@@ -82,6 +105,8 @@ resource ParadigmsAra = open
mkPN = overload {
mkPN : Str -> PN -- Fem Hum if ends with ة, otherwise Masc Hum
= smartPN ;
mkPN : N -> PN
= \n -> lin PN (n ** {s = \\c => n.s ! Sg ! Const ! c ++ n.s2 ! Sg ! Const ! c }) ; -- no idea /IL
mkPN : Str -> Gender -> Species -> PN
= mkFullPN ;
} ;
@@ -92,13 +117,17 @@ resource ParadigmsAra = open
--3 Relational nouns
mkN2 = overload {
mkN2 : N -> Preposition -> N2 = prepN2 ;
mkN2 : N -> N2 = \n -> lin N2 (n ** {c2 = []}) ;
mkN2 : Str -> N2 = \str -> lin N2 (smartN str ** {c2 = []})
mkN2 : overload {
mkN2 : N -> Preposition -> N2 ; -- ready-made preposition
mkN2 : N -> Str -> N2 ; -- preposition given as a string
mkN2 : N -> N2 ; -- no preposition
mkN2 : Str -> N2 ; -- no preposition, predictable inflection
} ;
mkN3 : N -> Preposition -> Preposition -> N3 ;
mkN3 : overload {
mkN3 : N -> Preposition -> Preposition -> N3 ; -- ready-made prepositions
mkN3 : N -> Str -> Str -> N3 ; -- prepositions given as strings
} ;
--2 Adjectives
@@ -106,16 +135,15 @@ resource ParadigmsAra = open
-- Overloaded operator for main cases
mkA = overload {
mkA : (root,patt : Str) -> A
mkA : (root,sg : Str) -> A -- adjective with sound plural; takes root string and sg. pattern string
= \r,p -> lin A (sndA r p);
mkA : (root : Str) -> A -- forms adjectives with positive form aFCal
mkA : (root : Str) -> A -- adjective with positive form aFCal
= \r -> lin A (clrA r);
mkA : (root,sg,pl : Str) -> A
mkA : (root,sg,pl : Str) -> A -- adjective with broken plural
= \r,s,p -> lin A (brkA r s p) ;
-- mkA : (posit,compar,plur : Str) -> A
-- = degrA ;
} ;
degrA : (posit,compar,plur : Str) -> A ;
--Takes a root string and a pattern string
sndA : (root,patt : Str) -> Adj ;
@@ -123,11 +151,16 @@ resource ParadigmsAra = open
--Takes a root string only
clrA : (root : Str) -> Adj ; -- forms adjectives of type aFCal
nisbaA : Str -> Adj ; -- forms relative adjectives by adding the suffix ِيّ
--3 Two-place adjectives
--
-- Two-place adjectives need a preposition for their second argument.
mkA2 : A -> Preposition -> A2 ;
mkA2 : overload {
mkA2 : A -> Preposition -> A2 ;
mkA2 : A -> Str -> A2
} ;
--2 Adverbs
@@ -141,75 +174,65 @@ resource ParadigmsAra = open
mkAdA : Str -> AdA ;
mkInterj : Str -> Interj ;
mkSubj : overload {
mkSubj : Str -> Subj ; -- Default order Subord (=noun first and in accusative)
mkSubj : Str -> Order -> Subj -- Specify word order
} ;
--2 Prepositions
--
-- A preposition as used for rection in the lexicon, as well as to
-- build $PP$s in the resource API, just requires a string.
mkPrep : Str -> Prep
= \s -> lin Prep {s = mkPreposition s} ; -- preposition in the sense of RGL abstract syntax
mkPreposition : Str -> Preposition ; -- just a string, for internal use
-- build $PP$s in the resource API. Requires a string and a case.
mkPrep : overload {
mkPrep : Str -> Prep ;
mkPrep : Str -> Case -> Prep
} ; -- preposition in the sense of RGL abstract syntax
--2 Verbs
-- Overloaded operations
mkV = overload {
mkV : (imperfect : Str) -> V
= regV ;
mkV : (root : Str) -> (perf,impf : Vowel) -> V -- verb form I ; vowel = a|i|u
= v1 ;
mkV : (root : Str) -> VerbForm -> V -- FormI .. FormX (no VII, IX) ; default vowels a u for I
= formV ;
mkV : overload {
mkV : (imperfect : Str) -> V ; -- The verb in Per3 Sg Masc imperfect tense gives the most information
mkV : (root : Str) -> (perf,impf : Vowel) -> V ; -- verb form I ; vowel = a|i|u
mkV : (root : Str) -> VerbForm -> V ; -- FormI .. FormX (no VII, IX) ; default vowels a u for I
mkV : V -> (particle : Str) -> V -- V with a non-inflecting particle/phrasal verb
} ;
-- The verb in the imperfect tense gives the most information
-- regV : Str -> V ;
regV : Str -> V ;
reflV : V -> V ; -- نَفْس in the proper case and with possessive suffix, e.g. نَفْسَكِ
--Verb Form I : fa`ala, fa`ila, fa`ula
v1 : Str -> Vowel -> Vowel -> V ; -- Verb Form I : fa`ala, fa`ila, fa`ula
v1 : Str -> Vowel -> Vowel -> V ;
v2 : Str -> V ; -- Verb Form II : fa``ala
--Verb Form II : fa``ala
v3 : Str -> V ; -- Verb Form III : faa`ala
v2 : Str -> V ;
v4 : Str -> V ; -- Verb Form IV : 'af`ala
--Verb Form III : faa`ala
v5 : Str -> V ; -- Verb Form V : tafa``ala
v3 : Str -> V ;
v6 : Str -> V ; -- Verb Form VI : tafaa`ala
--Verb Form IV : 'af`ala
v7 : Str -> V ; -- Verb Form VII : infa`ala
v4 : Str -> V ;
v8 : Str -> V ; -- Verb Form VIII ifta`ala
--Verb Form V : tafa``ala
v5 : Str -> V ;
--Verb Form VI : tafaa`ala
v6 : Str -> V ;
--Verb Form VIII 'ifta`ala
v8 : Str -> V ;
-- Verb Form X 'istaf`ala
v10 : Str -> V ;
v10 : Str -> V ; -- Verb Form X 'istaf`ala
--3 Two-place verbs
-- Two-place verbs need a preposition, except the special case with direct object.
-- (transitive verbs). Notice that a particle comes from the $V$.
mkV2 = overload {
mkV2 : V -> V2 = dirV2 ;
mkV2 : V -> Preposition -> V2 = prepV2 ;
mkV2 : Str -> V2 = strV2;
mkV2 : overload {
mkV2 : V -> V2 ; -- No preposition
mkV2 : V -> Str -> V2 ; -- Preposition as string, default case genitive
mkV2 : V -> Preposition -> V2 ; -- Ready-made preposition
mkV2 : Str -> V2 ; -- Predictable verb conjugation, no preposition
} ;
dirV2 : V -> V2 ;
@@ -219,9 +242,15 @@ resource ParadigmsAra = open
-- Three-place (ditransitive) verbs need two prepositions, of which
-- the first one or both can be absent.
mkV3 : V -> Preposition -> Preposition -> V3 ; -- speak, with, about
dirV3 : V -> Preposition -> V3 ; -- give,_,to
dirdirV3 : V -> V3 ; -- give,_,_
mkV3 : overload {
mkV3 : V -> Preposition -> Preposition -> V3 ; -- speak, with, about
mkV3 : V -> (to : Str) -> (about:Str) -> V3 -- like above, but with strings as arguments (default complement case genitive)
} ;
dirV3 : overload {
dirV3 : V -> Preposition -> V3 ; -- give,_,to
dirV3 : V -> (to : Str) -> V3 -- like above, but with string as argument (default complement case genitive)
} ;
dirdirV3 : V -> V3 ; -- give,_,_
--3 Other complement patterns
--
@@ -233,9 +262,15 @@ resource ParadigmsAra = open
mkV2S : V -> Str -> V2S ;
mkVV = overload {
mkVV : V -> VV = regVV ;
mkVV : V -> Str -> VV = c2VV
mkVV : V -> Str -> VV = c2VV ;
mkVV : V -> Preposition -> VV = prepVV ;
mkVV : V -> Preposition -> Preposition -> VV = prep2VV
} ;
mkV2V : V -> Str -> Str -> V2V ;
mkV2V : overload {
mkV2V : V -> Str -> Str -> V2V ;
mkV2V : V -> Preposition -> Preposition -> V2V ;
mkV2V : VV -> Preposition -> V2V
} ;
mkVA : V -> VA ;
mkV2A : V -> Str -> V2A ;
mkVQ : V -> VQ ;
@@ -260,6 +295,94 @@ resource ParadigmsAra = open
-- The definitions should not bother the user of the API. So they are
-- hidden from the document.
Case = ResAra.Case ;
nom = ResAra.Nom ;
acc = ResAra.Acc ;
gen = ResAra.Gen ;
-- Prepositions are used in many-argument functions for rection.
Preposition = ResAra.Preposition ;
noPrep = {s=[]; c=nom} ;
casePrep c = {s=[]; c=c} ;
Gender = ResAra.Gender ;
masc = ResAra.Masc ;
fem = ResAra.Fem ;
Number = ResAra.Number ;
sg = ResAra.Sg ;
pl = ResAra.Pl ;
Species = ResAra.Species ;
hum = ResAra.Hum ;
nohum = ResAra.NoHum ;
Vowel = ResAra.Vowel ;
va = ResAra.a ;
vu = ResAra.u ;
vi = ResAra.i ;
mkPrep = overload {
mkPrep : Str -> Prep = \s ->
lin Prep (mkPreposition s) ;
mkPrep : Str -> Case -> Prep = \s,c ->
lin Prep (mkPreposition s c)
} ;
mkV2 = overload {
mkV2 : V -> V2 = dirV2 ;
mkV2 : V -> Str -> V2 = \v,p -> prepV2 v (mkPreposition p);
mkV2 : V -> Preposition -> V2 = prepV2 ;
mkV2 : Str -> V2 = strV2;
} ;
prepV2 : V -> Preposition -> V2 = \v,p -> v ** {s = v.s ; c2 = p ; lock_V2 = <>} ;
strV2 : Str -> V2 = \str -> dirV2 (mkV str) ;
mkN = overload {
mkN : (sg : Str) -> N -- non-human regular nouns
= smartN ;
mkN : Species -> N -> N
= \p,n -> n ** {h = p} ;
mkN : (sg,pl : Str) -> Gender -> Species -> N
= \sg,pl -> mkFullN (reg sg pl) ;
mkN : NTable -> Gender -> Species -> N -- loan words, irregular
= mkFullN ;
mkN : (root,sgPatt,brokenPlPatt : Str) -> Gender -> Species -> N -- broken plural
= brkN ;
mkN : N -> (attr : Str) -> N -- Compound nouns with noninflecting attribute
= \n,attr -> n ** {s2 = \\n,s,c => attr} ;
mkN : N -> N -> N -- Compound nouns where attribute inflects in state and case but not number
= attrN Sg ;
mkN : Number -> N -> N -> N -- Compound nouns where attribute inflects in state, case and number
= attrN ;
} ;
attrN : Number -> N -> N -> N = \num,n1,n2 -> n1 ** {
s = \\n,_,c => n1.s ! n ! Const ! c ;
s2 = \\n,s,c => let c' = case c of {Dat => Gen; _ => c} in -- the Dat with liPrep hack only applies to the first word
n1.s2 ! num ! s ! c' -- attribute doesn't change
++ n2.s ! num ! s ! c'
++ n2.s2 ! num ! s ! c'} ;
dualN : N -> N = \n -> n ** {isDual=True} ;
proDrop : NP -> NP ; -- Force a NP to lose its string, only contributing with its agreement.
mkPron : (_,_,_ : Str) -> PerGenNum -> Pron ;
mkV = overload {
mkV : (imperfect : Str) -> V
= regV ;
mkV : (root : Str) -> (perf,impf : Vowel) -> V -- verb form I ; vowel = a|i|u
= v1 ;
mkV : (root : Str) -> VerbForm -> V -- FormI .. FormX (no VII, IX) ; default vowels a u for I
= formV ;
mkV : V -> (particle : Str) -> V = \v,p ->
v ** { s = \\vf => v.s ! vf ++ p } ;
} ;
regV : Str -> V = \wo ->
let rau : Str * Vowel * Vowel =
@@ -274,27 +397,19 @@ resource ParadigmsAra = open
v1 = \rootStr,vPerf,vImpf ->
let { raw = v1' rootStr vPerf vImpf } in
{ s = \\vf =>
case rootStr of {
_ + #hamza + _ => rectifyHmz(raw.s ! vf);
_ => raw.s ! vf
};
lock_V = <>
} ;
va : Vowel = ResAra.a ;
lin V { s = \\vf =>rectifyHmz (raw.s ! vf) } ;
v1' : Str -> Vowel -> Vowel -> Verb =
\rootStr,vPerf,vImpf ->
let { root = mkRoot3 rootStr } in
case <root.l, root.c> of {
<"ّ", _> => v1geminate rootStr vPerf vImpf ;
<"و"|"ي",_> => case vPerf of {
i => v1defective_i root vImpf ;
_ => v1defective_a root vImpf } ;
<_,"و"|"ي"> => v1hollow root vImpf ;
_ => v1sound root vPerf vImpf
};
let root = mkRoot3 rootStr
in case rootStr of {
_ + "ّ" => v1geminate rootStr vPerf vImpf ;
? + #hamza + #weak => v1doubleweak root ;
? + ? + #weak => case vPerf of {
i => v1defective_i root vImpf ;
_ => v1defective_a root vImpf } ;
? + #weak + ? => v1hollow root vImpf ;
_ => v1sound root vPerf vImpf } ;
v2 =
\rootStr ->
@@ -303,7 +418,7 @@ resource ParadigmsAra = open
} in {
s =
case root.l of {
"و"|"ي" => (v2defective root).s;
#weak => (v2defective root).s;
_ => (v2sound root).s
};
lock_V = <>
@@ -320,16 +435,13 @@ resource ParadigmsAra = open
v4 =
\rootStr ->
let {
root = mkRoot3 rootStr
} in {
s =
case root.l of {
"و"|"ي" => (v4defective root).s;
_ => (v4sound root).s
};
lock_V = <>
};
let root : Root3 = mkRoot3 rootStr ;
verb : Verb = case rootStr of {
? + #hamza + #weak => v4doubleweak root ;
? + #weak + ? => v4hollow root ;
_ + #weak => v4defective root ;
_ => v4sound root } ;
in lin V verb ;
v5 =
@@ -360,31 +472,43 @@ resource ParadigmsAra = open
lock_V = <>
};
v7 =
\rootStr ->
let {
fcl = mkRoot3 rootStr ;
v7fun = v7geminate ; -- TODO add rest
} in lin V (v7fun fcl) ;
v8 =
\rootStr ->
let {
rbT = mkRoot3 rootStr ;
v8fun = case rbT.f of {
("و"|"ي"|"ّ") => v8assimilated ;
_ => v8sound }
_ =>
case rbT.c of {
#weak => v8hollow ;
_ => v8sound }}
} in lin V (v8fun rbT) ;
v10 =
\rootStr ->
let {
rbT = mkRoot3 rootStr ;
v10fun = case rbT.c of {
("و"|"ي") => v10hollow ;
_ => v10sound }
v10fun : Root3 -> Verb = case rootStr of {
? + #weak + ? => v10hollow ;
? + ? + #weak => v10defective ;
_ => v10sound }
} in lin V (v10fun rbT) ;
Preposition = Str ;
reflV v = lin V (ResAra.reflV v) ;
mkFullN nsc gen spec =
mkFullN nsc gen spec = lin N
{ s = nsc; --NTable
s2 = emptyNTable;
g = gen;
h = spec;
lock_N = <>
isDual = False
};
brkN' : Str -> Str -> Str -> Gender -> Species -> N =
@@ -394,14 +518,12 @@ resource ParadigmsAra = open
} in mkFullN (reg kitAb kutub) gen spec;
brkN root sg pl gen spec =
let { raw = brkN' root sg pl gen spec} in
let { raw = brkN' root sg pl gen spec} in raw **
{ s = \\n,d,c =>
case root of {
_ + #hamza + _ => rectifyHmz(raw.s ! n ! d ! c);
_ => raw.s ! n ! d ! c
};
g = gen;
h = spec ; lock_N = <>
}
};
sdfN =
@@ -409,7 +531,7 @@ resource ParadigmsAra = open
let { kalimaStr = mkWord sg root;
kalimaRaw = sndf kalimaStr;
kalima : NTable = \\n,d,c => case root of {
_ + #hamza + _
_ + #hamza + _
=> rectifyHmz (kalimaRaw ! n ! d ! c);
_ => kalimaRaw ! n ! d ! c
};
@@ -427,35 +549,36 @@ resource ParadigmsAra = open
lock_PN = <>
};
mkN2 = overload {
mkN2 : N -> Preposition -> N2 = prepN2 ;
mkN2 : N -> Str -> N2 = \n,s -> prepN2 n (mkPreposition s);
mkN2 : N -> N2 = \n -> lin N2 (n ** {c2 = noPrep}) ;
mkN2 : Str -> N2 = \str -> lin N2 (smartN str ** {c2 = noPrep})
} ;
prepN2 : N -> Str -> N2 = \n,p -> lin N2 (n ** {c2 = p}) ;
prepN2 : N -> Preposition -> N2 = \n,p -> lin N2 (n ** {c2 = p}) ;
mkN3 = \n,p,q -> n ** {lock_N3 = <> ; c2 = p ; c3 = q} ;
mkN3 = overload {
mkN3 : N -> Preposition -> Preposition -> N3 = \n,p,q ->
lin N3 (n ** {c2 = p ; c3 = q}) ;
mkN3 : N -> Str -> Str -> N3 = \n,p,q ->
lin N3 (n ** {c2 = mkPreposition p ; c3 = mkPreposition q}) ;
} ;
mkPron : (_,_,_ : Str) -> PerGenNum -> NP = \ana,nI,I,pgn ->
{ s =
table {
Acc => BIND ++ nI; -- object suffix
Gen => BIND ++ I; -- possessive suffix
_ => ana
};
a = {pgn = pgn; isPron = True };
lock_NP = <>
};
mkPron : (_,_,_ : Str) -> PerGenNum -> Pron = \ana,nI,I,pgn ->
lin Pron (ResAra.mkPron ana nI I pgn) ;
proDrop : NP -> NP = \np -> lin NP (ResAra.proDrop np) ;
-- e.g. al-jamii3, 2a7ad
regNP : Str -> Number -> NP = \word,n ->
{ s = \\c => fixShd word (dec1sg ! Def ! c) ;
a = {pgn = Per3 Masc n; isPron = False };
lock_NP = <>
};
regNP : Str -> Number -> NP = \word,n -> lin NP (emptyNP ** {
s = \\c => fixShd word (dec1sg ! Def ! c)
});
-- e.g. hadha, dhaalika
indeclNP : Str -> Number -> NP = \word,n ->
{ s = \\c => word ;
a = {pgn = Per3 Masc n; isPron = False };
lock_NP = <>
};
indeclNP : Str -> Number -> NP = \word,n -> lin NP (emptyNP ** {
s = \\c => word
});
mkQuant7 : (_,_,_,_,_,_,_ : Str) -> State -> Quant =
\hava,havihi,havAn,havayn,hAtAn,hAtayn,hA'ulA,det -> lin Quant (baseQuant **
@@ -493,9 +616,9 @@ resource ParadigmsAra = open
mascTbl = reg jadId judud ;
femTbl = reg jadIda judud ;
in { s = table {
APosit Masc n d c => mascTbl ! n ! d ! c ;
APosit Fem n d c => femTbl ! n ! d ! c ;
AComp d c => indeclN akbar ! d ! c }
APosit Masc n d c => rectifyHmz (mascTbl ! n ! d ! c) ;
APosit Fem n d c => rectifyHmz (femTbl ! n ! d ! c) ;
AComp d c => rectifyHmz (indeclN akbar ! d ! c) }
} ;
degrA : (posit,compar,plur : Str) -> A
@@ -521,6 +644,14 @@ resource ParadigmsAra = open
}
};
nisbaA : Str -> Adj = \Haal ->
let Haaliyy = Haal + "ِيّ" in {
s = table {
APosit g n d c => positAdj Haaliyy ! g ! n ! d ! c ;
AComp d c => "أَكْثَر" ++ indeclN Haaliyy ! d ! c
}
} ;
clrA root =
let { eaHmar = mkWord "أَفعَل" root;
HamrA' = mkWord "فَعلاء" root;
@@ -529,45 +660,73 @@ resource ParadigmsAra = open
s = clr eaHmar HamrA' Humr;
};
mkA2 a p = a ** {c2 = p ; lock_A2 = <>} ;
mkA2 = overload {
mkA2 : A -> Preposition -> A2 = prepA2 ;
mkA2 : A -> Str -> A2 = \a,p -> prepA2 a (mkPreposition p)
} ;
mkAdv x = ss x ** {lock_Adv = <>} ;
mkAdV x = ss x ** {lock_AdV = <>} ;
mkAdA x = ss x ** {lock_AdA = <>} ;
prepA2 : A -> Preposition -> A2 = \a,p -> lin A2 (a ** {c2 = p}) ;
mkPreposition p = p ;
mkAdv x = lin Adv (ss x) ;
mkAdV x = lin AdV (ss x) ;
mkAdA x = lin AdA (ss x) ;
mkInterj x = lin Interj (ss x) ;
prepV2 : V -> Preposition -> V2 = \v,p -> v ** {s = v.s ; c2 = p ; lock_V2 = <>} ;
strV2 : Str -> V2 = \str -> dirV2 (mkV str) ;
mkSubj = overload {
mkSubj : Str -> Subj = \s -> lin Subj {s = s ; o = Subord} ;
mkSubj : Str -> Order -> Subj = \s,o -> lin Subj {s = s ; o = o} ;
} ;
dirV2 v = prepV2 v [] ;
dirV2 v = prepV2 v (casePrep acc) ;
mkV3 v p q = v ** {s = v.s ; c2 = p ; c3 = q ; lock_V3 = <>} ;
dirV3 v p = mkV3 v [] p ;
dirdirV3 v = dirV3 v [] ;
mkV3 = overload {
mkV3 : V -> Preposition -> Preposition -> V3 = \v,p,q ->
lin V3 (prepV3 v p q) ;
mkV3 : V -> Str -> Str -> V3 = \v,p,q ->
lin V3 (v ** {s = v.s ; c2 = mkPreposition p ; c3 = mkPreposition q})
} ;
prepV3 : V -> Preposition -> Preposition -> Verb3 = \v,p,q ->
v ** {s = v.s ; c2 = p ; c3 = q} ;
dirV3 = overload {
dirV3 : V -> Preposition -> V3 = \v,p -> mkV3 v (casePrep acc) p ;
dirV3 : V -> Str -> V3 = \v,s -> mkV3 v (casePrep acc) (mkPreposition s)
} ;
dirdirV3 v = dirV3 v (casePrep acc) ;
mkVS v = v ** {lock_VS = <>} ;
mkVQ v = v ** {lock_VQ = <>} ;
regVV : V -> VV = \v -> lin VV v ** {c2 = "أَنْ"} ;
c2VV : V -> Str -> VV = \v,prep -> regVV v ** {c2 = prep} ;
regVV : V -> VV = \v -> lin VV v ** {c2 = mkPreposition "أَنْ" ; sc = noPrep} ;
c2VV : V -> Str -> VV = \v,prep -> regVV v ** {c2 = mkPreposition prep ; sc = noPrep} ;
prepVV : V -> Preposition -> VV = \v,prep -> regVV v ** {c2=prep; sc=noPrep} ;
prep2VV : V -> (_,_ : Preposition) -> VV = \v,p1,p2 -> regVV v ** {c2=p1; sc=p2} ;
V0 : Type = V ;
---- V2S, V2V, V2Q, V2A : Type = V2 ;
AS, A2S, AV : Type = A ;
A2V : Type = A2 ;
mkV0 v = v ** {lock_V = <>} ;
mkV2S v p = mkV2 v p ** {lock_V2S = <>} ;
mkV2V v p t = mkV2 v p ** {s4 = t ; lock_V2V = <>} ;
mkVA v = v ** {lock_VA = <>} ;
mkV2A v p = mkV2 v p ** {lock_V2A = <>} ;
mkV2Q v p = mkV2 v p ** {lock_V2Q = <>} ;
mkV0 v = v ;
mkV2S v p = lin V2S (prepV2 v (mkPreposition p)) ;
mkV2V = overload {
mkV2V : V -> Str -> Str -> V2V = \v,p,q ->
lin V2V (prepV3 v (mkPreposition p) (mkPreposition q) ** {sc = noPrep}) ;
mkV2V : V -> Preposition -> Preposition -> V2V = \v,p,q ->
lin V2V (prepV3 v p q ** {sc = noPrep}) ;
mkV2V : VV -> Preposition -> V2V = \vv,p ->
lin V2V (vv ** {c2 = p ; c3 = vv.c2}) ;
} ;
mkVA v = v ** {lock_VA = <>} ;
mkV2A v p = lin V2A (prepV2 v (mkPreposition p));
mkV2Q v p = lin V2Q (prepV2 v (mkPreposition p));
mkAS,
mkAV = \a -> a ;
mkA2S,
mkA2V = \a,p -> prepA2 a (mkPreposition p) ;
mkAS v = v ** {lock_A = <>} ;
mkA2S v p = mkA2 v p ** {lock_A = <>} ;
mkAV v = v ** {lock_A = <>} ;
mkA2V v p = mkA2 v p ** {lock_A2 = <>} ;
smartN : Str -> N = \s -> case s of {
@@ -588,12 +747,12 @@ formV : (root : Str) -> VerbForm -> V = \s,f -> case f of {
FormIV => v4 s ;
FormV => v5 s ;
FormVI => v6 s ;
--- FormVII => v7 s ;
FormVII => v7 s ;
FormVIII => v8 s ;
FormX => v10 s
} ;
param VerbForm =
FormI | FormII | FormIII | FormIV | FormV | FormVI | FormVIII | FormX ;
FormI | FormII | FormIII | FormIV | FormV | FormVI | FormVII | FormVIII | FormX ;
} ;

View File

@@ -35,9 +35,13 @@ flags coding=utf8 ;
fuci = { h = "" ; m1 = "ُ" ; m2 = ""; t = "ِ" } ;
fucu = { h = "" ; m1 = "ُ" ; m2 = ""; t = "ُ" } ;
fUc = { h = "" ; m1 = "ُو"; m2 = ""; t = "" } ;
ufAc = { h = "ُ" ; m1 = "َا"; m2 = ""; t = "" } ;
ufca = { h = "ُ" ; m1 = "ْ" ; m2 = ""; t = "َ" } ;
eafAc = fAc ** { h = "أَ" } ;
eafac = fac ** { h = "أَ" } ;
eafIc = fIc ** { h = "أَ" } ;
eafic = fic ** { h = "أَ" } ;
eafAcil = { h = "أَ"; m1 = "َا" ; m2 = "ِ" ; t = "" } ;
eafAcIl = { h = "أَ"; m1 = "َا" ; m2 = "ِي" ; t = "" } ;
eafcilp = { h = "أَ"; m1 = "ْ" ; m2 = "ِ" ; t = "َة" } ;
@@ -47,8 +51,14 @@ flags coding=utf8 ;
eafcul = { h = "أَ"; m1 = "ْ" ; m2 = "ُ" ; t = "" } ;
eiftacal = { h = "إِ"; m1 = "ْتَ" ; m2 = "َ" ; t = "" } ;
eufcil = { h = "أُ"; m1 = "ْ" ; m2 = "ِ" ; t = "" } ;
eufic = fic ** { h = "أُ" } ;
eufIc = fIc ** { h = "أُ" } ;
ufic = fic ** { h = "ُ" } ;
ufIc = fIc ** { h = "ُ" } ;
ufac = fac ** { h = "ُ" } ;
ufAc = fAc ** { h = "ُ" } ;
euftucil = { h = "أُ"; m1 = "ْتُ" ; m2 = "ِ" ; t = "" } ;
euttucil = euftucil ** { h = "اُتُّ" ; m1 = "ِ" } ; ---- IL assimilated VIII
euttucil = euftucil ** { h = "اُتُّ" ; m1 = "ِ" } ; ---- IL assimilated VIII
afcul = { h = "َ" ; m1 = "ْ" ; m2 = "ُ" ; t = "" } ;
faccalo = { h = "" ; m1 = "َ" ; m2 = "َّ" ; t = "ْ" } ;
facal = { h = "" ; m1 = "َ" ; m2 = "َ" ; t = "" } ;
@@ -77,9 +87,12 @@ flags coding=utf8 ;
ficAl = { h = "" ; m1 = "ِ" ; m2 = "َا" ; t = "" } ;
ficlp = { h = "" ; m1 = "ِ" ; m2 = "ْ" ; t = "َة" } ;
ftacal = { h = "" ; m1 = "ْتَ" ; m2 = "َ" ; t = "" } ;
ftical = ftacal ** { m1 = "ْتِ" } ; -- IL hollow VIII
ftAcal = ftacal ** { m1 = "ْتَا" } ; -- IL hollow VIII
ftIcal = ftacal ** { m1 = "ْتِي" } ; -- IL hollow VIII
ftacil = { h = "" ; m1 = "ْتَ" ; m2 = "ِ" ; t = "" } ;
ttacal = ftacal ** { m1 = "" ; h = "تَّ" } ; ---- IL assimilated VIII
ttacil = ftacil ** { m1 = "" ; h = "تَّ" } ; ---- IL assimilated VIII
ttacal = ftacal ** { m1 = "" ; h = "تَّ" } ; ---- IL assimilated VIII
ttacil = ftacil ** { m1 = "" ; h = "تَّ" } ; ---- IL assimilated VIII
fuccAl = { h = "" ; m1 = "ُ" ; m2 = "َّا" ; t = "" } ;
fuccil = { h = "" ; m1 = "ُ" ; m2 = "ِّ" ; t = "" } ;
fuccilo = { h = "" ; m1 = "ُ" ; m2 = "ِّ" ; t = "ْ" } ;

View File

@@ -10,15 +10,16 @@ concrete PhraseAra of Phrase = CatAra ** open
UttQS qs = {s = \\g => qs.s ! QDir} ;
UttImpSg pol imp = {s = \\g => imp.s ! pol.p ! g ! ResAra.Sg ++ pol.s} ;
UttImpPl,UttImpPol = \pol,imp -> {s = \\g => imp.s ! pol.p ! g ! ResAra.Pl ++ pol.s} ;
UttInterj i = {s = \\g => i.s} ;
UttIP ip = {s = \\g => ip.s ! g ! Def ! Nom} ; --IL
UttIP ip = {s = \\g => ip.s ! False ! g ! Def ! Nom} ; --IL
UttAP ap = {s = ResAra.uttAP ap} ; --IL
UttCard c = {s = ResAra.uttNum c} ; --IL
UttCN cn = {s = ResAra.uttCN cn } ; --IL
UttNP np = {s = \\_ => np.s ! Nom} ;
UttVP vp = {s = \\g => (compVP vp).s ! {g=g ; n=Sg} ! Nom} ; --IL
UttS,
UttVP vp = {s = uttVP vp} ; --IL
UttS s = {s = \\_ => s.s ! Verbal} ;
UttAdv,
UttIAdv = \s -> {s = \\_ => s.s} ; ---- OK? AR
--

View File

@@ -1,4 +1,4 @@
concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbAra in {
concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbAra, SentenceAra in {
flags optimize=all_subs ; coding = utf8 ;
@@ -7,97 +7,72 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA
QuestCl cl = {
s = \\t,p =>
table {
QIndir => "إِذا" ++ cl.s ! t ! p ! Verbal ;
QDir => "هَل" ++ cl.s ! t ! p ! Verbal
QIndir => "إِذا" ++ cl.s ! t ! p ! toOrder QIndir ;
QDir => "هَلْ" ++ cl.s ! t ! p ! toOrder QDir
}
};
-- ComplSlashIP vps ip = {} ;
-- AR copied from PredVP
--IL guessed
QuestVP qp vp =
{ s =\\t,p,_ =>
let {
---- o = Verbal ; ---- AR
objgn = pgn2gn vp.obj.a.pgn ;
np = {s = qp.s ! objgn.g ! Def ; ----IL just guessing state
a ={pgn = Per3 Masc qp.n ; isPron = False}} ;
pgn = np.a.pgn ;
gn = pgn2gn pgn;
kataba = vp.s ! pgn ! VPPerf ;
yaktubu = vp.s ! pgn ! VPImpf Ind ;
yaktuba = vp.s ! pgn ! VPImpf Cnj ;
yaktub = vp.s ! pgn ! VPImpf Jus ;
vStr : ResAra.Tense -> Polarity -> Str =
\tn,pl -> case<vp.isPred,tn,pl> of {
<False, ResAra.Pres, Pos> => yaktubu ;
<False, ResAra.Pres, Neg> => "لَا" ++ yaktubu ;
<True, ResAra.Pres, Pos> => "" ; --no verb "to be" in present
<True, ResAra.Pres, Neg> => "لَيسَ" ;--same here, just add negation particle
<_, ResAra.Past, Pos> => kataba ;
<_, ResAra.Past, Neg> => "لَمْ" ++ yaktub ;
<_, ResAra.Fut, Pos> => "سَ" ++ yaktubu ;
<_, ResAra.Fut, Neg> => "لَنْ" ++ yaktuba
};
pred : ResAra.Tense -> Polarity -> Str =
\tn,pl -> case <vp.isPred,tn,pl> of {
<True, ResAra.Pres, Pos> => vp.pred.s ! gn ! Nom; --xabar marfooc
_ => vp.pred.s ! gn ! Acc --xabar kaana wa laysa manSoob
} ;
let np = ip2np qp vp.isPred ;
cl = PredVP np vp ;
in { s = \\t,p,qf => cl.s ! t ! p ! toOrder qf } ;
} in
--- case o of {
---- _ =>
case <False, np.a.isPron> of {
---- AR workaround 18/12/2008 case <vp.obj.a.isPron, np.a.isPron> of {
-- ya2kuluhu
<False,True> => (vStr t p) ++ vp.obj.s ++ vp.s2 ++ (pred t p);
-- ya2kuluhu al-waladu, yakuluhu al-2awlaadu
<False,False> => (vStr t p) ++ np.s ! Nom ++ vp.obj.s ++ vp.s2 ++ (pred t p);
<True,False> => (vStr t p) ++ vp.obj.s ++ np.s ! Nom ++ vp.s2 ++ (pred t p);
<True,True> => (vStr t p) ++ vp.obj.s ++ vp.s2 ++ (pred t p)
};
---- Nominal =>
---- np.s ! Nom ++ (vStr t p) ++ vp.obj.s ++ vp.s2 ++ (pred t p)
}
; ---- };
---- AR guessed
QuestIAdv iadv cl = {s = \\t,p,_ => iadv.s ++ cl.s ! t ! p ! Verbal} ;
QuestIAdv iadv cl = {s = \\t,p,qf => iadv.s ++ cl.s ! t ! p ! toOrder qf} ;
---- IL guessed
QuestIComp icomp np =
let vp = kaan (CompNP np) in
QuestVP icomp vp ;
-- : IComp -> NP -> QCl
QuestIComp ic np =
let vp = UseComp (CompNP np) ; -- puts NP in nominative
ip : ResAra.IP = np ** { -- NP's s is already present in VP, we only want its agr
s = \\_,_,_,_ => ic.s ! pgn2gn np.a.pgn } ;
in QuestVP ip vp ;
CompIP ip = ip ;
-- old, when IComp = Comp { s = \\{g=g ; n=_},c => ip.s ! g ! Def ! c } ; ----
CompIAdv iadv = mkIP iadv.s ResAra.Sg ;
-- QCl = {s : R.Tense => Polarity => QForm => Str} ;
QuestSlash ip cl = { ----IL just guessing
s = \\t,p,qf => case qf of {
QDir => cl.s ! t ! p ! Verbal ++ cl.c2 ++ ip.s ! Masc ! Def ! Nom ; --VSO (purely guessing)
QIndir => cl.s ! t ! p ! Nominal ++ cl.c2 ++ ip.s ! Masc ! Def ! Nom } --SVO (purely guessing)
-- : IP -> IComp ;
CompIP ip = ip ** {
s = \\gn => ip.s ! True -- True=IP will be a subject of predicative sentence
! gn.g -- IComp agrees in gender with eventual head
! Def ! Nom ; -- IP will be a subject
} ;
PrepIP p ip = {s = p.s ++ ip.s ! Masc ! Def ! Acc} ; ----IL
CompIAdv iadv = { s = \\_ => iadv.s ; a = ResAra.Sg } ;
AdvIP ip adv = ip ** {
s = \\g,s,c => ip.s ! g ! s ! c ++ adv.s ;
n = ip.n
-- QCl = {s : Tense => Polarity => QForm => Str} ;
QuestSlash ip cls = { ----IL just guessing
s = \\t,p,qf =>
let cl : ResAra.Cl = complClSlash cls ; -- dummy conversion to Cl
o = toOrder qf
in cls.c2.s ++ ip.s ! False ! Masc ! Def ! Nom ++ cl.s ! t ! p ! o
} ;
--IL guessed
PrepIP p ip = {
s = p.s ++ ip.s ! False -- not used as a subject of predicative sentence
! Masc ----
! Def ! Gen
} ;
AdvIP ip adv = ip ** {
s = \\isPred,g,s,c => ip.s ! isPred ! g ! s ! c ++ adv.s ;
} ;
-- : IDet -> IP
IdetIP idet = idet ** {
s = \\isPred => idet.s ;
a = { pgn = agrP3 NoHum Masc idet.n ; isPron = False }
} ;
----IL guessed with help of L and Google translate
-- : IDet -> IP
IdetIP idet = idet ; -- Gender still matters if turned into IComp
-- : IDet -> CN -> IP
IdetCN idet cn = idet ** {
s = \\g,s,c => idet.s ! cn.g ! s ! c ++ -- gender is determined by the CN
cn.s ! idet.n ! Indef ! Gen ; --idaafa
IdetCN idet cn = {
s = \\isPred,g,s,c
=> idet.s ! cn.g ! s ! c ++
cn2str cn idet.n idet.d Gen ;
a = { pgn = agrP3 NoHum cn.g idet.n ; isPron = False }
} ;
-- : IQuant -> Num -> IDet
@@ -105,6 +80,7 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA
s = \\g,s,c =>
let gend = detGender g num.n -- gender flips with some numbers
in iquant.s ! s ! c ++ num.s ! gend ! s ! c ;
n = sizeToNumber num.n
n = sizeToNumber num.n ;
d = Indef ---- TODO check
} ;
}

View File

@@ -1,35 +1,50 @@
concrete RelativeAra of Relative = CatAra ** open ResAra in {
flags coding=utf8;
--
-- flags optimize=all_subs ;
--
-- lin
--
-- RelCl cl = {
-- s = \\t,a,p,_ => "سُعه" ++ "تهَت" ++ cl.s ! t ! a ! p ! ODir
-- } ;
--
-- RelVP rp vp = {
-- s = \\t,ant,b,ag =>
-- let
-- agr = case rp.a of {
-- RNoAg => ag ;
-- RAg a => a
-- } ;
-- cl = mkClause (rp.s ! Nom) agr vp
-- in
-- cl.s ! t ! ant ! b ! ODir
-- } ;
--
-- RelSlash rp slash = {
-- s = \\t,a,p,_ => slash.c2 ++ rp.s ! Acc ++ slash.s ! t ! a ! p ! ODir
-- } ;
concrete RelativeAra of Relative = CatAra **
open ResAra in {
flags coding=utf8;
lin
RelCl cl = {
s = \\t,p,agr,c => IdRP.s ! agr2ragr agr c ++ cl.s ! t ! p ! Nominal
} ;
-- : RP -> VP -> RCl ; -- who loves John
RelVP rp vp = {
s = \\t,p,agr,c =>
let
npS : Case => Str = \\_ => rp.s ! agr2ragr agr c ;
np : ResAra.NP = agrNP agr ** {s = npS} ;
cl = predVP np vp ;
in
cl.s ! t ! p ! Nominal
} ;
-- : RP -> ClSlash -> RCl ; -- whom John loves
RelSlash rp cls = cls ** {
s = \\t,p,agr,c =>
let --empty : Agr -> NP = emptyNP ;
obj : ResAra.NP = pgn2pron agr.pgn ; -- head is repeated as a clitic object pronoun
cl : ResAra.Cl = complClSlash obj cls ;
in rp.s ! agr2ragr agr c ++ cl.s ! t ! p ! VOS
} ;
--
-- FunRP p np rp = {
-- s = \\c => np.s ! c ++ p.s ++ rp.s ! Acc ;
-- a = RAg np.a
-- } ;
--
-- IdRP = mkIP "وهِعه" "وهِعه" "وهْسي" Sg ** {a = RNoAg} ;
--
IdRP =
{ s = table {
RSg Masc => "اَلَّذِي" ;
RSg Fem => "اَلَّتِي" ;
RPl Masc => "اَلَّذِين" ;
RPl Fem => "اَللَّاتِي" ;
RDl Masc Bare => "اَللَّذَيْن" ;
RDl Masc Nom => "اَللَّذَانِ" ;
RDl Masc _ => "اَللَّذَيْنِ" ;
RDl Fem Bare => "اَللَّتَيْن" ;
RDl Fem Nom => "اَللَّتَانِ" ;
RDl Fem _ => "اَللَّتَيْنِ"
}
} ;
}

View File

@@ -18,8 +18,8 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in {
Number = Sg | Dl | Pl;
Gender = Masc | Fem ;
Case = Nom | Acc | Gen
| Bare ; -- 1st person poss. suff. overrides case
Person = P1 | P2 | P3 ;
| Bare -- 1st person poss. suff. overrides case
| Dat ; -- Hack to make the preposition لِ contract
Species = NoHum | Hum ;
State = Def | Indef | Const
| Poss ; -- ة turns into ت
@@ -27,12 +27,14 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in {
-- case vowel retained
Mood = Ind | Cnj | Jus ;
Voice = Act | Pas ;
Tense = Pres | Past | Fut ;
Order = Verbal | Nominal ;
Order = Verbal | Nominal
| VOS -- Relative clauses with resumptive pronouns
| Subord ; -- Nominal word order but subject in accusative
oper
--roots, patterns, and making words:
-----------------------------------------------------------------------------
-- General morphology with roots, patterns, and making words:
Pattern : Type = {h, m1, m2, t : Str};
Root : Type = {f : Str};
@@ -107,19 +109,57 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in {
--types of open classes:
NTable = Number => State => Case => Str;
emptyNTable : NTable = \\n,s,c => [] ;
Preposition : Type = {s : Str ; c : Case} ;
Noun : Type = {
s,s2 : NTable ;
g : Gender ;
h : Species ;
isDual : Bool -- whether it takes dual instead of plural: eyes, twins, ...
} ;
Noun2 : Type = Noun ** {c2 : Preposition} ;
Noun3 : Type = Noun2 ** {c3 : Preposition} ;
mkPreposition = overload {
mkPreposition : Str -> Case -> Preposition = \s,c -> {s=s;c=c} ;
mkPreposition : Str -> Preposition = \s -> {s=s;c=Gen} ;
} ;
noPrep : Preposition = mkPreposition [] Nom ;
liPrep : Preposition = mkPreposition (
pre { #pronSuffAndOther => "لِ" ;
#pronSuff => "لَ" ;
_ => "لِ"
} ++ BIND) Dat ;
biPrep : Preposition = mkPreposition ("بِ"++BIND) ;
pronSuff : pattern Str = #("كَ"|"كِ"|"كُمَا"|"كُمْ"|"كُنَّ"|"هُ"|"ها"|"هُمَا"|"هُمْ"|"هُنَّ") ;
pronSuffAndOther : pattern Str = #( "كَم" ) ; -- TODO list words that begin like pron.suff. but aren't
Noun : Type = {s : NTable ; g : Gender; h : Species} ;
-- Adj : Type = {s : Gender => NTable} ;
Adj : Type = {s : AForm => Str} ;
Adj2 : Type = Adj ** {c2 : Preposition} ;
Verb : Type = {s : VForm => Str} ;
Verb2 : Type = Verb ** {c2 : Preposition} ;
Verb3 : Type = Verb2 ** {c3 : Preposition} ;
AP : Type = {s : Species => Gender => NTable } ;
uttAP : AP -> (Gender => Str) ;
uttAP ap = \\g => ap.s ! NoHum ! g ! Sg ! Def ! Nom ; ----IL
CN : Type = Noun ** {adj : NTable ; np : Case => Str};
CN : Type = Noun ** {np : Case => Str};
-- All fields of NP
cn2str : CN -> Number -> State -> Case -> Str = \cn,n,s,c ->
cn.s ! n ! s ! c ++
cn.s2 ! n ! s ! c ++
cn.np ! c ;
useN : Noun -> CN = \n -> n ** {np = \\_ => []} ;
uttCN : CN -> (Gender => Str) ;
uttCN cn = \\_ => cn.s ! Sg ! Indef ! Bare ;
uttCN cn = \\_ => cn2str cn Sg Indef Bare ;
NumOrdCard : Type = {
s : Gender => State => Case => Str ;
@@ -127,7 +167,6 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in {
isNum : Bool
} ;
uttNum : NumOrdCard -> (Gender => Str) ;
uttNum n = \\g => n.s ! g ! Def ! Nom ; ----IL
@@ -263,8 +302,11 @@ oper
} ;
--macro for defective verbs:
verbDef : DefForms -> Vowel -> Verb =
\vforms,vowImpf ->
verbDef : DefForms -> Vowel -> Verb = verbDefBool False ;
verbDoubleDef : DefForms -> Vowel -> Verb = verbDefBool True ;
verbDefBool : Bool -> DefForms -> Vowel -> Verb =
\isDoubleDef,vforms,vowImpf ->
let {
rama = vforms ! 0 ; -- VPerf Act (Per3 Masc Sg)
ramay = vforms ! 1 ; -- VPerf Act (Per3 Fem Pl)
@@ -280,13 +322,14 @@ oper
patPerf = patDefPerf rama ramay rumi rumu rumiy ;
patImpfAct = patDefImpfAct armi armu ;
patImp = patDefImp Irmi Irmu
patImp = patDefImp Irmi Irmu ;
suffixImpf = case isDoubleDef of {True => suffixImpfDoubleDef ; _ => suffixImpfDef}
} in
{ s = table {
VPerf v pgn => patPerf ! v ! pgn + suffixPerfDef v ! pgn ;
VImpf m Act pgn => prefixImpf ! pgn + patImpfAct ! pgn + suffixImpfDef Act vowImpf ! m ! pgn ;
VImpf m Pas pgn => prefixImpf ! pgn + urma + suffixImpfDef Pas vowImpf ! m ! pgn ;
VImp g n => patImp ! g ! n + suffixImpfDef Act vowImpf ! Jus ! Per2 g n ;
VPerf v pgn => patPerf ! v ! pgn + suffixPerfDef v ! pgn ;
VImpf m Act pgn => prefixImpf ! pgn + patImpfAct ! pgn + suffixImpf Act vowImpf ! m ! pgn ;
VImpf m Pas pgn => prefixImpf ! pgn + urma + suffixImpf Pas vowImpf ! m ! pgn ;
VImp g n => patImp ! g ! n + suffixImpf Act vowImpf ! Jus ! Per2 g n ;
VPPart => ppart
}
} ;
@@ -352,7 +395,6 @@ oper
Per1 Plur => "نَا"
} ;
suffixImpfDef : Voice -> Vowel -> Mood => PerGenNum => Str = \vc,vw ->
let {
default : Mood -> Str = \m ->
@@ -389,6 +431,10 @@ oper
}
} ;
-- does this even happen other than with رءي? /IL
suffixImpfDoubleDef : Voice -> Vowel -> Mood => PerGenNum => Str = \vc,vw ->
\\m,p => rmSukun (suffixImpfDef vc vw ! m ! p) ;
--now is used for the sound, assimilated (weak C1), and when C1 = hamza:
v1sound : Root3 -> Vowel -> Vowel -> Verb =
@@ -406,8 +452,8 @@ v1sound : Root3 -> Vowel -> Vowel -> Verb =
};
uktab = mkStrong ufcal fcl ;
euktub = case fcl.f of {
"؟"|"و"|"ي" => qif ;
_ => prefixImp ! vowImpf + ktub
"ء"|"و"|"ي" => qif ;
_ => prefixImp ! vowImpf + ktub
};
maktUb = mkStrong mafcUl fcl
} in
@@ -506,7 +552,7 @@ toDefForms : (x1,_,_,_,_,_,_,_,_,_,x11 : Str) -> DefForms =
7 => h ; 8 => i ; 9 => j ; 10 => k
} ;
def1Forms_perfA : Root3 -> Vowel -> DefForms = \rmy,vowImpf ->
v1DefForms_perfA : Root3 -> Vowel -> DefForms = \rmy,vowImpf ->
let {
_rmi = mkDefective (patDef1 ! vowImpf) rmy ;
_rmu = mkDefective (patDef2 ! vowImpf) rmy ;
@@ -524,11 +570,11 @@ def1Forms_perfA : Root3 -> Vowel -> DefForms = \rmy,vowImpf ->
} in toDefForms rama ramay rumi rumu rumiy armi armu urma eirmi eirmu marmiy ;
v1defective_a : Root3 -> Vowel -> Verb = \rmy,vowImpf ->
let vforms = def1Forms_perfA rmy vowImpf
let vforms = v1DefForms_perfA rmy vowImpf
in verbDef vforms vowImpf ;
v1defective_i : Root3 -> Vowel -> Verb = \bqy,vowImpf -> -- IL (conjugation 1d4)
let vforms_a = def1Forms_perfA bqy vowImpf ;
let vforms_a = v1DefForms_perfA bqy vowImpf ;
baqI = mkDefective facIl bqy ;
baqiy = mkDefective facil bqy ;
vforms_i = table { 0 => baqI ;
@@ -536,6 +582,19 @@ v1defective_i : Root3 -> Vowel -> Verb = \bqy,vowImpf -> -- IL (conjugation 1d4)
x => vforms_a ! x } ;
in verbDef vforms_i vowImpf ;
v1doubleweak : Root3 -> Verb = \r'y ->
let ry = r'y ** {c = ""} ;
vforms_doubleweak : DefForms = \\x => rmSukun (v1DefForms_perfA ry a ! x) ; -- only remove the first sukun
vforms_weak : DefForms = v1DefForms_perfA r'y a ;
vforms = table { 0 => vforms_weak ! 0 ; -- all perfect forms
1 => vforms_weak ! 1 ;
2 => vforms_weak ! 2 ;
3 => vforms_weak ! 3 ;
4 => vforms_weak ! 4 ;
x => vforms_doubleweak ! x } ;
in verbDoubleDef vforms a ; -- sukun in suffixes is removed in verbDoubleDef
patDef1 : Vowel => Pattern =
table {
u => fcu ;
@@ -598,24 +657,54 @@ v4sound : Root3 -> Verb =
} in
verb eaqnac euqnic uqnic uqnac eaqnic muqnac;
v4hollow : Root3 -> Verb =
\rwd ->
let {
earad = mkHollow eafac rwd ; -- VPerf Act (Per3 Fem Pl) etc.
earAd = mkHollow eafAc rwd ; -- VPerf Act
eurid = mkHollow eufic rwd ; -- VPerf Pas (Per3 Fem Pl) etc.
eurId = mkHollow eufIc rwd ; -- VPerf Pas
urid = mkHollow ufic rwd ; -- VImpf Act (Per2/Per3 Fem Pl)
urId = mkHollow ufIc rwd ; -- VImpf Act
urad = mkHollow ufac rwd ; -- VImpf Pas (Per2/Per3 Fem Pl)
urAd = mkHollow ufAc rwd ; -- VImpf Pas
earid = mkHollow eafic rwd ; -- VImp (Sg Masc / Pl Fem)
earId = mkHollow eafIc rwd ; -- VImp (Pl Masc / Sg Fem)
ppart = "م" + urAd ;
} in verbHollow (toDefForms
earAd earad eurId eurid
urId urid urAd urad
earId earid ppart) ;
v4DefForms : Root3 -> DefForms = \cTy ->
let {
_cTa = mkDefective fca cTy;
_cTu = mkDefective fcu cTy;
_cTi = mkDefective fci cTy;
eacTa = "أَ" + _cTa; -- VPerf Act (Per3 Masc Sg)
eacTay = mkStrong eafcal cTy ; -- VPerf Act (Per3 Fem Pl)
eucTi = "أُ" + _cTi; -- VPerf Pas (Per3 _ Sg)
eucTu = "أُ" + _cTu; -- VPerf Pas (Per3 Masc Pl)
eucTiy = mkStrong eufcil cTy ; -- VPerf Pas (Per3 Fem Pl)
ucTi = "ُ" + _cTi; -- VImpf Act
ucTu = "ُ" + _cTu; -- VImpf Act (Per2/3 Masc Pl)
ucTa = "ُ" + _cTa; -- VImpf Pas
eacTi = "أَ" + _cTi; -- VImp (Masc Sg / Fem _)
eacTu = "أَ" + _cTu; -- VImp Masc Pl
mucTaY = "م" + ucTa +"ى"
} in toDefForms eacTa eacTay eucTi eucTu eucTiy ucTi ucTu ucTa eacTi eacTu mucTaY ;
v4defective : Root3 -> Verb = \cTy ->
let {
cTa = mkDefective fca cTy;
cTu = mkDefective fcu cTy;
cTi = mkDefective fci cTy;
eacTa = "أَ" + cTa;
eacTay = mkStrong eafcal cTy ;
ucTi = "ُ" + cTi;
eucTi = "أُ" + cTi;
ucTu = "ُ" + cTu;
eucTu = "أُ" + cTu;
eucTiy = mkStrong eufcil cTy ;
ucTa = "ُ" + cTa;
eacTi = "أَ" + cTi;
eacTu = "أَ" + cTu;
mucTaY = "م" + ucTa +"ى"
} in verbDef (toDefForms eacTa eacTay eucTi eucTu eucTiy ucTi ucTu ucTa eacTi eacTu mucTaY) i;
verbDef (v4DefForms cTy) i ;
v4doubleweak : Root3 -> Verb = \r'y ->
let ry = r'y ** {c = ""} ;
vforms : DefForms = \\x => rmSukun (v4DefForms ry ! x) ; -- only remove the first sukun
in verbDoubleDef vforms i ; -- sukun in suffixes is removed in verbDoubleDef
v5sound : Root3 -> Verb =
\nfs ->
@@ -637,6 +726,33 @@ v6sound : Root3 -> Verb =
mutafAqam = "م" + utafAqam
} in verb tafAqam tufUqim atafAqam utafAqam tafAqam mutafAqam;
-- v7sound : Root3 -> Verb = -- TODO 7s
-- \fcl ->
-- let {
-- _facal = mkStrong facal fcl ;
-- _facil = mkStrong facil fcl;
-- infacal = "اِنْ" + _facal ; -- VPerf Act
-- ; -- VPerf Pas
-- anfacil = "َنْ" + _facil ; -- VImpf _ Act
-- ; -- VImpf _ Pas
-- ; -- VImp
-- -- VPPart
-- } in
-- verb ;
v7geminate : Root3 -> Verb = -- IL 7g -- very likely wrong
\fcl ->
let {
_nfacc = "نْ" + mkHollow facc fcl ;
infacal = "اِنْ" + mkStrong facal fcl ; -- VPerf Act -- TODO use another constructor, this is wrong for 3rd person
unfucc = "اُنْ" + mkHollow fucc fcl ; -- VPerf Pas
anfacc = "َ" + _nfacc ; -- VImpf _ Act
unfacc = "ُ" + _nfacc ; -- VImpf _ Pas
infacc = "اِ" + _nfacc ; -- VImp
munfacc = "مُ" +_nfacc -- VPPart
} in
verb infacal unfucc anfacc unfacc infacc munfacc ;
v8sound : Root3 -> Verb =
\rbT ->
let {
@@ -663,11 +779,33 @@ v8assimilated : Root3 -> Verb = --- IL 8a1
muttafaq = "م" + uttafaq
} in verb eittafaq euttufiq attafiq uttafaq eittafiq muttafaq;
v10sound : Root3 -> Verb = ---- IL 10s -- to be checked
v8hollow : Root3 -> Verb = -- IL
\Hwj ->
let {
_Htaj = mkHollow ftacal Hwj ;
_HtAj = mkHollow ftAcal Hwj ;
_Htij = mkHollow ftical Hwj ;
_HtIj = mkHollow ftIcal Hwj ;
iHtaj = "اِ" + _Htaj ; -- VPerf Act (Per3 Fem Pl)
iHtAj = "اِ" + _HtAj ; -- VPerf Act _
uHtij = "اُ" + _Htij ; -- VPerf Pas (Per3 Fem Pl)
uHtIj = "اُ" + _HtIj ; -- VPerf Pas _
aHtaj = "َ" + _Htaj ; -- VImpf Act (Per2/Per3 Fem Pl)
aHtAj = "َ" + _HtAj ; -- VImpf Act _
uHtaj = "ُ" + _Htaj ; -- VImpf Pas (Per2/Per3 Fem Pl)
uHtAj = "ُ" + _Htaj ; -- VImpf Pas _
-- iHtaj again -- VImp Sg Masc / Pl Fem
-- iHtAj again -- VImp Pl Masc / Sg Fem
ppart = "مُ" + _HtAj -- PPart
} in verbHollow (toDefForms
iHtAj iHtaj uHtIj uHtij aHtAj aHtaj
uHtAj uHtaj iHtAj iHtaj ppart) ;
v10sound : Root3 -> Verb = -- IL 10s -- to be checked
\qtl ->
let {
_staqtal = "َستَ" + mkStrong fcal qtl ;
_staqtil = "َستَ" + mkStrong fcil qtl;
_staqtal = "ستَ" + mkStrong fcal qtl ;
_staqtil = "ستَ" + mkStrong fcil qtl;
istaqtal = "اِ" + _staqtal ; -- VPerf Act
ustuqtil = "اُسْتُ" + mkStrong fcil qtl; -- VPerf Pas
astaqtil = "َ" + _staqtil ; -- VImpf _ Act
@@ -677,7 +815,7 @@ v10sound : Root3 -> Verb = ---- IL 10s -- to be checked
} in
verb istaqtal ustuqtil astaqtil astaqtal istaqtil mustaqtal ;
v10hollow : Root3 -> Verb = ---- IL 10h -- to be checked
v10hollow : Root3 -> Verb = -- IL 10h -- to be checked
\xwf ->
let {
_staxaf = "سْتَ" + mkHollow fac xwf ;
@@ -696,10 +834,33 @@ v10hollow : Root3 -> Verb = ---- IL 10h -- to be checked
ustaxAf = "ُ" + _staxAf ; -- VImpf Pas _
ppart = "مُ" + _staxIf -- PPart ("weird anomalies" here too?)
} in verbHollow (toDefForms
} in verbHollow (toDefForms
istaxAf istaxaf ustuxIf ustuxif astaxIf astaxif
ustaxAf ustaxaf istaxif istaxIf ppart) ;
v10defective : Root3 -> Verb = -- IL
\lqy ->
let {
_stalqa = "سْتَ" + mkDefective fca lqy ;
_stalqu = "سْتَ" + mkDefective fcu lqy ;
_stalqi = "سْتَ" + mkDefective fci lqy ;
_stulqi = "سْتُ" + mkDefective fci lqy ;
istalqa = "اِ" + _stalqa ; -- VPerf Act (Per3 Masc Sg)
istalqay = "اِسْتَ" + mkStrong fcal lqy ; -- VPerf Act (Per3 Fem Pl)
ustulqi = "اُ" + _stulqi; -- VPerf Pas (Per3 _ _)
astalqu = "َ" + _stalqu ; -- VImpf Act (Per2/3 Masc Pl)
astalqi = "َ" + _stalqi ; -- VImpf Act _
ustalqa = "ُ" + _stalqa ; -- VImpf Pas _
istalqi = "اِ" + _stalqi; -- VImp (Masc Sg / Fem _)
istalqu = "اِ" + _stalqu; -- VImp Masc Pl
mustalqin = "مُ" + _stalqi + "ت" ;
} in verbDef (toDefForms
istalqa istalqay ustulqi ustulqi ustulqi
astalqi astalqu ustalqa istalqi istalqu mustalqin) i ;
patV1Perf : Vowel => Pattern =
table {
a => facal ; --katab
@@ -723,8 +884,8 @@ endVowel : Mood => Str =
prefixImp : Vowel => Str =
table {
u => "أُ" ;
_ => "إِ"
u => "اُ" ;
_ => "اِ"
} ;
patHollowPerf : (_,_,_,_ :Str) -> Voice => PerGenNum => Str = \xAf,xif,xIf,xuf ->
@@ -795,7 +956,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
Bare => [] ;
Nom => "ُ";
Acc => "َ";
Gen => "ِ"
_Gen => "ِ" -- dat is the same as gen, except in definite before لِ
};
--takes the adjective lemma and gives the Posit table
@@ -825,7 +986,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
-- indeclinable nominal word (mamnuu3 mina S-Sarf)
indeclN : Str -> State => Case => Str =
\aHmar -> \\s,c => defArt s aHmar + indecl!c;
\aHmar -> \\s,c => defArt s c aHmar + indecl!c;
-- takes 2 words, singular and broken plural, and gives the
-- complete noun inflection table
@@ -860,12 +1021,14 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
-- takes a singular or broken plural word and tests the ending to
-- determine the declension and gives the corresponding inf table
sing : Str -> State => Case => Str = \word ->
\\s,c => defArt s (case word of {
lemma + "ِي" => fixShd lemma (dec2sg ! s ! c) ;
_ + ("ا"|"ى") => fixShd word (dec3sg ! s ! c) ;
lemma + "ة" => case s of {
\\s,c => defArt s c (case word of {
lemma + "ِيّ" => fixShd word (decNisba ! s ! c) ;
lemma + "ِي" => fixShd lemma (dec2sg ! s ! c) ;
_ + ("ا"|"ى") => fixShd word (dec3sg ! s ! c) ;
lemma + ("ء"|"أ"|"ئ"|"ؤ") => word + dec1sgNoDoubleAlif ! s ! c ;
lemma + "ة" => case s of {
Poss => lemma + "ت" + dec1sg ! s ! c ;
_ => word + dec1sg ! s ! c
_ => word + dec1sgNoDoubleAlif ! s ! c
} ;
_ => fixShd word (dec1sg ! s ! c)
}) ;
@@ -874,7 +1037,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
-- takes a singular word and tests the ending to
-- determine the declension and gives the corresponding dual inf table
dual : Str -> State => Case => Str = \caSaA ->
\\s,c => defArt s (case caSaA of {
\\s,c => defArt s c (case caSaA of {
lemma + ("ا"|"ى") => lemma + "ي" + dl ! s ! c ;
lemma + "ة" => lemma + "ت" + dl ! s ! c ;
_ => fixShd caSaA (dl ! s ! c)
@@ -884,13 +1047,13 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
--plural feminine table
plurF : Str -> State => Case => Str =
\kalima ->
\\s,c => defArt s (mkAt kalima) + f_pl ! s ! c ;
\\s,c => defArt s c (mkAt kalima) + f_pl ! s ! c ;
-- takes a singular word and gives the corresponding sound
--plural masculine table. FIXME: consider declension 3
plurM : Str -> State => Case => Str =
\mucallim ->
\\s,c => defArt s mucallim + m_pl ! s ! c ;
\\s,c => defArt s c mucallim + m_pl ! s ! c ;
-- to add the Al prefix for Definite words
Al : State => Str =
@@ -899,14 +1062,14 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
_ => ""
};
defArt : State -> Str -> Str = \st,stem -> -- IL -- to be checked
defArt : State -> Case -> Str -> Str = \st,c,stem -> -- IL -- to be checked
let al = "ال" in
case st of {
Def =>
case <st,c> of {
<Def,Dat> => "ل" + stem ; -- only happens before the preposition لِ
<Def> =>
case stem of {
s@#sun + v@#vow + x => al + s + v + "ّ" + x ; -- vowel before shadda
s@#sun + x => al + s + "ّ" + x;
x => al + x } ;
s@#sun + x => fixShd (al + s) ("ّ" + x) ;
x => al + x } ;
_ => stem
};
@@ -917,18 +1080,25 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
table {
Bare => [];
Nom => "ٌ";
Acc => "ً";
Gen => "ٍ"
Acc => "اً";
_Gen => "ٍ"
};
_ => caseTbl --think of ?axU, ?axA, (the five nouns)
};
-- if a word ends in ء or ة, don't add alif for indef acc.
dec1sgNoDoubleAlif : State => Case => Str = \\s,c =>
case <s,c> of {
<Indef,Acc> => "ً" ;
_ => dec1sg ! s ! c
};
--indeclinables (mamnuu3 mina S-Sarf)
indecl : Case => Str =
table {
Gen => "َ" ;
x => caseTbl ! x
(Gen|Dat) => "َ" ;
x => caseTbl ! x
};
@@ -942,6 +1112,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
_ => "ِي"
};
--declension 3 (ending in alif)
dec3sg : State => Case => Str = \\s,c =>
case <s,c> of {
@@ -950,6 +1121,15 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
_ => []
};
--declension 2 (ends in yaa')
decNisba : State => Case => Str = \\s,c =>
case <s,c> of {
<_, Bare> => [] ;
<Indef,Acc> => "اً" ;
<Indef> => "ٍ" ;
<_, Acc> => "َ" ;
_ => []
};
--dual suffixes
dl : State => Case => Str =
@@ -1051,7 +1231,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
<NonTeen,_> => Acc;
<ThreeTen,_> => Gen;
<Hundreds,_> => Gen;
<_,Const> => Gen;
<_,Const> => Gen; -- not sure if this is an actual rule /IL
_ => c
};
@@ -1102,9 +1282,14 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
}
};
gn2pgn : {g : Gender; n : Number} -> PerGenNum = \gn ->
case gn of { {g = gn; n = nm} => Per3 gn nm } ;
-- these are chosen in many places, trying to be consistent
toOrder : QForm -> Order = \qf ->
case qf of { QIndir => Nominal ;
QDir => Verbal } ;
mkIP : Str -> Number -> IP =
\s,n -> {s = \\_g,_s,_c => s ; n = n} ;
mkOrd : (_,_ : Str) -> Size -> NumOrdCard =
\aysar,yusra,sz ->
@@ -1118,7 +1303,9 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
};
oper
-----------------------------------------------------------------------------
-- Det, Quant
BaseQuant : Type = {
d : State;
@@ -1148,53 +1335,172 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
Agr = { pgn : PerGenNum; isPron : Bool} ;
AAgr = { g : Gender ; n : Number} ;
Comp : Type = {
s : AAgr => Case => Str
} ;
Obj : Type = {
s : Str ;
a : Agr
};
-----------------------------------------------------------------------------
-- NP, Pron
NP : Type = {
s : Case => Str ;
a : Agr
a : Agr ;
empty : Str -- to prevent ambiguities with prodrop
} ;
mkPron : (_,_,_ : Str) -> PerGenNum -> NP = \ana,nI,I,pgn ->
{ s =
table {
(Nom|Bare) => ana;
Acc => nI ; -- object suffix
Gen => I ; -- possessive suffix
Dat => I -- will only be used with preposition لِ
};
a = {pgn = pgn; isPron = True };
empty = []
};
proDrop : NP -> NP = \np ->
case np.a.isPron of {
True => np ** {s = table {Nom => [] ; x => np.s ! x}};
_ => np
} ;
emptyNP : NP = {
s = \\_ => [] ;
a = {pgn = Per3 Masc Sg ; isPron = False} ;
empty = [] } ;
agrNP : Agr -> NP = \agr -> emptyNP ** {a = agr} ;
i_Pron : NP = mkPron "أَنَا" "نِي" "ي" (Per1 Sing) ;
we_Pron : NP = mkPron "نَحنُ" "نا" "نا" (Per1 Plur) ;
youSgMasc_Pron : NP = mkPron "أَنتَ" "كَ" "كَ" (Per2 Masc Sg) ;
youSgFem_Pron : NP = mkPron "أَنتِ" "كِ" "كِ" (Per2 Fem Sg) ;
youDlMasc_Pron : NP = mkPron "أَنتُمَا" "كُمَا" "كُمَا" (Per2 Masc Dl) ;
youDlFem_Pron : NP = mkPron "أَنتُمَا" "كُمَا" "كُمَا" (Per2 Fem Dl) ;
youPlMasc_Pron : NP = mkPron "أَنتُمْ" "كُمْ" "كُمْ" (Per2 Masc Pl) ;
youPlFem_Pron : NP = mkPron "أَنتُنَّ" "كُنَّ" "كُنَّ" (Per2 Fem Pl) ;
he_Pron : NP = mkPron "هُوَ" "هُ" "هُ" (Per3 Masc Sg) ;
she_Pron : NP = mkPron "هِيَ" "ها" "ها" (Per3 Fem Sg) ;
theyDlMasc_Pron : NP = mkPron "هُمَا" "هُمَا" "هُمَا" (Per3 Masc Dl) ;
theyDlFem_Pron : NP = mkPron "هُمَا" "هُمَا" "هُمَا" (Per3 Fem Dl) ;
theyMasc_Pron : NP = mkPron "هُمْ" "هُمْ" "هُمْ" (Per3 Masc Pl) ;
theyFem_Pron : NP = mkPron "هُنَّ" "هُنَّ" "هُنَّ" (Per3 Fem Pl) ;
-- Used e.g. to encode the subject as an object clitic
-- or to find a possessive suffix corresponding to the NP.
-- If the NP is a pronoun, just use itself.
np2pron : NP -> NP = \np -> case np.a.isPron of {
True => np ;
False => pgn2pron np.a.pgn
} ;
pgn2pron : PerGenNum -> NP = \pgn ->
case pgn of {
Per1 Sing => i_Pron ;
Per1 Plur => we_Pron ;
Per2 Fem Sg => youSgFem_Pron ;
Per2 Masc Sg => youSgMasc_Pron ;
Per2 Fem Dl => youDlFem_Pron ;
Per2 Masc Dl => youDlMasc_Pron ;
Per2 Fem Pl => youPlFem_Pron ;
Per2 Masc Pl => youPlMasc_Pron ;
Per3 Fem Sg => she_Pron ;
Per3 Masc Sg => he_Pron ;
Per3 Fem Dl => theyDlFem_Pron ;
Per3 Masc Dl => theyDlMasc_Pron ;
Per3 Fem Pl => theyFem_Pron ;
Per3 Masc Pl => theyMasc_Pron
} ;
pron2np : NP -> NP = \np -> np ** {
a = np.a ** {isPron=False} -- hack, sometimes we *don't* want prodrop
} ;
reflPron : Case -> PerGenNum -> Str = \c,pgn ->
let pron : NP = pgn2pron pgn
in "نَفْس" + caseTbl ! c ++ pron.s ! Gen ;
reflV : Verb -> Verb = \v -> v ** {
s = \\vf => case vf of {
VPerf _ pgn => v.s ! vf ++ reflPron Acc pgn ;
VImpf _ _ pgn => v.s ! vf ++ reflPron Acc pgn ;
VImp g n => v.s ! vf ++ reflPron Acc (Per2 g n) ;
VPPart => v.s ! vf ++ reflPron Acc (Per3 Masc Sg) ----
}
} ;
-----------------------------------------------------------------------------
-- IP, questions
IP : Type = {
s : Gender -- because of CompIP
s : Bool -- different forms for "what is this" and "what do you do"
=> Gender -- because an IP can be made into an IComp
=> State => Case -- because of PrepIP: e.g. "in which" chooses definite accusative
=> Str ;
n : Number
a : Agr -- can be both subject and object of a QCl, needs full agr. info (stupid given that s depends on gender but meh)
} ;
param VPForm =
mkIP = overload {
mkIP : Str -> Number -> IP = \maa,n -> {
s = \\_p,_g,_s,_c => maa ;
a = { pgn = agrP3 NoHum Masc n ; isPron = False }
} ;
mkIP : (_,_ : Str) -> Number -> IP = \maa,maadhaa,n -> {
s = table { True => \\_g,_s,_c => maa ;
False => \\_g,_s,_c => maadhaa } ;
a = { pgn = agrP3 NoHum Masc n ; isPron = False }
}
} ;
ip2np : IP -> Bool -> NP = \ip,isPred -> ip ** { s = ip.s ! isPred ! Masc ! Def ; empty = [] } ;
np2ip : NP -> IP = \np -> np ** {s = \\_,_,_ => np.s} ;
IDet : Type = {
s : Gender -- IdetCN needs to choose the gender of the CN
=> State -- Needs to be retained variable for IP; PrepIP chooses the state of IP
=> Case => Str ;
n : Number ;
d : State -- in IdetCN, chooses the state of the CN
} ;
IQuant : Type = {
s : State => Case => Str
} ;
IComp : Type = {
s : AAgr -- "how old": masc or fem for adjective
-- no need for Case, IComp is only used by QuestIComp, as grammatical subject
=> Str ;
} ;
-----------------------------------------------------------------------------
-- VP
param VPForm =
VPPerf
| VPImpf Mood
| VPImp ;
oper
VP : Type = {
s : PerGenNum => VPForm => Str;
BaseVP : Type = { -- to minimise duplication of code for VPS
sc : Preposition ; -- subject case: e.g. يُمْكِنُ *لِ*Xِ
obj : Obj;
pred : Comp;
isPred : Bool; --indicates if there is a predicate (xabar)
s2 : Str
};
-- For complements of VV.
-- TODO: does verbal complement agree with the noun
compVP : VP -> Comp = \vp -> ---- IL
{ s = table {
aagr@{g=g ; n=n} => \\c =>
vp.s ! Per3 g n ! VPImpf Ind ---- IL guesswork + https://arabic.desert-sky.net/g_modals.html
++ vp.s2
++ vp.pred.s ! aagr ! Acc
++ vp.obj.s }
} ;
VP : Type = BaseVP ** {
s : PerGenNum => VPForm => Str ;
} ;
uttVP : VP -> (Gender=>Str) = \vp ->
\\g => vp.s ! Per3 g Sg ! VPPerf
++ vp.obj.s ++ vp.pred.s ! {n = Sg ; g = g} ! Nom
++ vp.s2 ;
predV : Verb -> VP = \v ->
{ s = \\pgn,vf =>
let gn = pgn2gn pgn in
@@ -1203,17 +1509,94 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
VPImpf m => v.s ! (VImpf m Act pgn);
VPImp => v.s ! (VImp gn.g gn.n)
};
obj = {
s = [] ;
a = {pgn = Per3 Masc Sg ; isPron = False}
}; --or anything!
sc = noPrep ;
obj = emptyObj ;
s2 = [];
pred = { s = \\_,_ => []};
pred = {s = \\_,_ => []} ;
isPred = False
};
predVSlash : Verb ** {c2 : Str} -> VPSlash = \v ->
predV v ** {c2 = v.c2} ;
passPredV : Verb -> VP = \v ->
let actVP = predV v in actVP ** {
s = \\pgn,vf =>
case vf of {
VPPerf => v.s ! (VPerf Pas pgn) ;
VPImpf m => v.s ! (VImpf m Pas pgn) ;
_ => actVP.s ! pgn ! vf
}
};
predVP : NP -> VP -> Cl = \np,vp ->
{ s =\\t,p,o =>
let {
pgn =
case <o,np.a.isPron> of {
<Verbal, False> => verbalAgr np.a.pgn;
_ => np.a.pgn
};
sc : Preposition = case o of { -- very unsure of this /IL
Subord => {s=[]; c=Acc} ; -- to prevent weird stuff with VVs
_ => case np.a.isPron of {True => noPrep; _ => vp.sc}
} ;
subj = np.empty ++ sc.s
++ case vp.isPred of {
False => (proDrop np).s ! sc.c ; -- prodrop if it's not predicative
True => np.s ! sc.c
} ;
} in wordOrder o
vp.obj.a.isPron np.a.isPron
(vStr vp pgn t p)
vp.obj.s
(pred vp pgn t p)
vp.s2
subj
} ;
-- seems complicated, but this is to share code with VPS and other similar structures
wordOrder : Order -> (objIsPron,subjIsPron : Bool) -> (verb,obj,pred,adv,subj : Str) -> Str =
\o,objIsPron,subjIsPron,verb,obj,pred,adv,subj ->
let cl = wordOrderNoSubj o objIsPron verb obj pred adv in
case o of {
Subord =>
let bind = if_then_Str subjIsPron BIND [] -- in subord. clause, subj. pronoun binds to the main verb
in cl.before ++ bind ++ subj ++ cl.after ;
_ => cl.before ++ subj ++ cl.after
} ;
wordOrderNoSubj : Order -> (objIsPron : Bool) -> (verb,obj,pred,adv : Str) -> {before,after : Str} =
\o,objIsPron,verb,obj,pred,adv ->
case o of {
VOS => {before = verb ++ obj ++ pred ++ adv; after = []} ;
Verbal => case objIsPron of {
True => {before = verb ++ obj ; after = adv ++ pred} ; -- obj. clitic attaches directly to the verb
False => {before = verb ; after = obj ++ adv ++ pred}
} ;
(Nominal|Subord) => {before = [] ; after = verb ++ obj ++ adv ++ pred}
} ;
pred : VP -> PerGenNum -> ParamX.Tense -> Polarity -> Str = \vp,pgn,tn,pl ->
let gn = pgn2gn pgn
in case <vp.isPred,tn,pl> of {
<True, Pres, Pos> => vp.pred.s ! gn ! Nom; --xabar marfooc
_ => vp.pred.s ! gn ! Acc --xabar kaana wa laysa manSoob
} ;
vStr : VP -> PerGenNum -> ParamX.Tense -> Polarity -> Str = \vp,pgn,tn,pl ->
let kataba = vp.s ! pgn ! VPPerf ;
yaktubu = vp.s ! pgn ! VPImpf Ind ;
yaktuba = vp.s ! pgn ! VPImpf Cnj ;
yaktub = vp.s ! pgn ! VPImpf Jus ;
in case <vp.isPred,tn,pl> of {
<False, Pres, Pos> => yaktubu ;
<False, Pres, Neg> => "لَا" ++ yaktubu ;
<True, Pres, Pos> => "" ; --no verb "to be" in present
<True, Pres, Neg> => "لَيسَ" ;--same here, just add negation particle
<_, Past, Pos> => kataba ;
<_, Past, Neg> => "لَمْ" ++ yaktub ;
<_, Cond, _ > => yaktuba ;
<_, Fut, Pos> => glue "سَ" yaktubu ;
<_, Fut, Neg> => "لَنْ" ++ yaktuba
} ;
-- in verbal sentences, the verb agrees with the subject
-- in Gender but not in number
@@ -1223,10 +1606,38 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
_ => pgn
};
insertObj : NP -> VPSlash -> VP = \np,vp -> vp **
{ obj = {s = vp.obj.s ++ vp.c2 ++ np.s ! Acc ; a = np.a} };
-----------------------------------------------------------------------------
-- Comp, arguments for VP
insertPred : {s : AAgr => Case => Str} -> VP -> VP = \p,vp -> vp **
Comp : Type = {
s : AAgr => Case => Str ;
} ;
Obj : Type = {
s : Str ;
a : Agr -- default Agr in a VP without real Obj is Per3 Masc Sg.
}; -- need isPron for word order in predVP, and pgn for ImpersCl
Subj : Type = {s : Case => Str ; isPron : Bool} ;
np2subj : NP -> Subj = \np -> np ** {isPron = np.a.isPron} ;
subj2np : Subj -> NP = \su -> su ** {a = {pgn = emptyNP.a.pgn ; isPron = su.isPron} ; empty=[]} ;
emptyObj : Obj = emptyNP ** {s=[]} ;
insertObj : NP -> VPSlash -> VP = \np,vp -> vp ** {
obj = {s = vp.obj.s -- old object, if there was one
++ bindIfPron np vp -- new object, bind if pronoun and not pred
++ vp.agrObj ! np.a.pgn ; -- only used for SlashV2V
a = np.a}
} ;
bindIfPron : NP -> {c2:Preposition; isPred:Bool} -> Str = \np,vp ->
let bind = case <vp.isPred,np.a.isPron> of {
<False,True> => BIND ;
_ => [] }
in vp.c2.s ++ bind ++ np.s ! vp.c2.c ;
insertPred : Comp -> VP -> VP = \p,vp -> vp **
{ pred = p;
isPred = True
};
@@ -1235,16 +1646,69 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
{ s2 = vp.s2 ++ str };
kaan : {s : AAgr => Case => Str} -> VP = \xabar ->
insertPred xabar (predV (v1hollow {f = "ك"; c = "و" ; l = "ن"} u) );
insertPred xabar (predV copula);
-- Slash categories
VPSlash : Type = VP ** {c2 : Str} ;
ClSlash : Type = Cl ** {c2 : Str} ;
copula : Verb = v1hollow {f = "ك"; c = "و" ; l = "ن"} u ;
-----------------------------------------------------------------------------
-- Slash categories
VPSlash : Type = VP ** {c2 : Preposition ; agrObj : PerGenNum => Str} ;
ClSlash : Type = VPSlash ** {subj : Subj} ;
emptyVPslash : VP -> VPSlash = \vp -> vp ** {
c2 = noPrep ; agrObj = \\_ => []
} ;
slashV2 : Verb2 -> VPSlash = \v ->
predV v ** {c2 = v.c2 ; agrObj = \\_ => []} ;
-- Add subject string, fix agreement to the subject,
-- but keep the structure as VP, because later on
-- we might need different word orders for the ClSlash.
predVPSlash : NP -> VPSlash -> ClSlash = \np,v -> v ** {
subj = np2subj np ;
s = \\_pgn,vf => v.s ! np.a.pgn ! vf -- so we can throw away subject's pgn
} ;
complClSlash = overload {
complClSlash : NP -> ClSlash -> Cl = \obj,cls ->
predVP (subj2np cls.subj) (insertObj obj cls) ;
complClSlash : ClSlash -> Cl = \cls ->
predVP (subj2np cls.subj) (insertObj emptyNP cls) -- Empty subject and object
} ;
Cl : Type = {s : Tense => Polarity => Order => Str} ;
QCl : Type = {s : Tense => Polarity => QForm => Str} ;
--TODO: slashRCl : ClSlash -> RP -> RCl ;
forceOrder : Order -> Cl -> Cl = \o,cl ->
{s = \\t,p,_ => cl.s ! t ! p ! o} ;
-----------------------------------------------------------------------------
-- Relative
param
RAgr = RSg Gender | RPl Gender | RDl Gender Case ;
oper
agr2ragr = overload {
agr2ragr : Agr -> Case -> RAgr = \a,c ->
let gn = pgn2gn a.pgn in case <gn.n,gn.g,a> of {
<Sg,x> => RSg x ;
<Dl,x> => RDl x c ;
<Pl,x> => RPl x } ;
agr2ragr : Number -> Case -> Gender -> RAgr = \n,c,g ->
case n of {
Sg => RSg g ;
Dl => RDl g c ;
Pl => RPl g }
} ;
RCl : Type = {s : Tense => Polarity => Agr => Case => Str} ;
RP : Type = {s : RAgr => Str } ;
-----------------------------------------------------------------------------
-- Num
param
@@ -1268,23 +1732,23 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
\wAhid,awwal,Ula ->
let wAhida : Str = case wAhid of {
x + "ة" => mkAt wAhid ;
_ => wAhid + "َة" }
_ => wAhid + "َة" }
in
{ s= table {
unit => table {
NCard => table {
Masc => \\s,c => (sing wAhid) ! s ! c ;
--all fem are first declension:
Fem => \\s,c => defArt s wAhida + dec1sg ! s ! c
Fem => \\s,c => defArt s c wAhida + dec1sgNoDoubleAlif ! s ! c
};
NOrd => table {
Masc => \\s,c => defArt s awwal + dec1sg ! s ! c;
Masc => \\s,c => defArt s c awwal + dec1sg ! s ! c;
Fem => \\s,c => (sing Ula) ! s ! c
}
};
ten => table {
NCard => \\_,s,c => defArt s wAhid + m_pl ! Indef ! c;
NOrd => \\_,s,c => defArt s awwal + m_pl ! Indef ! c
NCard => \\_,s,c => defArt s c wAhid + m_pl ! Indef ! c;
NOrd => \\_,s,c => defArt s c awwal + m_pl ! Indef ! c
}
}
};
@@ -1333,6 +1797,4 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
Masc => Fem;
Fem => Masc
};
}

View File

@@ -26,67 +26,16 @@ concrete SentenceAra of Sentence = CatAra ** open
}
};
-}
PredVP np vp =
{ s =\\t,p,o =>
let {
pgn =
case <o,np.a.isPron> of {
<Verbal, False> => verbalAgr np.a.pgn;
_ => np.a.pgn
};
gn = pgn2gn pgn;
kataba = vp.s ! pgn ! VPPerf ;
yaktubu = vp.s ! pgn ! VPImpf Ind ;
yaktuba = vp.s ! pgn ! VPImpf Cnj ;
yaktub = vp.s ! pgn ! VPImpf Jus ;
vStr : ResAra.Tense -> Polarity -> Str =
\tn,pl -> case<vp.isPred,tn,pl> of {
<False, ResAra.Pres, Pos> => yaktubu ;
<False, ResAra.Pres, Neg> => "لَا" ++ yaktubu ;
<True, ResAra.Pres, Pos> => "" ; --no verb "to be" in present
<True, ResAra.Pres, Neg> => "لَيسَ" ;--same here, just add negation particle
<_, ResAra.Past, Pos> => kataba ;
<_, ResAra.Past, Neg> => "لَمْ" ++ yaktub ;
<_, ResAra.Fut, Pos> => "سَ" ++ yaktubu ;
<_, ResAra.Fut, Neg> => "لَنْ" ++ yaktuba
};
pred : ResAra.Tense -> Polarity -> Str =
\tn,pl -> case <vp.isPred,tn,pl> of {
<True, ResAra.Pres, Pos> => vp.pred.s ! gn ! Nom; --xabar marfooc
_ => vp.pred.s ! gn ! Acc --xabar kaana wa laysa manSoob
};
} in
case o of {
Verbal =>
--case <False, np.a.isPron> of { ---- AR workaround 18/12/2008
case <vp.obj.a.isPron, np.a.isPron> of {
{- IL: I don't think we should do prodrop here. vStr drops the copula in present tense,
so there's hardly anything left for a predicative clause: e.g.
PredVP (UsePron i_Pron) (UseComp (CompCN (UseN car_N))) "I am a car"
would be linearised just as "car", if we have both prodrop and copula drop.
Leaving it up to someone who knows Arabic to decide what is better.
Original here:
<True,True> => (vStr t p) ++ vp.obj.s ++ vp.s2 ++ (pred t p) ;
-- ya2kuluhu
<False,True> => (vStr t p) ++ vp.obj.s ++ vp.s2 ++ (pred t p); -}
-- ya2kuluhu al-waladu, yakuluhu al-2awlaadu
<False> => (vStr t p) ++ np.s ! Nom ++ vp.obj.s ++ vp.s2 ++ (pred t p);
<True> => (vStr t p) ++ vp.obj.s ++ np.s ! Nom ++ vp.s2 ++ (pred t p)
};
Nominal =>
np.s ! Nom ++ (vStr t p) ++ vp.obj.s ++ vp.s2 ++ (pred t p)
}
};
PredVP = predVP ;
-- PredSCVP sc vp = mkClause sc.s (agrP3 Sg) vp ;
ImpVP vp = {
s = \\p,g,n =>
case p of {
Pos => vp.s ! (Per2 g n) ! VPImp ++ vp.obj.s ++ vp.s2 ;
Neg => "لا" ++ vp.s ! (Per2 g n) ! (VPImpf Jus) ++ vp.obj.s ++ vp.s2
}
Pos => vp.s ! Per2 g n ! VPImp ;
Neg => "لَا" ++ vp.s ! Per2 g n ! VPImpf Jus
} ++ vp.obj.s ++ vp.pred.s ! {g=g;n=n} ! Acc ++ vp.s2
};
--
@@ -100,9 +49,11 @@ concrete SentenceAra of Sentence = CatAra ** open
-- ClSlash
SlashVP np vps = PredVP np vps ** { c2 = vps.c2 } ;
SlashVP = predVPSlash ;
AdvSlash slash adv = slash ** { s2 = slash.s2 ++ adv.s } ;
SlashPrep cl prep = cl ** {c2 = prep.s} ;
-- : Cl -> Prep -> ClSlash
-- SlashPrep cl prep = TODO
-- SlashVS np vs sslash = TODO
@@ -113,22 +64,26 @@ concrete SentenceAra of Sentence = CatAra ** open
--
UseCl t p cl =
{s = case <t.t,t.a> of { --- IL guessed tenses
<(Pres|Cond),Simul> => cl.s ! ResAra.Pres ! p.p ! Verbal ;
<Fut ,_ > => cl.s ! ResAra.Fut ! p.p ! Verbal ;
<_ ,_ > => cl.s ! ResAra.Past ! p.p ! Verbal
{s = \\o => t.s ++ p.s ++
case <t.t,t.a> of { --- IL guessed tenses
<Pres,Simul> => cl.s ! Pres ! p.p ! o ;
<Pres,Anter> => cl.s ! Past ! p.p ! o ;
<x ,_ > => cl.s ! x ! p.p ! o
}
};
UseQCl t p qcl =
{s = \\q =>
case <t.t,t.a> of { --- IL guessed tenses
<(Pres|Cond),Simul> => qcl.s ! ResAra.Pres ! p.p ! q ;
<Fut ,_ > => qcl.s ! ResAra.Fut ! p.p ! q ;
<_ ,_ > => qcl.s ! ResAra.Past ! p.p ! q
{s = \\q => t.s ++ p.s ++
case <t.t,t.a> of { --- IL guessed tenses
<Pres,Simul> => qcl.s ! Pres ! p.p ! q ;
<Pres,Anter> => qcl.s ! Past ! p.p ! q ;
<x ,_ > => qcl.s ! x ! p.p ! q
}
};
-- UseRCl t a p cl = {s = \\r => t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! p.p ! r} ;
UseRCl t p cl = {s = \\agr,c => t.s ++ p.s ++ cl.s ! t.t ! p.p ! agr ! c} ;
UseSlash t p cl = UseCl t p (complClSlash cl) ;
AdvS adv s = s ** {s = \\o => adv.s ++ s.s ! o} ;
}

View File

@@ -4,8 +4,8 @@ concrete StructuralAra of Structural = CatAra **
flags optimize=all ; coding=utf8 ;
lin
above_Prep = ss "فَوْقَ" ;
after_Prep = ss "بَعْدَ" ;
above_Prep = mkPrep "فَوْقَ" ;
after_Prep = mkPrep "بَعْدَ" ;
all_Predet = mkPredet "كُلّ" True ;
almost_AdA = ss "تَقْرِيباً";
almost_AdN = ss "حَوَالي" ; -- or "تَقرِيبا"
@@ -13,20 +13,20 @@ concrete StructuralAra of Structural = CatAra **
-- always_AdV = ss "َلوَيس" ;
and_Conj = ss "وَ" ** {n = Pl} ;
-- because_Subj = ss "بعَُسي" ;
before_Prep = ss "قَبْلَ" ;
behind_Prep = ss "خَلْفَ" ;
between_Prep = ss "بَيْنَ" ;
before_Prep = mkPrep "قَبْلَ" ;
behind_Prep = mkPrep "خَلْفَ" ;
between_Prep = mkPrep "بَيْنَ" ;
-- both7and_DConj = sd2 "بْته" "َند" ** {n = Pl} ;
-- but_PConj = ss "بُت" ;
by8agent_Prep = ss "بِ" ;
by8means_Prep = ss "بِ" ;
by8agent_Prep,
by8means_Prep = biPrep ;
can_VV = mkVV (mkV "طوع" FormX) ;
-- can8know_VV = {
-- s = table VVForm [["بي َبلي تْ"] ; "عَن" ; "عُْلد" ;
-- ["بّن َبلي تْ"] ; ["بِنغ َبلي تْ"] ; "عَنءت" ; "عُْلدنءت"] ;
-- isAux = True
-- } ;
during_Prep = ss "خِلَالَ" ;
during_Prep = mkPrep "خِلَالَ" ;
-- either7or_DConj = sd2 "ِتهر" "ْر" ** {n = Sg} ;
everybody_NP = regNP "الجَمِيع" Pl ;
every_Det = mkDet "كُلّ" Sg Const ;
@@ -34,18 +34,23 @@ concrete StructuralAra of Structural = CatAra **
-- everywhere_Adv = ss "ثريوهري" ;
few_Det = mkDet "بَعض" Pl Const ;
-- first_Ord = ss "فِرست" ;
from_Prep = ss "مِنَ" ;
he_Pron = mkPron "هُوَ" "هُ" "هُ" (Per3 Masc Sg) ;
for_Prep = liPrep ;
from_Prep = mkPrep "مِنَ" ;
he_Pron = ResAra.he_Pron ;
here_Adv = ss "هُنا" ;
-- here7to_Adv = ss ["تْ هري"] ;
-- here7from_Adv = ss ["فرْم هري"] ;
how_IAdv = ss "كَيفَ" ;
-- how8many_IDet = mkDet "كَمْ" Pl Const ; -- IL: check (was ["هْو مَني"]) ;
-- if_Subj = ss "ِف" ;
in8front_Prep = ss "مُقَابِلَ" ;
i_Pron = mkPron "أَنَا" "نِي" "ي" (Per1 Sing);
in_Prep = ss "فِي" ;
it_Pron = he_Pron ; -- was: it_Pron = mkPron "ِت" "ِت" "ِتس" (Per3 Masc Sg);
how8many_IDet = {
s = \\g,s,c => "كَمْ عَدَد" + caseTbl ! c ;
n = Pl ; d = Def
} ; -- IL
if_Subj = mkSubj "إِذَا" Verbal ;
in8front_Prep = mkPrep "مُقَابِلَ" ;
i_Pron = ResAra.i_Pron ;
in_Prep = mkPrep "فِي" ;
it_Pron = emptyNP ** {s = \\_ => "هَذَا"} ; -- was: it_Pron = mkPron "ِت" "ِت" "ِتس" (Per3 Masc Sg);
-- less_CAdv = ss "لسّ" ;
many_Det = mkDet "جَمِيع" Pl Const ;
-- more_CAdv = ss "مْري" ;
@@ -57,16 +62,15 @@ concrete StructuralAra of Structural = CatAra **
-- isAux = True
-- } ;
no_Utt = {s = \\_ => "لا"} ;
on_Prep = ss "عَلى" ;
--- DEPREC one_Quant = mkQuantNum "واحِد" Sg Indef ;
on_Prep = mkPrep "عَلَى" ;
only_Predet = mkPredet "فَقَط" False;
-- or_Conj = ss "ْر" ** {n = Sg} ;
-- otherwise_PConj = ss "ْتهروِسي" ;
part_Prep = ss "مِنَ" ;
part_Prep = mkPrep "مِنَ" ;
-- please_Voc = ss "ةلَسي" ;
possess_Prep = ss "ل" ;
possess_Prep = liPrep ;
-- quite_Adv = ss "قُِتي" ;
she_Pron = mkPron "هِيَ" "ها" "ها" (Per3 Fem Sg) ;
she_Pron = ResAra.she_Pron ;
-- so_AdA = ss "سْ" ;
somebody_NP = regNP "أَحَد" Sg ;
someSg_Det = mkDet "أَحَد" Sg Const ;
@@ -74,48 +78,49 @@ concrete StructuralAra of Structural = CatAra **
something_NP = regNP "شَيْء" Sg ;
-- somewhere_Adv = ss "سْموهري" ;
that_Quant = mkQuant3 "ذَلِكَ" "تِلكَ" "أُلٱِكَ" Def;
that_Subj = mkSubj "أنَّ" ;
----b that_NP = indeclNP "ذَلِكَ" Sg ;
there_Adv = ss "هُناك" ;
-- there7to_Adv = ss "تهري" ;
-- there7from_Adv = ss ["فرْم تهري"] ;
-- therefore_PConj = ss "تهرفْري" ;
----b these_NP = indeclNP "هَؤُلَاء" Pl ;
they_Pron = mkPron "هُمْ" "هُمْ" "هُمْ" (Per3 Masc Pl) ;
they_Pron = theyMasc_Pron ;
this_Quant = mkQuant7 "هَذا" "هَذِهِ" "هَذَان" "هَذَيْن" "هَاتَان" "هَاتَيْن" "هَؤُلَاء" Def;
----b this_NP = indeclNP "هَذا" Sg ;
----b those_NP = indeclNP "هَؤُلَاءكَ" Pl ;
through_Prep = ss "عَبْرَ" ;
through_Prep = mkPrep "عَبْرَ" ;
-- too_AdA = ss "تّْ" ;
to_Prep = ss "إِلى" ;
under_Prep = ss "تَحْتَ" ;
to_Prep = mkPrep "إِلى" ;
under_Prep = mkPrep "تَحْتَ" ;
-- very_AdA = ss "ثري" ;
-- want_VV = P.mkVV (P.regV "وَنت") ;
we_Pron = mkPron "نَحنُ" "نا" "نا" (Per1 Plur) ;
whatPl_IP = mkIP "ماذا" Pl ;
whatSg_IP = mkIP "ماذا" Sg ;
want_VV = mkVV (mkV "رود" FormIV) ;
we_Pron = ResAra.we_Pron ;
whatPl_IP = mkIP "ما" "ماذا" Pl ;
whatSg_IP = mkIP "ما" "ماذا" Sg ;
when_IAdv = ss "مَتَى" ;
-- when_Subj = ss "وهن" ;
when_Subj = mkSubj "عِنْدَمَا" Verbal ;
where_IAdv = ss "أَينَ" ;
which_IQuant = {
s = \\s,c => case <c,s> of {
<Bare,_> => "أيّ" ;
<Nom,Indef> => "أيٌّ" ;
<Nom,_> => "أيُّ" ;
<Nom,Indef> => "أيٌّ" ;
<Nom,_> => "أيُّ" ;
<Acc,Indef> => "أيّاً" ;
<Acc,_> => "أيَّ" ;
<Gen,Indef> => "أيٍّ" ;
<Gen,_> => "أيِّ"
<Acc,_> => "أيَّ" ;
<_Gen,Indef> => "أيٍّ" ;
<_Gen,_> => "أيِّ"
}
} ;
whoSg_IP = mkIP "مَنْ" Sg ;
whoPl_IP = mkIP "مَنْ" Pl ;
whoSg_IP = mkIP "مَنْ" "مَنْ" Sg ;
whoPl_IP = mkIP "مَنْ" "مَنْ" Pl ;
-- why_IAdv = ss "وهي" ;
without_Prep = ss "بِدُونِ" ;
with_Prep = ss "مَع" ;
without_Prep = mkPrep "بِدُونِ" ;
with_Prep = mkPrep "مَع" ;
yes_Utt = {s = \\_ => "نَعَم"} ;
youSg_Pron = mkPron "أَنتَ" "كَ" "كَ" (Per2 Masc Sg) ;
youPl_Pron = mkPron "أَنتُمْ" "كُمْ" "كُمْ" (Per2 Masc Sg) ;
youPol_Pron = mkPron "أَنتِ" "كِ" "كِ" (Per2 Fem Sg) ;
youSg_Pron = youSgMasc_Pron ;
youPl_Pron = youPlMasc_Pron ;
youPol_Pron = youPlFem_Pron ; -- arbitrary?
have_V2 = dirV2 (regV "يَملِك") ;

View File

@@ -9,21 +9,23 @@ lin
FloatPN i = {s = \\c => i.s ; g = Masc ; h = NoHum } ; --IL
NumPN i = {s = \\c => uttNum i ! Masc ; g = Masc ; h = NoHum } ; --IL
-- CNIntNP cn i = {
-- s = \\c => cn.s ! Sg ! Def ! c ++ uttNum i ! Masc ;
-- s = \\c => cn2str cn Sg Def c ++ uttNum i ! cn.g ;
-- a = dummyAgrP3 Sg ;
-- } ;
--IL TODO: check out some opers regarding state in ResAra. These are just dummy values.
CNSymbNP det cn xs =
let g = cn.g ; n = sizeToNumber det.n in {
s = \\c => det.s ! NoHum ! g ! c ++ cn.s ! Sg ! Def ! c ++ cn.adj ! n ! Def ! c ++ xs.s; ----IL word order?? Seems to be nontrivial according to ResAra comments.
s = \\c => det.s ! NoHum ! g ! c ++ cn2str cn n Def c ++ xs.s; ----IL word order?? Seems to be nontrivial according to ResAra comments.
a = dummyAgrP3 n ;
empty = []
} ;
CNNumNP cn i = {
s = \\c => cn.s ! Sg ! Def ! c ++ uttNum i ! Masc ;
s = \\c => cn2str cn Sg Def c ++ uttNum i ! cn.g ;
a = dummyAgrP3 Sg ;
empty = []
} ;
SymbS sy = sy ;
SymbS sy = {s = \\_ => sy.s} ;
SymbOrd n = {s = \\_,_,_ => n.s ; n = One ; isNum = False } ;

View File

@@ -1,4 +1,4 @@
concrete VerbAra of Verb = CatAra ** open Prelude, ResAra in {
concrete VerbAra of Verb = CatAra ** open Prelude, ResAra, ParamX in {
flags optimize=all_subs ;
@@ -6,47 +6,96 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra in {
UseV = predV ;
SlashVV vv vps = vps ** predV vv ; ----IL
SlashV2a v = predVSlash v ;
Slash3V3 v np = insertObj np (predVSlash v) ** {c2 = v.c3};
-- : V2V -> VP -> VPSlash ; -- beg (her) to go
SlashV2V v2v vp = let v2vVP = predV v2v in -- IL
vp ** {
s = v2vVP.s ;
agrObj = \\pgn => v2v.c3.s -- أَنْ
++ vp.s ! pgn ! VPImpf Cnj ;
isPred = False ;
c2 = v2v.c2 ; -- preposition for the direct object
sc = v2v.sc
} ;
-- : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy
SlashV2VNP v2v np vps = let v2vVP = slashV2 v2v in -- IL
vps ** {
s = \\pgn,vpf => v2vVP.s ! pgn ! vpf -- main verb agrees with subject
++ bindIfPron np v2vVP
++ v2v.c3.s -- أَنْ
++ vps.s ! np.a.pgn ! VPImpf Cnj -- verb from old VP agrees with object
++ vps.obj.s ; -- otherwise obj appears in a weird place /IL
obj = emptyObj ;
isPred = False ;
-- preposition for the direct object comes from VP
sc = v2v.sc
} ;
SlashV2a = slashV2 ;
Slash3V3 v np = insertObj np (slashV2 v) ** {c2 = v.c3 ; agrObj = \\_ => []};
ComplSlash vp np = insertObj np vp ;
-- Complv3 v np np2 = insertObj np2 (insertObj np (predV v)) ;
{-{s = \\_ => v.c2 ++ np.s ! Acc ++ v.c3 ++ np2.s ! Acc ;
a = {pgn = Per3 Masc Sg ; isPron = False} } --FIXME
(predV v) ;-}
ComplVV vv vp = let vvVP = predV vv in --- IL
-- : VV -> VP -> VP ; -- want to run
ComplVV vv vp = let vvVP = predV vv in -- IL
vp ** {
s = \\pgn,vpf => vvVP.s ! pgn ! vpf
++ vv.c2 -- أَنْ
++ vp.s ! pgn ! VPImpf Cnj
++ vv.c2.s -- أَنْ
++ vp.s ! pgn ! VPImpf Cnj ;
isPred = False ;
sc = vv.sc
} ;
-- ComplVS v s = insertObj (\\_ => conjThat ++ s.s) (predV v) ;
-- ComplVQ v q = insertObj (\\_ => q.s ! QIndir) (predV v) ;
--
-- ComplVA v ap = insertObj (ap.s) (predV v) ;
-- : VS -> S -> VP ; -- say that she runs
ComplVS vs s = predV vs ** { -- IL
obj = emptyObj ** {s = s.s ! Subord}
} ;
-- : VQ -> QS -> VP ; -- wonder who runs
ComplVQ vq qs = predV vq ** { -- IL
obj = emptyObj ** {s = qs.s ! QIndir}
} ;
-- : VA -> AP -> VP ; -- they become red
ComplVA v ap = predV v ** {pred = CompAP ap} ;
-- ComplV2A v np ap =
-- insertObj (\\_ => v.c2 ++ np.s ! Acc ++ ap.s ! np.a) (predV v) ;
--
UseComp xabar = kaan xabar ;
UseComp xabar =
case xabar.isNP of {
False => kaan xabar ;
True => predV copula ** {obj = xabar.obj ; isPred=True}
} ;
UseCopula = predV copula ;
-- : VP -> Prep -> VPSlash ; -- live in (it)
VPSlashPrep vp prep = vp ** {
c2 = prep ;
agrObj = \\_ => []
} ;
AdvVP vp adv = insertStr adv.s vp ;
-- AdVVP adv vp = insertAdV adv.s vp ;
AdVVP adv = insertStr adv.s ;
AdVVPSlash adv vps = vps ** insertStr adv.s vps ;
--
-- ReflV2 v = insertObj (\\a => v.c2 ++ reflPron ! a) (predV v) ;
--
PassV2 v = kaan {s = \\_,_ => v.s ! VPPart} ; ---- IL guessed
PassV2 = passPredV ;
--
-- UseVS, UseVQ = \vv -> {s = vv.s ; c2 = [] ; isRefl = vv.isRefl} ; -- no
CompCN cn = {s = \\agr,c => cn.s ! agr.n ! Indef ! c ++ cn.np ! c ++ cn.adj ! agr.n ! Indef ! c} ; ----IL
CompAP ap = {s = \\agr,c => ap.s ! Hum ! agr.g ! agr.n ! Indef ! c} ; --FIXME
CompNP np = {s = \\_,c => np.s ! c};
CompAdv a = {s = \\_,_ => a.s} ;
CompAP ap = {s = \\agr,c => ap.s ! Hum ! agr.g ! agr.n ! Indef ! c ; --FIXME
obj = emptyObj ; isNP = False} ;
CompAdv a = {s = \\_,_ => a.s ;
obj = emptyObj ; isNP = False} ;
CompCN cn = {s = \\agr,c => cn2str cn agr.n Indef Nom ;
obj = emptyObj ; isNP = False} ;
CompNP np = {s = \\_,_ => [] ; obj = np ** {s = np.s ! Nom} ; isNP = True} ;
--
--
}

View File

@@ -74,6 +74,8 @@ lincat
n_hours_NP : NP = mkNP n_card time ;
in Sy.mkAdv for_Prep n_hours_NP | mkAdv (n_hours_NP.s ! R.npNom) ;
timeunitRange l u time = {s = l.s ! True ! R.Nom ++ to_Prep.s ++ u.s ! True ! R.Nom ++ time.s ! R.Pl ! R.Nom} ;
oneHour = mkHour "1" True ;
twoHour = mkHour "2" True ;
threeHour = mkHour "3" True ;

View File

@@ -71,7 +71,11 @@ oper
-- or in =Ryan, M. A. Conjugação dos Verbos em Português. ática,
-- 1991.=
-- the numbers in the comments below the oper declaration are the
-- verb's paradigm numbers in bescherelle and in Ryan
oper ter_Besch : Str -> Verbum = \ter ->
-- 1 | r3
let x_ = Predef.tk 3 ter in
{s = table {
VI Infn => x_ + "ter" ;
@@ -141,6 +145,7 @@ oper ter_Besch : Str -> Verbum = \ter ->
} ;
oper haver_Besch : Str -> Verbum = \haver ->
-- 2 | r4
let x_ = Predef.tk 5 haver in
{s = table {
VI Infn => x_ + "haver" ;
@@ -210,6 +215,7 @@ oper haver_Besch : Str -> Verbum = \haver ->
} ;
oper ser_Besch : Str -> Verbum = \ser ->
-- 3 | r1
let x_ = Predef.tk 3 ser in
{s = table {
VI Infn => x_ + "ser" ;
@@ -279,6 +285,7 @@ oper ser_Besch : Str -> Verbum = \ser ->
} ;
oper comprar_Besch : Str -> Verbum = \comprar ->
-- 4 | r5
let compr_ = Predef.tk 2 comprar in
{s = table {
VI Infn => compr_ + "ar" ;
@@ -348,6 +355,7 @@ oper comprar_Besch : Str -> Verbum = \comprar ->
} ;
oper vender_Besch : Str -> Verbum = \vender ->
-- 5 | r6
let vend_ = Predef.tk 2 vender in
{s = table {
VI Infn => vend_ + "er" ;
@@ -417,6 +425,7 @@ oper vender_Besch : Str -> Verbum = \vender ->
} ;
oper garantir_Besch : Str -> Verbum = \garantir ->
-- 6 | r7
let garant_ = Predef.tk 2 garantir in
{s = table {
VI Infn => garant_ + "ir" ;
@@ -486,6 +495,7 @@ oper garantir_Besch : Str -> Verbum = \garantir ->
} ;
oper estar_Besch : Str -> Verbum = \estar ->
-- 10 | r2
let est_ = Predef.tk 2 estar in
{s = table {
VI Infn => est_ + "ar" ;
@@ -555,6 +565,7 @@ oper estar_Besch : Str -> Verbum = \estar ->
} ;
oper dar_Besch : Str -> Verbum = \dar ->
-- 11 | r59
let x_ = Predef.tk 3 dar in
{s = table {
VI Infn => x_ + "dar" ;
@@ -624,6 +635,7 @@ oper dar_Besch : Str -> Verbum = \dar ->
} ;
oper ficar_Besch : Str -> Verbum = \ficar ->
-- 12 | r23
let x_ = Predef.tk 5 ficar in
{s = table {
VI Infn => x_ + "ficar" ;
@@ -693,75 +705,77 @@ oper ficar_Besch : Str -> Verbum = \ficar ->
} ;
oper começar_Besch : Str -> Verbum = \começar ->
let x_ = Predef.tk 7 começar in
-- 13 | r24
let come_ = Predef.tk 3 começar in
{s = table {
VI Infn => x_ + "começar" ;
VI Ger => x_ + "começando" ;
VI Part => x_ + "começado" ;
VPB (Pres Ind Sg P1) => x_ + "começo" ;
VPB (Pres Ind Sg P2) => x_ + "começas" ;
VPB (Pres Ind Sg P3) => x_ + "começa" ;
VPB (Pres Ind Pl P1) => x_ + "começamos" ;
VPB (Pres Ind Pl P2) => x_ + "começais" ;
VPB (Pres Ind Pl P3) => x_ + "começam" ;
VPB (Pres Sub Sg P1) => x_ + "comece" ;
VPB (Pres Sub Sg P2) => x_ + "comeces" ;
VPB (Pres Sub Sg P3) => x_ + "comece" ;
VPB (Pres Sub Pl P1) => x_ + "comecemos" ;
VPB (Pres Sub Pl P2) => x_ + "comeceis" ;
VPB (Pres Sub Pl P3) => x_ + "comecem" ;
VPB (PretI Ind Sg P1) => x_ + "começava" ; --# notpresent
VPB (PretI Ind Sg P2) => x_ + "começavas" ; --# notpresent
VPB (PretI Ind Sg P3) => x_ + "começava" ; --# notpresent
VPB (PretI Ind Pl P1) => x_ + "começávamos" ; --# notpresent
VPB (PretI Ind Pl P2) => x_ + "começáveis" ; --# notpresent
VPB (PretI Ind Pl P3) => x_ + "começavam" ; --# notpresent
VPB (PretI Sub Sg P1) => x_ + "começasse" ; --# notpresent
VPB (PretI Sub Sg P2) => x_ + "começasses" ; --# notpresent
VPB (PretI Sub Sg P3) => x_ + "começasse" ; --# notpresent
VPB (PretI Sub Pl P1) => x_ + "começássemos" ; --# notpresent
VPB (PretI Sub Pl P2) => x_ + "começasseis" ; --# notpresent
VPB (PretI Sub Pl P3) => x_ + "começassem" ; --# notpresent
VPB (MQPerf Sg P1) => x_ + "começara" ; --# notpresent
VPB (MQPerf Sg P2) => x_ + "começaras" ; --# notpresent
VPB (MQPerf Sg P3) => x_ + "começara" ; --# notpresent
VPB (MQPerf Pl P1) => x_ + "começáramos" ; --# notpresent
VPB (MQPerf Pl P2) => x_ + "começáreis" ; --# notpresent
VPB (MQPerf Pl P3) => x_ + "começaram" ; --# notpresent
VPB (PretP Sg P1) => x_ + "comecei" ; --# notpresent
VPB (PretP Sg P2) => x_ + "começaste" ; --# notpresent
VPB (PretP Sg P3) => x_ + "começou" ; --# notpresent
VPB (PretP Pl P1) => x_ + vars "começamos" "começámos" ; --# notpresent
VPB (PretP Pl P2) => x_ + "começastes" ; --# notpresent
VPB (PretP Pl P3) => x_ + "começaram" ; --# notpresent
VPB (Fut Ind Sg P1) => x_ + "começarei" ; --# notpresent
VPB (Fut Ind Sg P2) => x_ + "começarás" ; --# notpresent
VPB (Fut Ind Sg P3) => x_ + "começará" ; --# notpresent
VPB (Fut Ind Pl P1) => x_ + "começaremos" ; --# notpresent
VPB (Fut Ind Pl P2) => x_ + "começareis" ; --# notpresent
VPB (Fut Ind Pl P3) => x_ + "começarão" ; --# notpresent
VPB (Fut Sub Sg P1) => x_ + "começar" ; --# notpresent
VPB (Fut Sub Sg P2) => x_ + "começares" ; --# notpresent
VPB (Fut Sub Sg P3) => x_ + "começar" ; --# notpresent
VPB (Fut Sub Pl P1) => x_ + "começarmos" ; --# notpresent
VPB (Fut Sub Pl P2) => x_ + "começardes" ; --# notpresent
VPB (Fut Sub Pl P3) => x_ + "começarem" ; --# notpresent
VPB (Cond Sg P1) => x_ + "começaria" ; --# notpresent
VPB (Cond Sg P2) => x_ + "começarias" ; --# notpresent
VPB (Cond Sg P3) => x_ + "começaria" ; --# notpresent
VPB (Cond Pl P1) => x_ + "começaríamos" ; --# notpresent
VPB (Cond Pl P2) => x_ + "começarieis" ; --# notpresent
VPB (Cond Pl P3) => x_ + "começariam" ; --# notpresent
VPB (Imper Sg P2) => x_ + "começa" ;
VPB (Imper Sg P3) => x_ + "comece" ;
VPB (Imper Pl P1) => x_ + "comecemos" ;
VPB (Imper Pl P2) => x_ + "começai" ;
VPB (Imper Pl P3) => x_ + "comecem" ;
VI Infn => come_ + "çar" ;
VI Ger => come_ + "çando" ;
VI Part => come_ + "çado" ;
VPB (Pres Ind Sg P1) => come_ + "ço" ;
VPB (Pres Ind Sg P2) => come_ + "ças" ;
VPB (Pres Ind Sg P3) => come_ + "ça" ;
VPB (Pres Ind Pl P1) => come_ + "çamos" ;
VPB (Pres Ind Pl P2) => come_ + "çais" ;
VPB (Pres Ind Pl P3) => come_ + "çam" ;
VPB (Pres Sub Sg P1) => come_ + "ce" ;
VPB (Pres Sub Sg P2) => come_ + "ces" ;
VPB (Pres Sub Sg P3) => come_ + "ce" ;
VPB (Pres Sub Pl P1) => come_ + "cemos" ;
VPB (Pres Sub Pl P2) => come_ + "ceis" ;
VPB (Pres Sub Pl P3) => come_ + "cem" ;
VPB (PretI Ind Sg P1) => come_ + "çava" ; --# notpresent
VPB (PretI Ind Sg P2) => come_ + "çavas" ; --# notpresent
VPB (PretI Ind Sg P3) => come_ + "çava" ; --# notpresent
VPB (PretI Ind Pl P1) => come_ + "çávamos" ; --# notpresent
VPB (PretI Ind Pl P2) => come_ + "çáveis" ; --# notpresent
VPB (PretI Ind Pl P3) => come_ + "çavam" ; --# notpresent
VPB (PretI Sub Sg P1) => come_ + "çasse" ; --# notpresent
VPB (PretI Sub Sg P2) => come_ + "çasses" ; --# notpresent
VPB (PretI Sub Sg P3) => come_ + "çasse" ; --# notpresent
VPB (PretI Sub Pl P1) => come_ + "çássemos" ; --# notpresent
VPB (PretI Sub Pl P2) => come_ + "çasseis" ; --# notpresent
VPB (PretI Sub Pl P3) => come_ + "çassem" ; --# notpresent
VPB (MQPerf Sg P1) => come_ + "çara" ; --# notpresent
VPB (MQPerf Sg P2) => come_ + "çaras" ; --# notpresent
VPB (MQPerf Sg P3) => come_ + "çara" ; --# notpresent
VPB (MQPerf Pl P1) => come_ + "çáramos" ; --# notpresent
VPB (MQPerf Pl P2) => come_ + "çáreis" ; --# notpresent
VPB (MQPerf Pl P3) => come_ + "çaram" ; --# notpresent
VPB (PretP Sg P1) => come_ + "cei" ; --# notpresent
VPB (PretP Sg P2) => come_ + "çaste" ; --# notpresent
VPB (PretP Sg P3) => come_ + "çou" ; --# notpresent
VPB (PretP Pl P1) => come_ + vars "çamos" "çámos" ; --# notpresent
VPB (PretP Pl P2) => come_ + "çastes" ; --# notpresent
VPB (PretP Pl P3) => come_ + "çaram" ; --# notpresent
VPB (Fut Ind Sg P1) => come_ + "çarei" ; --# notpresent
VPB (Fut Ind Sg P2) => come_ + "çarás" ; --# notpresent
VPB (Fut Ind Sg P3) => come_ + "çará" ; --# notpresent
VPB (Fut Ind Pl P1) => come_ + "çaremos" ; --# notpresent
VPB (Fut Ind Pl P2) => come_ + "çareis" ; --# notpresent
VPB (Fut Ind Pl P3) => come_ + "çarão" ; --# notpresent
VPB (Fut Sub Sg P1) => come_ + "çar" ; --# notpresent
VPB (Fut Sub Sg P2) => come_ + "çares" ; --# notpresent
VPB (Fut Sub Sg P3) => come_ + "çar" ; --# notpresent
VPB (Fut Sub Pl P1) => come_ + "çarmos" ; --# notpresent
VPB (Fut Sub Pl P2) => come_ + "çardes" ; --# notpresent
VPB (Fut Sub Pl P3) => come_ + "çarem" ; --# notpresent
VPB (Cond Sg P1) => come_ + "çaria" ; --# notpresent
VPB (Cond Sg P2) => come_ + "çarias" ; --# notpresent
VPB (Cond Sg P3) => come_ + "çaria" ; --# notpresent
VPB (Cond Pl P1) => come_ + "çaríamos" ; --# notpresent
VPB (Cond Pl P2) => come_ + "çarieis" ; --# notpresent
VPB (Cond Pl P3) => come_ + "çariam" ; --# notpresent
VPB (Imper Sg P2) => come_ + "ça" ;
VPB (Imper Sg P3) => come_ + "ce" ;
VPB (Imper Pl P1) => come_ + "cemos" ;
VPB (Imper Pl P2) => come_ + "çai" ;
VPB (Imper Pl P3) => come_ + "cem" ;
VPB (Imper Sg P1) => nonExist
}
} ;
oper chegar_Besch : Str -> Verbum = \chegar ->
-- 14 | r26
let cheg_ = Predef.tk 2 chegar in
{s = table {
VI Infn => cheg_ + "ar" ;
@@ -831,6 +845,7 @@ oper chegar_Besch : Str -> Verbum = \chegar ->
} ;
oper recear_Besch : Str -> Verbum = \recear ->
-- 15 | r46
let rec_ = Predef.tk 3 recear in
{s = table {
VI Infn => rec_ + "ear" ;
@@ -900,6 +915,7 @@ oper recear_Besch : Str -> Verbum = \recear ->
} ;
oper anunciar_Besch : Str -> Verbum = \anunciar ->
-- 16 | r46
let anunci_ = Predef.tk 2 anunciar in
{s = table {
VI Infn => anunci_ + "ar" ;
@@ -969,6 +985,7 @@ oper anunciar_Besch : Str -> Verbum = \anunciar ->
} ;
oper odiar_Besch : Str -> Verbum = \odiar ->
-- 17 | r46
let od_ = Predef.tk 3 odiar in
{s = table {
VI Infn => od_ + "iar" ;
@@ -1038,6 +1055,7 @@ oper odiar_Besch : Str -> Verbum = \odiar ->
} ;
oper comerciar_Besch : Str -> Verbum = \comerciar ->
-- 18 | r36
let comerc_ = Predef.tk 3 comerciar in
{s = table {
VI Infn => comerc_ + "iar" ;
@@ -1107,6 +1125,7 @@ oper comerciar_Besch : Str -> Verbum = \comerciar ->
} ;
oper saudar_Besch : Str -> Verbum = \saudar ->
-- 19 | r16
let sa_ = Predef.tk 4 saudar in
{s = table {
VI Infn => sa_ + "udar" ;
@@ -1176,6 +1195,7 @@ oper saudar_Besch : Str -> Verbum = \saudar ->
} ;
oper perdoar_Besch : Str -> Verbum = \perdoar ->
-- 20 | r38
let perd_ = Predef.tk 3 perdoar in
{s = table {
VI Infn => perd_ + "oar" ;
@@ -1245,6 +1265,7 @@ oper perdoar_Besch : Str -> Verbum = \perdoar ->
} ;
oper averiguar_Besch : Str -> Verbum = \averiguar ->
-- 21 | r30
let averigu_ = Predef.tk 2 averiguar in
{s = table {
VI Infn => averigu_ + "ar" ;
@@ -1314,6 +1335,7 @@ oper averiguar_Besch : Str -> Verbum = \averiguar ->
} ;
oper neviscar_Besch : Str -> Verbum = \neviscar ->
-- 22 | r23
let n_ = Predef.tk 7 neviscar in
{s = table {
VI Infn => n_ + "eviscar" ;
@@ -1383,6 +1405,7 @@ oper neviscar_Besch : Str -> Verbum = \neviscar ->
} ;
oper adequar_Besch : Str -> Verbum = \adequar ->
-- 23 | r82
let adequ_ = Predef.tk 2 adequar in
{s = table {
VI Infn => adequ_ + "ar" ;
@@ -1452,6 +1475,7 @@ oper adequar_Besch : Str -> Verbum = \adequar ->
} ;
oper relampaguear_Besch : Str -> Verbum = \relampaguear ->
-- 24
let relamp_ = Predef.tk 6 relampaguear in
{s = table {
VI Infn => relamp_ + "aguear" ;
@@ -1521,6 +1545,7 @@ oper relampaguear_Besch : Str -> Verbum = \relampaguear ->
} ;
oper aquecer_Besch : Str -> Verbum = \aquecer ->
-- 25 | r25
let aque_ = Predef.tk 3 aquecer in
{s = table {
VI Infn => aque_ + "cer" ;
@@ -1590,6 +1615,7 @@ oper aquecer_Besch : Str -> Verbum = \aquecer ->
} ;
oper proteger_Besch : Str -> Verbum = \proteger ->
-- 26 | r27
let prote_ = Predef.tk 3 proteger in
{s = table {
VI Infn => prote_ + "ger" ;
@@ -1659,6 +1685,7 @@ oper proteger_Besch : Str -> Verbum = \proteger ->
} ;
oper erguer_Besch : Str -> Verbum = \erguer ->
-- 27 | r32
let erg_ = Predef.tk 3 erguer in
{s = table {
VI Infn => erg_ + "uer" ;
@@ -1728,6 +1755,7 @@ oper erguer_Besch : Str -> Verbum = \erguer ->
} ;
oper moer_Besch : Str -> Verbum = \moer ->
-- 28 | r39
let m_ = Predef.tk 3 moer in
{s = table {
VI Infn => m_ + "oer" ;
@@ -1797,6 +1825,7 @@ oper moer_Besch : Str -> Verbum = \moer ->
} ;
oper dizer_Besch : Str -> Verbum = \dizer ->
-- 29 | r60
let di_ = Predef.tk 3 dizer in
{s = table {
VI Infn => di_ + "zer" ;
@@ -1866,6 +1895,7 @@ oper dizer_Besch : Str -> Verbum = \dizer ->
} ;
oper trazer_Besch : Str -> Verbum = \trazer ->
-- 30 | r73
let tr_ = Predef.tk 4 trazer in
{s = table {
VI Infn => tr_ + "azer" ;
@@ -1935,6 +1965,7 @@ oper trazer_Besch : Str -> Verbum = \trazer ->
} ;
oper fazer_Besch : Str -> Verbum = \fazer ->
-- 31 | r61
let f_ = Predef.tk 4 fazer in
{s = table {
VI Infn => f_ + "azer" ;
@@ -2004,6 +2035,7 @@ oper fazer_Besch : Str -> Verbum = \fazer ->
} ;
oper aprazer_Besch : Str -> Verbum = \aprazer ->
-- 32 | r55
let apr_ = Predef.tk 4 aprazer in
{s = table {
VI Infn => apr_ + "azer" ;
@@ -2073,6 +2105,7 @@ oper aprazer_Besch : Str -> Verbum = \aprazer ->
} ;
oper jazer_Besch : Str -> Verbum = \jazer ->
-- 33 | r43
let jaz_ = Predef.tk 2 jazer in
{s = table {
VI Infn => jaz_ + "er" ;
@@ -2142,6 +2175,7 @@ oper jazer_Besch : Str -> Verbum = \jazer ->
} ;
oper caber_Besch : Str -> Verbum = \caber ->
-- 34 | r56
let c_ = Predef.tk 4 caber in
{s = table {
VI Infn => c_ + "aber" ;
@@ -2211,6 +2245,7 @@ oper caber_Besch : Str -> Verbum = \caber ->
} ;
oper saber_Besch : Str -> Verbum = \saber ->
-- 35 | r72
let s_ = Predef.tk 4 saber in
{s = table {
VI Infn => s_ + "aber" ;
@@ -2280,6 +2315,7 @@ oper saber_Besch : Str -> Verbum = \saber ->
} ;
oper poder_Besch : Str -> Verbum = \poder ->
-- 36 | r66
let p_ = Predef.tk 4 poder in
{s = table {
VI Infn => p_ + "oder" ;
@@ -2349,6 +2385,7 @@ oper poder_Besch : Str -> Verbum = \poder ->
} ;
oper crer_Besch : Str -> Verbum = \crer ->
-- 37 | r58
let cr_ = Predef.tk 2 crer in
{s = table {
VI Infn => cr_ + "er" ;
@@ -2418,6 +2455,7 @@ oper crer_Besch : Str -> Verbum = \crer ->
} ;
oper querer_Besch : Str -> Verbum = \querer ->
-- 38 | r69
let qu_ = Predef.tk 4 querer in
{s = table {
VI Infn => qu_ + "erer" ;
@@ -2487,6 +2525,7 @@ oper querer_Besch : Str -> Verbum = \querer ->
} ;
oper requerer_Besch : Str -> Verbum = \requerer ->
-- 39 | r70
let reque_ = Predef.tk 3 requerer in
{s = table {
VI Infn => reque_ + "rer" ;
@@ -2556,6 +2595,7 @@ oper requerer_Besch : Str -> Verbum = \requerer ->
} ;
oper ver_Besch : Str -> Verbum = \ver ->
-- 40 | r25
let v_ = Predef.tk 2 ver in
{s = table {
VI Infn => v_ + "er" ;
@@ -2625,6 +2665,7 @@ oper ver_Besch : Str -> Verbum = \ver ->
} ;
oper prover_Besch : Str -> Verbum = \prover ->
-- 41 | r68
let prov_ = Predef.tk 2 prover in
{s = table {
VI Infn => prov_ + "er" ;
@@ -2694,6 +2735,7 @@ oper prover_Besch : Str -> Verbum = \prover ->
} ;
oper ler_Besch : Str -> Verbum = \ler ->
-- 42 | r58
let l_ = Predef.tk 2 ler in
{s = table {
VI Infn => l_ + "er" ;
@@ -2763,6 +2805,7 @@ oper ler_Besch : Str -> Verbum = \ler ->
} ;
oper valer_Besch : Str -> Verbum = \valer ->
-- 43 | r74
let val_ = Predef.tk 2 valer in
{s = table {
VI Infn => val_ + "er" ;
@@ -2832,6 +2875,7 @@ oper valer_Besch : Str -> Verbum = \valer ->
} ;
oper perder_Besch : Str -> Verbum = \perder ->
-- 44 | r65
let per_ = Predef.tk 3 perder in
{s = table {
VI Infn => per_ + "der" ;
@@ -2901,6 +2945,7 @@ oper perder_Besch : Str -> Verbum = \perder ->
} ;
oper pôr_Besch : Str -> Verbum = \pôr ->
-- 45 | r67
let p_ = Predef.tk 2 pôr in
{s = table {
VI Infn => p_ + "ôr" ;
@@ -2970,6 +3015,7 @@ oper pôr_Besch : Str -> Verbum = \pôr ->
} ;
oper acontecer_Besch : Str -> Verbum = \acontecer ->
-- 46 | r25
let aconte_ = Predef.tk 3 acontecer in
{s = table {
VI Infn => aconte_ + "cer" ;
@@ -3039,6 +3085,7 @@ oper acontecer_Besch : Str -> Verbum = \acontecer ->
} ;
oper chover_Besch : Str -> Verbum = \chover ->
-- 47 | r6
let chov_ = Predef.tk 2 chover in
{s = table {
VI Infn => chov_ + "er" ;
@@ -3108,6 +3155,7 @@ oper chover_Besch : Str -> Verbum = \chover ->
} ;
oper doer_Besch : Str -> Verbum = \doer ->
-- 48 | r83
let d_ = Predef.tk 3 doer in
{s = table {
VI Infn => d_ + "oer" ;
@@ -3177,6 +3225,7 @@ oper doer_Besch : Str -> Verbum = \doer ->
} ;
oper prazer_Besch : Str -> Verbum = \prazer ->
-- 49 | r55
let pr_ = Predef.tk 4 prazer in
{s = table {
VI Infn => pr_ + "azer" ;
@@ -3246,6 +3295,7 @@ oper prazer_Besch : Str -> Verbum = \prazer ->
} ;
oper precaver_Besch : Str -> Verbum = \precaver ->
-- 50 | r85
let precav_ = Predef.tk 2 precaver in
{s = table {
VI Infn => precav_ + "er" ;
@@ -3315,6 +3365,7 @@ oper precaver_Besch : Str -> Verbum = \precaver ->
} ;
oper reaver_Besch : Str -> Verbum = \reaver ->
-- 51 | r86
let re_ = Predef.tk 4 reaver in
{s = table {
VI Infn => re_ + "aver" ;
@@ -3384,6 +3435,7 @@ oper reaver_Besch : Str -> Verbum = \reaver ->
} ;
oper redigir_Besch : Str -> Verbum = \redigir ->
-- 52 | r28
let red_ = Predef.tk 4 redigir in
{s = table {
VI Infn => red_ + "igir" ;
@@ -3453,6 +3505,7 @@ oper redigir_Besch : Str -> Verbum = \redigir ->
} ;
oper extinguir_Besch : Str -> Verbum = \extinguir ->
-- 53 | r33
let extin_ = Predef.tk 4 extinguir in
{s = table {
VI Infn => extin_ + "guir" ;
@@ -3522,6 +3575,7 @@ oper extinguir_Besch : Str -> Verbum = \extinguir ->
} ;
oper servir_Besch : Str -> Verbum = \servir ->
-- 54 | r47
let s_ = Predef.tk 5 servir in
{s = table {
VI Infn => s_ + "ervir" ;
@@ -3591,6 +3645,7 @@ oper servir_Besch : Str -> Verbum = \servir ->
} ;
oper seguir_Besch : Str -> Verbum = \seguir ->
-- 55 | r50
let s_ = Predef.tk 5 seguir in
{s = table {
VI Infn => s_ + "eguir" ;
@@ -3660,6 +3715,7 @@ oper seguir_Besch : Str -> Verbum = \seguir ->
} ;
oper sentir_Besch : Str -> Verbum = \sentir ->
-- 56 | r47
let s_ = Predef.tk 5 sentir in
{s = table {
VI Infn => s_ + "entir" ;
@@ -3729,6 +3785,7 @@ oper sentir_Besch : Str -> Verbum = \sentir ->
} ;
oper preferir_Besch : Str -> Verbum = \preferir ->
-- 57 | r47
let pref_ = Predef.tk 4 preferir in
{s = table {
VI Infn => pref_ + "erir" ;
@@ -3798,6 +3855,7 @@ oper preferir_Besch : Str -> Verbum = \preferir ->
} ;
oper agredir_Besch : Str -> Verbum = \agredir ->
-- 58 | r48
let agr_ = Predef.tk 4 agredir in
{s = table {
VI Infn => agr_ + "edir" ;
@@ -3867,6 +3925,7 @@ oper agredir_Besch : Str -> Verbum = \agredir ->
} ;
oper dormir_Besch : Str -> Verbum = \dormir ->
-- 59 | r51
let d_ = Predef.tk 5 dormir in
{s = table {
VI Infn => d_ + "ormir" ;
@@ -3936,6 +3995,7 @@ oper dormir_Besch : Str -> Verbum = \dormir ->
} ;
oper polir_Besch : Str -> Verbum = \polir ->
-- 60 | r81
let p_ = Predef.tk 4 polir in
{s = table {
VI Infn => p_ + "olir" ;
@@ -4005,6 +4065,7 @@ oper polir_Besch : Str -> Verbum = \polir ->
} ;
oper acudir_Besch : Str -> Verbum = \acudir ->
-- 61 | r53
let ac_ = Predef.tk 4 acudir in
{s = table {
VI Infn => ac_ + "udir" ;
@@ -4074,6 +4135,7 @@ oper acudir_Besch : Str -> Verbum = \acudir ->
} ;
oper fugir_Besch : Str -> Verbum = \fugir ->
-- 62 | r54
let f_ = Predef.tk 4 fugir in
{s = table {
VI Infn => f_ + "ugir" ;
@@ -4143,6 +4205,7 @@ oper fugir_Besch : Str -> Verbum = \fugir ->
} ;
oper frigir_Besch : Str -> Verbum = \frigir ->
-- 63 | r28
let fr_ = Predef.tk 4 frigir in
{s = table {
VI Infn => fr_ + "igir" ;
@@ -4212,6 +4275,7 @@ oper frigir_Besch : Str -> Verbum = \frigir ->
} ;
oper divergir_Besch : Str -> Verbum = \divergir ->
-- 64 | r49
let div_ = Predef.tk 5 divergir in
{s = table {
VI Infn => div_ + "ergir" ;
@@ -4281,6 +4345,7 @@ oper divergir_Besch : Str -> Verbum = \divergir ->
} ;
oper refletir_Besch : Str -> Verbum = \refletir ->
-- 65 | r47
let refl_ = Predef.tk 4 refletir in
{s = table {
VI Infn => refl_ + vars "etir" "ectir" ;
@@ -4350,6 +4415,7 @@ oper refletir_Besch : Str -> Verbum = \refletir ->
} ;
oper ir_Besch : Str -> Verbum = \ir ->
-- 66 | r53
let x_ = Predef.tk 2 ir in
{s = table {
VI Infn => x_ + "ir" ;
@@ -4419,6 +4485,7 @@ oper ir_Besch : Str -> Verbum = \ir ->
} ;
oper vir_Besch : Str -> Verbum = \vir ->
-- 67 | r63
let v_ = Predef.tk 2 vir in
{s = table {
VI Infn => v_ + "ir" ;
@@ -4488,6 +4555,7 @@ oper vir_Besch : Str -> Verbum = \vir ->
} ;
oper sair_Besch : Str -> Verbum = \sair ->
-- 68 | r42
let sa_ = Predef.tk 2 sair in
{s = table {
VI Infn => sa_ + "ir" ;
@@ -4557,6 +4625,7 @@ oper sair_Besch : Str -> Verbum = \sair ->
} ;
oper rir_Besch : Str -> Verbum = \rir ->
-- 69 | r48
let r_ = Predef.tk 2 rir in
{s = table {
VI Infn => r_ + "ir" ;
@@ -4626,6 +4695,7 @@ oper rir_Besch : Str -> Verbum = \rir ->
} ;
oper pedir_Besch : Str -> Verbum = \pedir ->
-- 70 | r63
let pe_ = Predef.tk 3 pedir in
{s = table {
VI Infn => pe_ + "dir" ;
@@ -4695,6 +4765,7 @@ oper pedir_Besch : Str -> Verbum = \pedir ->
} ;
oper ouvir_Besch : Str -> Verbum = \ouvir ->
-- 71 | r63
let ou_ = Predef.tk 3 ouvir in
{s = table {
VI Infn => ou_ + "vir" ;
@@ -4764,6 +4835,7 @@ oper ouvir_Besch : Str -> Verbum = \ouvir ->
} ;
oper traduzir_Besch : Str -> Verbum = \traduzir ->
-- 72 | r44
let traduz_ = Predef.tk 2 traduzir in
{s = table {
VI Infn => traduz_ + "ir" ;
@@ -4833,6 +4905,7 @@ oper traduzir_Besch : Str -> Verbum = \traduzir ->
} ;
oper distribuir_Besch : Str -> Verbum = \distribuir ->
-- 73 | r40
let distribu_ = Predef.tk 2 distribuir in
{s = table {
VI Infn => distribu_ + "ir" ;
@@ -4902,6 +4975,7 @@ oper distribuir_Besch : Str -> Verbum = \distribuir ->
} ;
oper destruir_Besch : Str -> Verbum = \destruir ->
-- 74 | r57
let destr_ = Predef.tk 3 destruir in
{s = table {
VI Infn => destr_ + "uir" ;
@@ -4971,6 +5045,7 @@ oper destruir_Besch : Str -> Verbum = \destruir ->
} ;
oper arguir_Besch : Str -> Verbum = \arguir ->
-- 75 | r31
let arg_ = Predef.tk 3 arguir in
{s = table {
VI Infn => arg_ + "uir" ;
@@ -5040,6 +5115,7 @@ oper arguir_Besch : Str -> Verbum = \arguir ->
} ;
oper reunir_Besch : Str -> Verbum = \reunir ->
-- 76 | r18
let re_ = Predef.tk 4 reunir in
{s = table {
VI Infn => re_ + "unir" ;
@@ -5109,6 +5185,7 @@ oper reunir_Besch : Str -> Verbum = \reunir ->
} ;
oper proibir_Besch : Str -> Verbum = \proibir ->
-- 77 | r20
let pro_ = Predef.tk 4 proibir in
{s = table {
VI Infn => pro_ + "ibir" ;
@@ -5178,6 +5255,7 @@ oper proibir_Besch : Str -> Verbum = \proibir ->
} ;
oper imergir_Besch : Str -> Verbum = \imergir ->
-- 78 | r49
let imerg_ = Predef.tk 2 imergir in
{s = table {
VI Infn => imerg_ + "ir" ;
@@ -5247,6 +5325,7 @@ oper imergir_Besch : Str -> Verbum = \imergir ->
} ;
oper falir_Besch : Str -> Verbum = \falir ->
-- 79 | r81
let fal_ = Predef.tk 2 falir in
{s = table {
VI Infn => fal_ + "ir" ;
@@ -5316,6 +5395,7 @@ oper falir_Besch : Str -> Verbum = \falir ->
} ;
oper remir_Besch : Str -> Verbum = \remir ->
-- 80 | r49
let rem_ = Predef.tk 2 remir in
{s = table {
VI Infn => rem_ + "ir" ;
@@ -5385,6 +5465,7 @@ oper remir_Besch : Str -> Verbum = \remir ->
} ;
oper viajar_Besch : Str -> Verbum = \viajar ->
-- r22
let viaj_ = Predef.tk 2 viajar in
{s = table {
VI Infn => viaj_ + "ar" ;
@@ -5454,6 +5535,7 @@ oper viajar_Besch : Str -> Verbum = \viajar ->
} ;
oper suar_Besch : Str -> Verbum = \suar ->
-- r37
let su_ = Predef.tk 2 suar in
{s = table {
VI Infn => su_ + "ar" ;
@@ -5522,4 +5604,74 @@ oper suar_Besch : Str -> Verbum = \suar ->
}
} ;
oper peneirar_Besch : Str -> Verbum = \peneirar ->
-- r10
let peneir_ = Predef.tk 2 peneirar in
{s = table {
VI Infn => peneir_ + "ar" ;
VI Ger => peneir_ + "ando" ;
VI Part => peneir_ + "ado" ;
VPB (Pres Ind Sg P1) => peneir_ + "o" ;
VPB (Pres Ind Sg P2) => peneir_ + "as" ;
VPB (Pres Ind Sg P3) => peneir_ + "a" ;
VPB (Pres Ind Pl P1) => peneir_ + "amos" ;
VPB (Pres Ind Pl P2) => peneir_ + "ais" ;
VPB (Pres Ind Pl P3) => peneir_ + "am" ;
VPB (Pres Sub Sg P1) => peneir_ + "e" ;
VPB (Pres Sub Sg P2) => peneir_ + "es" ;
VPB (Pres Sub Sg P3) => peneir_ + "e" ;
VPB (Pres Sub Pl P1) => peneir_ + "emos" ;
VPB (Pres Sub Pl P2) => peneir_ + "eis" ;
VPB (Pres Sub Pl P3) => peneir_ + "em" ;
VPB (PretI Ind Sg P1) => peneir_ + "ava" ; --# notpresent
VPB (PretI Ind Sg P2) => peneir_ + "avas" ; --# notpresent
VPB (PretI Ind Sg P3) => peneir_ + "ava" ; --# notpresent
VPB (PretI Ind Pl P1) => peneir_ + "ávamos" ; --# notpresent
VPB (PretI Ind Pl P2) => peneir_ + "áveis" ; --# notpresent
VPB (PretI Ind Pl P3) => peneir_ + "avam" ; --# notpresent
VPB (PretI Sub Sg P1) => peneir_ + "asse" ; --# notpresent
VPB (PretI Sub Sg P2) => peneir_ + "asses" ; --# notpresent
VPB (PretI Sub Sg P3) => peneir_ + "asse" ; --# notpresent
VPB (PretI Sub Pl P1) => peneir_ + "ássemos" ; --# notpresent
VPB (PretI Sub Pl P2) => peneir_ + "ásseis" ; --# notpresent
VPB (PretI Sub Pl P3) => peneir_ + "assem" ; --# notpresent
VPB (MQPerf Sg P1) => peneir_ + "ara" ; --# notpresent
VPB (MQPerf Sg P2) => peneir_ + "aras" ; --# notpresent
VPB (MQPerf Sg P3) => peneir_ + "ara" ; --# notpresent
VPB (MQPerf Pl P1) => peneir_ + "áramos" ; --# notpresent
VPB (MQPerf Pl P2) => peneir_ + "áreis" ; --# notpresent
VPB (MQPerf Pl P3) => peneir_ + "aram" ; --# notpresent
VPB (PretP Sg P1) => peneir_ + "ei" ; --# notpresent
VPB (PretP Sg P2) => peneir_ + "aste" ; --# notpresent
VPB (PretP Sg P3) => peneir_ + "ou" ; --# notpresent
VPB (PretP Pl P1) => peneir_ + "amos" ; --# notpresent
VPB (PretP Pl P2) => peneir_ + "astes" ; --# notpresent
VPB (PretP Pl P3) => peneir_ + "aram" ; --# notpresent
VPB (Fut Ind Sg P1) => peneir_ + "arei" ; --# notpresent
VPB (Fut Ind Sg P2) => peneir_ + "arás" ; --# notpresent
VPB (Fut Ind Sg P3) => peneir_ + "ará" ; --# notpresent
VPB (Fut Ind Pl P1) => peneir_ + "aremos" ; --# notpresent
VPB (Fut Ind Pl P2) => peneir_ + "areis" ; --# notpresent
VPB (Fut Ind Pl P3) => peneir_ + "arão" ; --# notpresent
VPB (Fut Sub Sg P1) => peneir_ + "ar" ; --# notpresent
VPB (Fut Sub Sg P2) => peneir_ + "ares" ; --# notpresent
VPB (Fut Sub Sg P3) => peneir_ + "ar" ; --# notpresent
VPB (Fut Sub Pl P1) => peneir_ + "armos" ; --# notpresent
VPB (Fut Sub Pl P2) => peneir_ + "ardes" ; --# notpresent
VPB (Fut Sub Pl P3) => peneir_ + "arem" ; --# notpresent
VPB (Cond Sg P1) => peneir_ + "aria" ; --# notpresent
VPB (Cond Sg P2) => peneir_ + "aries" ; --# notpresent
VPB (Cond Sg P3) => peneir_ + "aria" ; --# notpresent
VPB (Cond Pl P1) => peneir_ + "aríamos" ; --# notpresent
VPB (Cond Pl P2) => peneir_ + "aríeis" ; --# notpresent
VPB (Cond Pl P3) => peneir_ + "ariam" ; --# notpresent
VPB (Imper Sg P2) => peneir_ + "a" ;
VPB (Imper Sg P3) => peneir_ + "e" ;
VPB (Imper Pl P1) => peneir_ + "emos" ;
VPB (Imper Pl P2) => peneir_ + "ai" ;
VPB (Imper Pl P3) => peneir_ + "em" ;
VPB (Imper Sg P1) => nonExist
}
} ;
} ;

View File

@@ -69,6 +69,8 @@ lin
let n_card : Card = lin Card n;
n_hours_NP : NP = mkNP n_card time ;
in S.mkAdv for_Prep n_hours_NP | S.mkAdv to_Prep n_hours_NP ;--| S.mkAdv (n_hours_NP.s ! R.Nom) ;
timeunitRange l u time = {s = "de" ++ l.s ! time.g
++ "a" ++ u.s ! time.g ++ time.s ! u.n } ;
oneHour = mkHour "1" Manha Sg ;
twoHour = mkHour "2" Manha Pl ;
@@ -95,12 +97,12 @@ lin
twentyThreeHour = mkHour "23" Noite Pl ;
twentyFourHour = {s = "meia-noite" ; pe = None ; n = Sg} ;
timeHour h = mkAdv (a ! h.n ++ h.s ++ period ! h.pe) ;
timeHour h = mkAdv (R.a ! Fem ! h.n ++ h.s ++ period ! h.pe) ;
timeHourMinute h m = let
min = m.s ! Masc
in
mkAdv (a ! h.n ++ h.s ++ "e" ++ min ++ period ! h.pe) ;
mkAdv (R.a ! Fem ! h.n ++ h.s ++ "e" ++ min ++ period ! h.pe) ;
oper
mkHour : Str -> Period -> Number -> {s : Str ; pe : Period ; n : Number} ;
@@ -114,9 +116,6 @@ lin
None => ""
} ;
a : Number => Str ;
a = numForms "à" "às" ;
lin
weekdayPunctualAdv w = lin Adv {s = w.s ! C.Sg} ; -- lundi
weekdayHabitualAdv w = SyntaxPor.mkAdv noPrep (mkNP the_Det w) ; -- il lunedí ----

View File

@@ -106,12 +106,18 @@ instance DiffPor of DiffRomance - [partAgr,vpAgrSubj,vpAgrClits] = open CommonRo
partitive = \_,c -> prepCase c ;
oper
a : Gender => Number => Str ;
a = genNumForms "a" "à" "aos" "às" ;
de : Gender => Number => Str ;
de = genNumForms "do" "da" "dos" "das" ;
artDef : Bool -> Gender -> Number -> Case -> Str ;
-- not sure if isNP is relevant
artDef _isNP g n c = case c of {
Nom | Acc => genNumForms "o" "a" "os" "as" ;
CPrep P_de => genNumForms "do" "da" "dos" "das" ;
CPrep P_a => genNumForms "ao" "à" "aos" "às" ;
CPrep P_de => de ;
CPrep P_a => a ;
CPrep P_em => genNumForms "no" "na" "nos" "nas" ;
CPrep P_por => genNumForms "pelo" "pela" "pelos" "pelas"
} ! g ! n ;
@@ -148,7 +154,7 @@ instance DiffPor of DiffRomance - [partAgr,vpAgrSubj,vpAgrClits] = open CommonRo
subjIf = "se" ;
oper
relPron : Bool => AAgr => Case => Str = \\b,a,c =>
relPron : Bool => AAgr => Case => Str = \\_b,a,c =>
case c of {
Nom | Acc => "que" ;
CPrep P_a => "cujo" ;

View File

@@ -4,6 +4,8 @@ concrete ExtendPor of Extend =
CatPor ** ExtendFunctor -
[
AdAdV,
AdjAsCN,
AdjAsNP,
ApposNP,
BaseVPS,
ByVP,
@@ -13,6 +15,7 @@ concrete ExtendPor of Extend =
CompoundAP,
CompoundN,
CompVP,
ConjVPS,
ConsVPS,
--EmptyRelSlash,
ExistsNP,
@@ -27,11 +30,13 @@ concrete ExtendPor of Extend =
ICompAP,
InOrderToVP,
ListVPS,
MkVPS,
PassAgentVPSlash,
PassVPSlash,
PastPartAP,
PastPartAgentAP,
PositAdVAdj,
PredVPS,
PresPartAP,
ProDrop,
PurposeVP,
@@ -52,13 +57,13 @@ concrete ExtendPor of Extend =
with
(Grammar = GrammarPor), (Syntax = SyntaxPor) **
open
GrammarPor,
ResPor,
MorphoPor,
Coordination,
Prelude,
ParadigmsPor,
(S = StructuralPor) in {
GrammarPor,
ResPor,
MorphoPor,
Coordination,
Prelude,
ParadigmsPor,
(S = StructuralPor) in {
lin
GenNP np =
@@ -85,17 +90,28 @@ concrete ExtendPor of Extend =
c = Nom
} ;
---- these come from ExtraRomance: how to avoid the repetition?
---- can't seem to be able to use two functors
lincat
VPS = {s : Agr => Mood => Str} ;
[VPS] = {s1,s2 : Agr => Mood => Str} ;
-- VPI = {s : VType => Agr => Str } ;
VPS = {s : Mood => Agr => Bool => Str} ;
[VPS] = {s1,s2 : Mood => Agr => Bool => Str} ;
lin
BaseVPS = twoTable2 Agr Mood ;
ConsVPS = consrTable2 Agr Mood comma ;
BaseVPS x y = twoTable3 Mood Agr Bool x y ;
ConsVPS = consrTable3 Mood Agr Bool comma ;
-- MkVPS t p vp = mkVPS (lin Temp t) (lin Pol p) (lin VP vp) ;
--TODO: write mkVPS oper
PredVPS np vpi = {
s = \\m => (np.s ! Nom).comp ++ vpi.s ! m ! np.a ! np.isNeg
} ;
MkVPS tm p vp = {
s = \\m,agr,isNeg =>
tm.s ++ p.s ++
(mkClausePol (orB isNeg vp.isNeg) [] False False agr vp).s
! DDir ! tm.t ! tm.a ! p.p ! m
} ;
ConjVPS = conjunctDistrTable3 Mood Agr Bool ;
lin
ProDrop p = {
@@ -148,13 +164,23 @@ concrete ExtendPor of Extend =
ComplBareVS = ComplVS ;
AdjAsCN ap = {
s =\\n => ap.s ! AF Masc n ;
g = Masc
} ;
AdjAsNP ap = heavyNP {
s = \\_c => ap.s ! AF Masc Sg ;
a = Ag Masc Sg P3
} ;
oper
pastPartAP : VPSlash -> Str -> AP ;
pastPartAP vps agent = lin AP {
s = \\af => vps.comp ! (aform2aagr af ** {p = P3}) ++ vps.s.s ! VPart (aform2gender af) (aform2number af) ++ agent ;
isPre = False
} ;
passVPSlash : VPSlash -> Str -> VP ;
passVPSlash vps agent = let
auxvp = predV auxPassive

View File

@@ -10,7 +10,7 @@ flags
lin
easy_A2V = mkA2V (mkA "fácil") dative genitive ;
married_A2 = mkA2 (mkA "casado") dative ;
probable_AS = mkAS (mkA "provável" "provável" "prováveis" "prováveis" "provavelmente") ;
probable_AS = mkAS (prefA (mkA "provável" "provavelmente")) ;
fun_AV = mkAV (mkA "divertido") genitive ;
-- A
bad_A = prefA (mkA (mkA "mau") (mkA "pior")) ;
@@ -38,7 +38,7 @@ lin
narrow_A = mkA "estreito" ;
near_A = mkA "perto" ;
new_A = prefA (mkA "novo") ;
old_A = prefA (mkA "velho") ;
old_A = prefA (mkA "velho") ;
ready_A = mkA "pronto" ;
red_A = mkA "vermelho" ;
rotten_A = mkA "podre" ;
@@ -58,7 +58,7 @@ lin
white_A = compADeg (mkA "branco") ;
wide_A = mkA "largo" ; -- extenso
yellow_A = mkA "amarelo" ;
young_A = prefA (mkA "jovem" "jovem" "jovens" "jovens" "juvenilmente") ;
young_A = prefA (mkA "jovem" "juvenilmente") ;
already_Adv = mkAdv "já" ;
far_Adv = mkAdv "longe" ; ----?
now_Adv = mkAdv "agora" ;

View File

@@ -124,16 +124,16 @@ oper
}
} ;
mkAdj2N : (_,_: N) -> Str -> Adj = \mascN, femN, burramente ->
{s = table {
AF Masc n => mascN.s ! n ;
AF Fem n => femN.s ! n ;
AA => burramente
}
mkAdj2 : (_,_: Str) -> Adj ;
mkAdj2 aj av = let
adj = mkAdjReg aj
in {
s = table {
AF g n => adj.s ! AF g n ;
AA => av
}
} ;
mkAdjN : N -> Str -> Adj = \n, burramente -> mkAdj2N n n burramente ;
-- Then the regular and invariant patterns.
adjPreto : Str -> Adj = \preto ->
@@ -174,7 +174,7 @@ oper
"ã" => "a"
} ;
alemvo : Str = alem + v + "o" ;
in mkAdj alemão alemã (alemã + "s") (alemã + "es") (alemã + "amente") ;
in mkAdj alemão alemã (alemã + "s") (alemã + "es") (alemã + "mente") ;
adjEuropeu : Str -> Adj = \europeu -> let europe = init europeu in
mkAdj europeu (europe + "ia") (europeu + "s") (europe + "ias")
@@ -183,11 +183,13 @@ oper
mkAdjReg : Str -> Adj = \a ->
case a of {
pret + "o" => adjPreto a ;
anarquist + v@("e" | "a") => adjUtil (anarquist + v) (anarquist + v + "s") ;
anarquist + v@("e" | "a") => adjUtil a (a + "s") ;
ouvido + "r" => adjOuvidor a (ouvido + "ra") ;
chin + "ês" => adjFrances a ;
europ + "eu" => adjEuropeu a ;
alem + "ão" => adjVo a ;
provav + v@("e" | "i") + "l" => adjUtil a (provav + "eis") ;
jove + "m" => adjUtil a (jove + "ns") ;
_ => adjUtil a (a + "s")
} ;

View File

@@ -203,9 +203,9 @@ oper
regA a = compADeg {s = \\_ => (mkAdjReg a).s ; isPre = False ;
lock_A = <>} ;
mk2A : (espanhol,espanhola : Str) -> A ;
mk2A a b = compADeg {s = \\_ => (mkAdj2N (mkN a) (mkN b) (b + "mente")).s ; isPre = False ;
lock_A = <>} ;
mk2A : (único,unicamente : Str) -> A ;
mk2A adj adv = compADeg {s = \\_ => (mkAdj2 adj adv).s ; isPre = False ;
lock_A = <>} ;
mk5A : (preto,preta,pretos,pretas,pretamente : Str) -> A ;
mk5A a b c d e = compADeg {s = \\_ => (mkAdj a b c d e).s ;

View File

@@ -9,4 +9,5 @@
instance ResPor of ResRomance = DiffPor ** open CommonRomance, Prelude in {
oper
vowel : pattern Str = #("a" | "e" | "i" | "o" | "u") ;
} ;

View File

@@ -70,13 +70,13 @@ lin
-}
-- : Temp -> Pol -> Cl -> S ;
UseCl temp pol cl = { s = cl.s ! temp.t ! temp.a ! pol.p } ;
UseCl t p cl = { s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p } ;
{-
-- : Temp -> Pol -> RCl -> RS ;
UseRCl temp pol cl = { s = cl.s ! temp.t ! temp.a ! pol.p } ;
UseRCl t p cl = { s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p } ;
-- : Temp -> Pol -> QCl -> QS ;
UseQCl temp pol qcl = { s = qcl.s ! temp.t ! temp.a ! pol.p } ;
UseQCl t p cl = { s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p } ;
-- An adverb can be added to the beginning of a sentence, either with comma ("externally")
-- or without:
@@ -89,7 +89,7 @@ lin
-- There's an SubjS already in AdverbSom -- should this be deprecated?
-- : S -> Subj -> S -> S ;
SSubjS s1 subj s2 = AdvS (AE.SubjS subj s2) s1 ;
SSubjS s1 subj s2 = AdvS (AS.SubjS subj s2) s1 ;
-- A sentence can be modified by a relative clause referring to its contents.

View File

@@ -8,7 +8,7 @@ concrete ExtendSwe of Extend = CatSwe **
PassVPSlash, PassAgentVPSlash, UttVPShort, ByVP, InOrderToVP,
MkVPI, BaseVPI, ConsVPI, ConjVPI, ComplVPIVV,
MkVPS, BaseVPS, ConsVPS, ConjVPS, PredVPS,
ICompAP,
ICompAP,ProDrop,
AdAdV, PositAdVAdj, GerundCN, GerundNP, GerundAdv, PresPartAP, PastPartAP, PastPartAgentAP,
RNP, RNPList, ReflRNP, ReflPron, ReflPoss, PredetRNP, ConjRNP,
Base_rr_RNP, Base_nr_RNP, Base_rn_RNP, Cons_rr_RNP, Cons_nr_RNP,
@@ -122,7 +122,7 @@ concrete ExtendSwe of Extend = CatSwe **
ICompAP ap = {s = \\a => hur_IAdv.s ++ ap.s ! a} ;
ProDrop pro = pro ** {s = \\_ => []} ;
lincat
RNP = {s : Agr => Str ; isPron : Bool} ; ---- inherent Agr needed: han färgar sitt hår vitt. But also depends on subject