1
0
forked from GitHub/gf-rgl

Merge branch 'master' into new-website

This commit is contained in:
John J. Camilleri
2018-11-13 22:44:30 +01:00
18 changed files with 463 additions and 211 deletions

View File

@@ -15,6 +15,7 @@ configFile = "languages.csv"
-- | Information about a language -- | Information about a language
data LangInfo = LangInfo data LangInfo = LangInfo
{ langCode :: String -- ^ 3-letter ISO 639-2/B code { langCode :: String -- ^ 3-letter ISO 639-2/B code
, langName :: String -- ^ language name
, langDir :: String -- ^ directory name , langDir :: String -- ^ directory name
, langFunctor :: Maybe String -- ^ functor (not used) , langFunctor :: Maybe String -- ^ functor (not used)
, langUnlexer :: Maybe String -- ^ decoding for postprocessing linearizations , langUnlexer :: Maybe String -- ^ decoding for postprocessing linearizations
@@ -44,15 +45,16 @@ loadLangsFrom configFile = do
then die $ "Invalid entry in " ++ configFile ++ ": " ++ s then die $ "Invalid entry in " ++ configFile ++ ": " ++ s
else return $ LangInfo else return $ LangInfo
{ langCode = bits !! 0 { langCode = bits !! 0
, langDir = bits !! 1 , langName = bits !! 1
, langFunctor = maybeBit bits 2 , langDir = bits !! 2
, langUnlexer = maybeBit bits 3 , langFunctor = maybeBit bits 3
, langPresent = boolBit bits 4 False , langUnlexer = maybeBit bits 4
, langAll = boolBit bits 5 True , langPresent = boolBit bits 5 False
, langTry = boolBit bits 6 True , langAll = boolBit bits 6 True
, langSymbolic = boolBit bits 7 True , langTry = boolBit bits 7 True
, langCompatibility = boolBit bits 8 False , langSymbolic = boolBit bits 8 True
, langSynopsis = boolBit bits 9 False , langCompatibility = boolBit bits 9 False
, langSynopsis = boolBit bits 10 False
} }
-- | Separate a string on a character -- | Separate a string on a character

10
Make.sh
View File

@@ -6,11 +6,11 @@
set -e set -e
# Get languages from config # Get languages from config
langs=$(tail -n +2 languages.csv | awk -F ',' '{ if ($6 != "n") { 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 ($5 == "y") { 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 ($7 != "n") { 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 ($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 ($9 == "y") { print $1 } }') langs_compat=$(tail -n +2 languages.csv | awk -F ',' '{ if ($10 == "y") { print $1 } }')
# Modules to compile for each language # Modules to compile for each language
modules_langs="All Symbol Compatibility" modules_langs="All Symbol Compatibility"

View File

@@ -34,6 +34,7 @@ This file should be kept up-to-date and all build methods should read this confi
| Column | Description | Default | | Column | Description | Default |
|:--------------|:-----------------------------------------|:-------:| |:--------------|:-----------------------------------------|:-------:|
| Code | e.g. `Eng` | - | | Code | e.g. `Eng` | - |
| Name | language name in English, e.g. `English` | - |
| Directory | folder name under `src`, e.g. `english` | - | | Directory | folder name under `src`, e.g. `english` | - |
| Functor | (not used) | - | | Functor | (not used) | - |
| Unlexer | (not used) | - | | Unlexer | (not used) | - |

View File

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

@@ -93,5 +93,6 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in {
linref linref
CN = \cn -> uttCN cn ! Masc ; CN = \cn -> uttCN cn ! Masc ;
N = \n -> uttCN (useN n) ! Masc ;
} }

View File

@@ -0,0 +1,147 @@
concrete ConstructionAra of Construction = CatAra ** open
ParadigmsAra,
SyntaxAra,
SymbolicAra,
StructuralAra,
(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
-- : NP -> NP -> Cl
have_name_Cl pe nm =
let subjPron : Pron = case pe.a.isPron of {
True => pe ;
False => case (R.pgn2gn pe.a.pgn).g of {
R.Fem => she_Pron ;
R.Masc => he_Pron }
} ;
myName : NP = mkNP (mkDet subjPron) L.name_N ;
in mkCl myName nm ; --TODO: now it only works for pronouns, drops the NP
-- what_name_QCl =
-- 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 special 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 persian_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,36 @@ concrete ExtendAra of Extend =
CatAra ** ExtendFunctor - [ CatAra ** ExtendFunctor - [
GenNP, SlashBareV2S, PredAPVP, GenModNP, ExistsNP, GenNP, SlashBareV2S, PredAPVP, GenModNP, ExistsNP,
StrandRelSlash, ExistPluralCN, ExistMassCN, ExistCN, EmptyRelSlash, DetNPMasc, DetNPFem, StrandRelSlash, ExistPluralCN, ExistMassCN, ExistCN, EmptyRelSlash, DetNPMasc, DetNPFem,
ComplBareVS, ComplDirectVS, ComplDirectVQ ComplBareVS, ComplDirectVS, ComplDirectVQ,
ICompAP,
VPS, MkVPS
] ]
with (Grammar=GrammarAra) with (Grammar=GrammarAra)
** open ** open
Prelude, Prelude,
ResAra ResAra,
ParamX
in { in {
lin lin
GenNP np = { s = \\_,_,_,_ => np.s ! Gen ; d = Const ; isNum, isPron = False } ; GenNP np = {s = \\_,_,_,_ => np.s ! Gen ; d = Const ; isNum,isPron,is1sg = False} ;
} ;
-- : AP -> IComp ; -- "how old"
ICompAP ap = {s = \\gn => "كَمْ" ++ ap.s ! NoHum ! gn.g ! gn.n ! Indef ! Acc} ;
lincat
VPS = VP ; -- finite VP's with tense and polarity
lin
-- : Temp -> Pol -> VP -> VPS ; -- hasn't slept
MkVPS t p vp = lin VPS (vp ** {
s = \\pgn,vf => case <t.t,t.a> of { --- IL guessed tenses
<(Pres|Fut),Simul> => vp.s ! pgn ! VPImpf Ind ;
<Cond,_ > => vp.s ! pgn ! VPImpf Cnj ;
<_ ,_ > => vp.s ! pgn ! VPPerf
}
}) ;
}

View File

@@ -49,6 +49,7 @@ oper ReflA2 : A2 -> AP = notYet "ReflA2" ;
oper ReflVP : VPSlash -> VP = notYet "ReflVP" ; oper ReflVP : VPSlash -> VP = notYet "ReflVP" ;
oper SentAP : AP -> SC -> AP = notYet "SentAP" ; oper SentAP : AP -> SC -> AP = notYet "SentAP" ;
oper SentCN : CN -> SC -> CN = notYet "SentCN" ; oper SentCN : CN -> SC -> CN = notYet "SentCN" ;
oper SlashPrep : Cl -> Prep -> ClSlash = notYet "SlashPrep" ;
oper Slash2V3 : V3 -> NP -> VPSlash = notYet "Slash2V3" ; oper Slash2V3 : V3 -> NP -> VPSlash = notYet "Slash2V3" ;
oper SlashV2A : V2A -> AP -> VPSlash = notYet "SlashV2A" ; oper SlashV2A : V2A -> AP -> VPSlash = notYet "SlashV2A" ;
oper SlashV2Q : V2Q -> QS -> VPSlash = notYet "SlashV2Q" ; oper SlashV2Q : V2Q -> QS -> VPSlash = notYet "SlashV2Q" ;

View File

@@ -13,8 +13,8 @@ lin
cn.s ! number cn.s ! number
! nounState det.d number ! nounState det.d number
! nounCase c det.n det.d ; ! nounCase c det.n det.d ;
adj : Case -> Str = \c -> adj : NTable -> Case -> Str = \ntable,c ->
cn.adj ! number ntable ! number
! (definite ! det.d) -- Indef remains Indef, rest become Def ! (definite ! det.d) -- Indef remains Indef, rest become Def
! c ! c
} in { } in {
@@ -22,30 +22,34 @@ lin
case cnB4det det.isPron det.isNum det.n det.d of { case cnB4det det.isPron det.isNum det.n det.d of {
False => determiner c False => determiner c
++ noun c ++ noun c
++ adj c ++ adj cn.s2 c
++ adj cn.adj c
++ cn.np ! c ; ++ cn.np ! c ;
True => noun (cas c) -- deal with possessive suffix True => noun (cas c) -- deal with possessive suffix
++ determiner c ++ determiner c
++ adj c ++ adj cn.s2 c
++ adj cn.adj c
++ cn.np ! c ++ cn.np ! c
}; };
a = { pgn = agrP3 cn.h cn.g number; a = { pgn = agrP3 cn.h cn.g number;
isPron = False } isPron = False } ;
empty = []
}; };
UsePN pn = { UsePN pn = {
s = pn.s; s = pn.s;
a = {pgn = (Per3 pn.g Sg); isPron = False } a = {pgn = Per3 pn.g Sg ; isPron = False} ;
empty = []
}; };
UsePron p = p ; UsePron p = p ;
PredetNP pred np = { PredetNP pred np = np ** {
s = \\c => case pred.isDecl of { s = \\c => case pred.isDecl of {
True => pred.s!c ++ np.s ! Gen ; -- akvaru l-awlAdi True => pred.s!c ++ np.s ! Gen ; -- akvaru l-awlAdi
False => pred.s!c ++ np.s ! c False => pred.s!c ++ np.s ! c
}; } ;
a = np.a a = np.a ** {isPron=False}
} ; } ;
{- {-
@@ -167,26 +171,23 @@ lin
MassNP cn = ---- AR MassNP cn = ---- AR
{s = \\c => cn.s ! Sg ! Indef ! c ++ cn.np ! c ++ cn.adj ! Sg ! Indef ! c ; {s = \\c => cn.s ! Sg ! Indef ! c ++ cn.np ! c ++ cn.adj ! Sg ! Indef ! c ;
a = {pgn = Per3 cn.g Sg ; isPron = False}} ; a = {pgn = Per3 cn.g Sg ; isPron = False} ;
empty = []} ;
-- MassDet = {s = \\_,_,_,_ => [] ; d = Indef; -- MassDet = {s = \\_,_,_,_ => [] ; d = Indef;
-- isNum = False; isPron = False} ; -- isNum = False; isPron = False} ;
UseN, UseN,
UseN2 = \n -> n ** { UseN2 = useN ;
adj = \\_,_,_ => [];
np = \\_ => []};
Use2N3 n3 = n3 ; Use2N3 n3 = n3 ;
Use3N3 n3 = n3 ** {c2 = n3.c3} ; Use3N3 n3 = n3 ** {c2 = n3.c3} ;
ComplN2 n2 np = UseN n2 ** --- IL ComplN2 n2 np = UseN n2 ** {np=np.s} ;
{s = \\n,s,c => n2.s ! n ! s ! c ++ n2.c2.s ++ np.s ! n2.c2.c} ;
ComplN3 n3 np = ComplN2 n3 np ** {c2 = n3.c3} ; ComplN3 n3 np = ComplN2 n3 np ** {c2 = n3.c3} ;
AdjCN ap cn = cn ** { AdjCN ap cn = cn ** {
adj = \\n,d,c => ap.s ! cn.h ! cn.g ! n ! (definite ! d) ! c adj = \\n,d,c => cn.adj ! n ! d ! c ++ ap.s ! cn.h ! cn.g ! n ! (definite ! d) ! c
}; };
RelCN cn rs = cn ** {s = \\n,s,c => cn.s ! n ! s ! c ++ rs.s ! {pgn=Per3 cn.g n ; isPron=False} ! c}; RelCN cn rs = cn ** {s = \\n,s,c => cn.s ! n ! s ! c ++ rs.s ! {pgn=Per3 cn.g n ; isPron=False} ! c};

View File

@@ -34,10 +34,16 @@ oper
l@(""|"ال") + ("أ"|"أَ") + #hamza + tail => l + "آ" + tail; l@(""|"ال") + ("أ"|"أَ") + #hamza + tail => l + "آ" + tail;
l@(""|"ال") + #hamza + v@("َ"|"ُ") + tail => l + "أ" + v + tail; l@(""|"ال") + #hamza + v@("َ"|"ُ") + tail => l + "أ" + v + tail;
l@(""|"ال") + #hamza + v@("ِ") + tail => l + "إ" + v + tail; l@(""|"ال") + #hamza + v@("ِ") + tail => l + "إ" + v + tail;
head + v1@("ِ"|"ُ"|"َ"|"ْ"|"ا"|"ي"|"و") head + v1@(#vow|"ْ"|"ا"|"ي"|"و")
+ #hamza + v2@(#vow|"ْ") + tail => + #hamza + v2@(#vow|"ْ") + tail =>
case v2 of { "ْ" => head + v1 + tHmz v1 + tail ; -- unsure about this /IL case v2 of { "ْ" => head + v1 + bHmz v1 v2 + tail ; -- unsure about this /IL
_ => head + v1 + tHmz v1 + v2 + tail } ; _ => 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 ;
head + #hamza + tail => head + (bHmz (dp 2 head) (take 2 tail)) + tail; --last head , take 1 tail head + #hamza + tail => head + (bHmz (dp 2 head) (take 2 tail)) + tail; --last head , take 1 tail
_ => word _ => word

View File

@@ -70,7 +70,8 @@ resource ParadigmsAra = open
mkN : (sg,pl : Str) -> Gender -> Species -> N ; mkN : (sg,pl : Str) -> Gender -> Species -> N ;
mkN : NTable -> Gender -> Species -> N ; -- loan words, irregular mkN : NTable -> Gender -> Species -> N ; -- loan words, irregular
mkN : (root,sgPatt,brokenPlPatt : Str) -> Gender -> Species -> N ; -- broken plural mkN : (root,sgPatt,brokenPlPatt : Str) -> Gender -> Species -> N ; -- broken plural
mkN : N -> (attr : Str) -> N ; -- Compound nouns mkN : N -> (attr : Str) -> N ; -- Compound noun with invariant attribute
mkN : N -> N -> N ; -- Compound noun where both parts inflect
--- mkN : (root,sgPatt : Str) -> Gender -> Species -> N -- sound feminine plural --- mkN : (root,sgPatt : Str) -> Gender -> Species -> N -- sound feminine plural
--- = sdfN ; --- = sdfN ;
} ; } ;
@@ -97,6 +98,8 @@ resource ParadigmsAra = open
mkPN = overload { mkPN = overload {
mkPN : Str -> PN -- Fem Hum if ends with ة, otherwise Masc Hum mkPN : Str -> PN -- Fem Hum if ends with ة, otherwise Masc Hum
= smartPN ; = smartPN ;
mkPN : N -> PN
= \n -> lin PN (n ** {s = \\c => n.s ! Sg ! Const ! Bare}) ; -- no idea /IL
mkPN : Str -> Gender -> Species -> PN mkPN : Str -> Gender -> Species -> PN
= mkFullPN ; = mkFullPN ;
} ; } ;
@@ -343,7 +346,12 @@ resource ParadigmsAra = open
mkN : (root,sgPatt,brokenPlPatt : Str) -> Gender -> Species -> N -- broken plural mkN : (root,sgPatt,brokenPlPatt : Str) -> Gender -> Species -> N -- broken plural
= brkN ; = brkN ;
mkN : N -> (attr : Str) -> N -- Compound nouns 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) = \n,attr -> n ** {s2 = \\n,s,c => attr} ;
mkN : N -> N -> N -- Compound nouns
= \n1,n2 -> n1 ** {s2 =
\\n,s,c => n1.s2 ! n ! s ! c -- card
++ n2.s ! n ! s ! c -- type
++ n2.s2 ! n ! s ! c} ; -- blood
} ; } ;
mkV = overload { mkV = overload {
@@ -374,15 +382,15 @@ resource ParadigmsAra = open
v1' : Str -> Vowel -> Vowel -> Verb = v1' : Str -> Vowel -> Vowel -> Verb =
\rootStr,vPerf,vImpf -> \rootStr,vPerf,vImpf ->
let { root = mkRoot3 rootStr } in let root = mkRoot3 rootStr
case <root.l, root.c> of { in case rootStr of {
<"ّ", _> => v1geminate rootStr vPerf vImpf ; _ + "ّ" => v1geminate rootStr vPerf vImpf ;
<"و"|"ي",_> => case vPerf of { ? + #hamza + #weak => v1doubleweak root ;
? + ? + #weak => case vPerf of {
i => v1defective_i root vImpf ; i => v1defective_i root vImpf ;
_ => v1defective_a root vImpf } ; _ => v1defective_a root vImpf } ;
<_,"و"|"ي"> => v1hollow root vImpf ; ? + #weak + ? => v1hollow root vImpf ;
_ => v1sound root vPerf vImpf _ => v1sound root vPerf vImpf } ;
};
v2 = v2 =
\rootStr -> \rootStr ->
@@ -464,6 +472,7 @@ resource ParadigmsAra = open
mkFullN nsc gen spec = mkFullN nsc gen spec =
{ s = nsc; --NTable { s = nsc; --NTable
s2 = emptyNTable;
g = gen; g = gen;
h = spec; h = spec;
lock_N = <> lock_N = <>
@@ -476,14 +485,12 @@ resource ParadigmsAra = open
} in mkFullN (reg kitAb kutub) gen spec; } in mkFullN (reg kitAb kutub) gen spec;
brkN root sg pl 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 => { s = \\n,d,c =>
case root of { case root of {
_ + #hamza + _ => rectifyHmz(raw.s ! n ! d ! c); _ + #hamza + _ => rectifyHmz(raw.s ! n ! d ! c);
_ => raw.s ! n ! d ! c _ => raw.s ! n ! d ! c
}; }
g = gen;
h = spec ; lock_N = <>
}; };
sdfN = sdfN =
@@ -525,29 +532,31 @@ resource ParadigmsAra = open
lin N3 (n ** {c2 = mkPreposition p ; c3 = mkPreposition q}) ; lin N3 (n ** {c2 = mkPreposition p ; c3 = mkPreposition q}) ;
} ; } ;
mkPron : (_,_,_ : Str) -> PerGenNum -> NP = \ana,nI,I,pgn -> mkPron : (_,_,_ : Str) -> PerGenNum -> Pron = \ana,nI,I,pgn ->
{ s = lin Pron { s =
table { table {
Acc => BIND ++ nI; -- object suffix Acc => BIND ++ nI; -- object suffix
Gen => BIND ++ I; -- possessive suffix Gen => BIND ++ I; -- possessive suffix
_ => ana _ => ana
}; };
a = {pgn = pgn; isPron = True }; a = {pgn = pgn; isPron = True };
lock_NP = <> empty = []
}; };
proDrop : NP -> NP = ResAra.proDrop ; -- Force a NP to lose its string, only contributing with its agreement.
-- e.g. al-jamii3, 2a7ad -- e.g. al-jamii3, 2a7ad
regNP : Str -> Number -> NP = \word,n -> regNP : Str -> Number -> NP = \word,n -> lin NP
{ s = \\c => fixShd word (dec1sg ! Def ! c) ; { s = \\c => fixShd word (dec1sg ! Def ! c) ;
a = {pgn = Per3 Masc n; isPron = False }; a = {pgn = Per3 Masc n; isPron = False };
lock_NP = <> empty = []
}; };
-- e.g. hadha, dhaalika -- e.g. hadha, dhaalika
indeclNP : Str -> Number -> NP = \word,n -> indeclNP : Str -> Number -> NP = \word,n -> lin NP
{ s = \\c => word ; { s = \\c => word ;
a = {pgn = Per3 Masc n; isPron = False }; a = {pgn = Per3 Masc n; isPron = False };
lock_NP = <> empty = []
}; };
mkQuant7 : (_,_,_,_,_,_,_ : Str) -> State -> Quant = mkQuant7 : (_,_,_,_,_,_,_ : Str) -> State -> Quant =

View File

@@ -11,7 +11,7 @@ concrete PhraseAra of Phrase = CatAra ** open
UttImpSg pol imp = {s = \\g => imp.s ! pol.p ! g ! ResAra.Sg ++ pol.s} ; 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} ; UttImpPl,UttImpPol = \pol,imp -> {s = \\g => imp.s ! pol.p ! g ! ResAra.Pl ++ pol.s} ;
UttIP ip = {s = \\_g => ip.s ! False ! Def ! Nom} ; --IL UttIP ip = {s = \\g => ip.s ! False ! g ! Def ! Nom} ; --IL
UttAP ap = {s = ResAra.uttAP ap} ; --IL UttAP ap = {s = ResAra.uttAP ap} ; --IL
UttCard c = {s = ResAra.uttNum c} ; --IL UttCard c = {s = ResAra.uttNum c} ; --IL

View File

@@ -29,44 +29,47 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA
-- : IComp -> NP -> QCl -- : IComp -> NP -> QCl
QuestIComp ic np = QuestIComp ic np =
let vp = kaan (CompNP np) ; let vp = kaan (CompNP np) ;
ip : ResAra.IP = np ** { ip : ResAra.IP = np ** { -- NP's s is already present in VP, we only want its agr
s = \\_,_,_ => ic.s ! pgn2gn np.a.pgn } ; s = \\_,_,_,_ => ic.s ! pgn2gn np.a.pgn } ;
in QuestVP ip vp ; in QuestVP ip vp ;
-- : IP -> IComp ; -- : IP -> IComp ;
CompIP ip = ip ** { CompIP ip = ip ** {
s = \\_ => ip.s ! True -- True=IP will be a subject of predicative sentence 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 ! Def ! Nom ; -- IP will be a subject
} ; } ;
CompIAdv iadv = { s = \\_ => iadv.s ; a = ResAra.Sg } ; CompIAdv iadv = { s = \\_ => iadv.s ; a = ResAra.Sg } ;
-- QCl = {s : Tense => Polarity => QForm => Str} ; -- QCl = {s : Tense => Polarity => QForm => Str} ;
QuestSlash ip cl = { ----IL just guessing QuestSlash ip cls = { ----IL just guessing
s = \\t,p,qf => s = \\t,p,qf =>
let o = case qf of { QDir => Nominal ; _ => Verbal } ; -- purely guessing let cl : ResAra.Cl = complClSlash cls ; -- dummy conversion to Cl
in cl.c2.s ++ ip.s ! False ! Def ! Nom ++ cl.s ! t ! p ! o o = case qf of { QDir => Nominal ; _ => Verbal } ; -- purely guessing
in cls.c2.s ++ ip.s ! False ! Masc ! Def ! Nom ++ cl.s ! t ! p ! o
} ; } ;
--IL guessed --IL guessed
PrepIP p ip = { PrepIP p ip = {
s = p.s ++ ip.s ! False -- not used as a subject of predicative sentence s = p.s ++ ip.s ! False -- not used as a subject of predicative sentence
! Masc ----
! Def ! Gen ! Def ! Gen
} ; } ;
AdvIP ip adv = ip ** { AdvIP ip adv = ip ** {
s = \\g,s,c => ip.s ! g ! s ! c ++ adv.s ; s = \\isPred,g,s,c => ip.s ! isPred ! g ! s ! c ++ adv.s ;
} ; } ;
-- : IDet -> IP -- : IDet -> IP
IdetIP idet = idet ** { IdetIP idet = idet ** {
s = \\isPred => idet.s ! Masc ; s = \\isPred => idet.s ;
a = { pgn = agrP3 NoHum Masc idet.n ; isPron = False } a = { pgn = agrP3 NoHum Masc idet.n ; isPron = False }
} ; } ;
-- : IDet -> CN -> IP -- : IDet -> CN -> IP
IdetCN idet cn = { IdetCN idet cn = {
s = \\isPred,s,c s = \\isPred,g,s,c
=> idet.s ! cn.g ! s ! c ++ => idet.s ! cn.g ! s ! c ++
cn.s ! idet.n ! Indef ! Gen ; --idaafa cn.s ! idet.n ! Indef ! Gen ; --idaafa
a = { pgn = agrP3 NoHum cn.g idet.n ; isPron = False } a = { pgn = agrP3 NoHum cn.g idet.n ; isPron = False }

View File

@@ -13,19 +13,20 @@ concrete RelativeAra of Relative = CatAra **
s = \\t,p,agr,c => s = \\t,p,agr,c =>
let let
npS : Case => Str = \\_ => rp.s ! agr2ragr agr c ; npS : Case => Str = \\_ => rp.s ! agr2ragr agr c ;
np = {s = npS ; a = agr} ; np = emptyNP ** {s = npS ; a = agr} ;
cl = Se.PredVP np vp ; cl = Se.PredVP np vp ;
in in
cl.s ! t ! p ! Nominal cl.s ! t ! p ! Nominal
} ; } ;
-- : RP -> ClSlash -> RCl ; -- whom John loves -- : RP -> ClSlash -> RCl ; -- whom John loves
RelSlash rp cl = cl ** { RelSlash rp cls = cls ** {
s = \\t,p,agr,c => s = \\t,p,agr,c =>
let obj = case (pgn2gn agr.pgn).g of { let obj = case (pgn2gn agr.pgn).g of {
Fem => St.she_Pron ; Fem => St.she_Pron ; -- head is repeated as a clitic object pronoun
Masc => St.he_Pron } ; Masc => St.he_Pron } ;
in rp.s ! agr2ragr agr c ++ cl.s ! t ! p ! Nominal ++ cl.c2.s ++ obj.s ! cl.c2.c cl : ResAra.Cl = complClSlash obj cls ;
in rp.s ! agr2ragr agr c ++ cl.s ! t ! p ! VOS
} ; } ;
-- --
-- FunRP p np rp = { -- FunRP p np rp = {

View File

@@ -26,7 +26,8 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in {
-- case vowel retained -- case vowel retained
Mood = Ind | Cnj | Jus ; Mood = Ind | Cnj | Jus ;
Voice = Act | Pas ; Voice = Act | Pas ;
Order = Verbal | Nominal ; Order = Verbal | Nominal
| VOS ; -- Relative clauses with resumptive pronouns
oper oper
@@ -105,9 +106,10 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in {
--types of open classes: --types of open classes:
NTable = Number => State => Case => Str; NTable = Number => State => Case => Str;
emptyNTable : NTable = \\n,s,c => [] ;
Preposition : Type = {s : Str ; c : Case} ; Preposition : Type = {s : Str ; c : Case} ;
Noun : Type = {s : NTable ; g : Gender; h : Species} ; Noun : Type = {s,s2 : NTable ; g : Gender; h : Species} ;
Noun2 : Type = Noun ** {c2 : Preposition} ; Noun2 : Type = Noun ** {c2 : Preposition} ;
Noun3 : Type = Noun2 ** {c3 : Preposition} ; Noun3 : Type = Noun2 ** {c3 : Preposition} ;
@@ -128,8 +130,13 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in {
uttAP ap = \\g => ap.s ! NoHum ! g ! Sg ! Def ! Nom ; ----IL uttAP ap = \\g => ap.s ! NoHum ! g ! Sg ! Def ! Nom ; ----IL
CN : Type = Noun ** {adj : NTable ; np : Case => Str}; CN : Type = Noun ** {adj : NTable ; np : Case => Str};
useN : Noun -> CN = \n -> n ** {adj = \\_,_,_ => []; np = \\_ => []} ;
uttCN : CN -> (Gender => Str) ; uttCN : CN -> (Gender => Str) ;
uttCN cn = \\_ => cn.s ! Sg ! Indef ! Bare ; uttCN cn = \\_ => cn.s ! Sg ! Indef ! Bare ++
cn.s2 ! Sg ! Indef ! Bare ++
cn.adj ! Sg ! Indef ! Bare ;
NumOrdCard : Type = { NumOrdCard : Type = {
s : Gender => State => Case => Str ; s : Gender => State => Case => Str ;
@@ -552,6 +559,12 @@ v1defective_i : Root3 -> Vowel -> Verb = \bqy,vowImpf -> -- IL (conjugation 1d4)
x => vforms_a ! x } ; x => vforms_a ! x } ;
in verbDef vforms_i vowImpf ; in verbDef vforms_i vowImpf ;
v1doubleweak : Root3 -> Verb = \r'y ->
let ry = r'y ** {c = ""} ;
vforms : DefForms = \\x => rmSukun (v1DefForms_perfA ry a ! x) ; -- only remove the first sukun
in verbDoubleDef vforms i ; -- sukun in suffixes is removed in verbDoubleDef
patDef1 : Vowel => Pattern = patDef1 : Vowel => Pattern =
table { table {
u => fcu ; u => fcu ;
@@ -641,7 +654,6 @@ v4doubleweak : Root3 -> Verb = \r'y ->
vforms : DefForms = \\x => rmSukun (v4DefForms ry ! x) ; -- only remove the first sukun vforms : DefForms = \\x => rmSukun (v4DefForms ry ! x) ; -- only remove the first sukun
in verbDoubleDef vforms i ; -- sukun in suffixes is removed in verbDoubleDef in verbDoubleDef vforms i ; -- sukun in suffixes is removed in verbDoubleDef
v5sound : Root3 -> Verb = v5sound : Root3 -> Verb =
\nfs -> \nfs ->
let { let {
@@ -1129,12 +1141,12 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
mkIP = overload { mkIP = overload {
mkIP : Str -> Number -> IP = \maa,n -> { mkIP : Str -> Number -> IP = \maa,n -> {
s = \\_p,_s,_c => maa ; s = \\_p,_g,_s,_c => maa ;
a = { pgn = agrP3 NoHum Masc n ; isPron = False } a = { pgn = agrP3 NoHum Masc n ; isPron = False }
} ; } ;
mkIP : (_,_ : Str) -> Number -> IP = \maa,maadhaa,n -> { mkIP : (_,_ : Str) -> Number -> IP = \maa,maadhaa,n -> {
s = table { True => \\_s,_c => maa ; s = table { True => \\_g,_s,_c => maa ;
False => \\_s,_c => maadhaa } ; False => \\_g,_s,_c => maadhaa } ;
a = { pgn = agrP3 NoHum Masc n ; isPron = False } a = { pgn = agrP3 NoHum Masc n ; isPron = False }
} }
} ; } ;
@@ -1181,6 +1193,8 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
Agr = { pgn : PerGenNum; isPron : Bool} ; Agr = { pgn : PerGenNum; isPron : Bool} ;
AAgr = { g : Gender ; n : Number} ; AAgr = { g : Gender ; n : Number} ;
Comp : Type = { Comp : Type = {
s : AAgr => Case => Str s : AAgr => Case => Str
} ; } ;
@@ -1198,17 +1212,31 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
NP : Type = { NP : Type = {
s : Case => Str ; s : Case => Str ;
a : Agr a : Agr ;
empty : Str -- to prevent ambiguities with prodrop
} ; } ;
proDrop : NP -> NP = \np ->
case np.a.isPron of {
True => np ** {s = \\_ => []};
_ => np
} ;
emptyNP : NP = {
s = \\_ => [] ;
a = {pgn = Per3 Masc Sg ; isPron = False} ;
empty = []} ;
IP : Type = { IP : Type = {
s : Bool -- different forms for "what is this" and "what do you do" 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 => State => Case -- because of PrepIP: e.g. "in which" chooses definite accusative
=> Str ; => Str ;
a : Agr -- can be both subject and object of a QCl, needs full agr. info a : Agr -- can be both subject and object of a QCl, needs full agr. info (stupid given that s depends on gender but meh)
} ; } ;
ip2np : IP -> Bool -> NP = \ip,isPred -> ip ** { s = ip.s ! isPred ! Def } ; ip2np : IP -> Bool -> NP = \ip,isPred -> ip ** { s = ip.s ! isPred ! Masc ! Def ; empty = [] } ;
np2ip : NP -> IP = \np -> np ** {s = \\_,_,_ => np.s} ;
IDet : Type = { IDet : Type = {
s : Gender -- IdetCN needs to choose the gender of the CN s : Gender -- IdetCN needs to choose the gender of the CN
@@ -1228,7 +1256,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
oper oper
VP : Type = { VP : Type = {
s : PerGenNum => VPForm => Str; s : PerGenNum => VPForm => Str ;
obj : Obj; obj : Obj;
pred : Comp; pred : Comp;
isPred : Bool; --indicates if there is a predicate (xabar) isPred : Bool; --indicates if there is a predicate (xabar)
@@ -1263,8 +1291,63 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
isPred = False isPred = False
}; };
predVSlash : Verb2 -> VPSlash = \v -> passPredV : Verb -> VP = \v ->
predV v ** {c2 = v.c2} ; 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
};
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 : ParamX.Tense -> Polarity -> Str =
\tn,pl -> 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> => "سَ" ++ yaktubu ;
<_, Fut, Neg> => "لَنْ" ++ yaktuba
};
pred : ParamX.Tense -> Polarity -> Str =
\tn,pl -> 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
};
subj = np.empty
++ case <vp.isPred,np.a.isPron> of {
<False,True> => [] ; -- prodrop if it's not predicative
_ => np.s ! Nom
} ;
} in
case o of {
Verbal => vStr t p ++ case vp.obj.a.isPron of {
True => vp.obj.s ++ subj ; -- obj. clitic attaches directly to the verb
False => subj ++ vp.obj.s }
++ vp.s2 ++ pred t p ;
Nominal => subj ++ vStr t p ++ vp.obj.s ++ vp.s2 ++ pred t p ;
VOS => vStr t p ++ vp.obj.s ++ vp.s2 ++ pred t p ++ subj
}
} ;
-- in verbal sentences, the verb agrees with the subject -- in verbal sentences, the verb agrees with the subject
-- in Gender but not in number -- in Gender but not in number
@@ -1286,11 +1369,30 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
{ s2 = vp.s2 ++ str }; { s2 = vp.s2 ++ str };
kaan : {s : AAgr => Case => Str} -> VP = \xabar -> kaan : {s : AAgr => Case => Str} -> VP = \xabar ->
insertPred xabar (predV (v1hollow {f = "ك"; c = "و" ; l = "ن"} u) ); insertPred xabar (predV copula);
copula : Verb = v1hollow {f = "ك"; c = "و" ; l = "ن"} u ;
-- Slash categories -- Slash categories
VPSlash : Type = VP ** {c2 : Preposition} ; VPSlash : Type = VP ** {c2 : Preposition} ;
ClSlash : Type = Cl ** {c2 : Preposition} ; ClSlash : Type = VPSlash ** {subj : NP} ;
slashV2 : Verb2 -> VPSlash = \v ->
predV v ** {c2 = v.c2} ;
-- 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 = np
} ;
complClSlash = overload {
complClSlash : NP -> ClSlash -> Cl = \obj,cls ->
predVP cls.subj (insertObj obj cls) ;
complClSlash : ClSlash -> Cl = \cls ->
predVP cls.subj (insertObj emptyNP cls) -- Empty subject and object
} ;
Cl : Type = {s : Tense => Polarity => Order => Str} ; Cl : Type = {s : Tense => Polarity => Order => Str} ;
QCl : Type = {s : Tense => Polarity => QForm => Str} ; QCl : Type = {s : Tense => Polarity => QForm => Str} ;
@@ -1304,9 +1406,8 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
agr2ragr : Agr -> Case -> RAgr = \a,c -> agr2ragr : Agr -> Case -> RAgr = \a,c ->
let gn = pgn2gn a.pgn in case <gn.n,gn.g,a> of { let gn = pgn2gn a.pgn in case <gn.n,gn.g,a> of {
<Sg,x> => RSg x ; <Sg,x> => RSg x ;
<Pl,x> => RPl x ;
<Dl,x> => RDl x c ; <Dl,x> => RDl x c ;
_ => Predef.error "agr2ragr"} ; <Pl,x> => RPl x } ;
agr2ragr : Number -> Case -> Gender -> RAgr = \n,c,g -> agr2ragr : Number -> Case -> Gender -> RAgr = \n,c,g ->
case n of { case n of {
Sg => RSg g ; Sg => RSg g ;

View File

@@ -26,58 +26,7 @@ concrete SentenceAra of Sentence = CatAra ** open
} }
}; };
-} -}
PredVP np vp = PredVP = predVP ;
{ 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 : ParamX.Tense -> Polarity -> Str =
\tn,pl -> 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 ;
<_, _Fut, Pos> => "سَ" ++ yaktubu ;
<_, _Fut, Neg> => "لَنْ" ++ yaktuba
};
pred : ParamX.Tense -> Polarity -> Str =
\tn,pl -> 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
};
} 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)
}
};
-- PredSCVP sc vp = mkClause sc.s (agrP3 Sg) vp ; -- PredSCVP sc vp = mkClause sc.s (agrP3 Sg) vp ;
@@ -100,9 +49,13 @@ concrete SentenceAra of Sentence = CatAra ** open
-- ClSlash -- ClSlash
SlashVP np vps = PredVP np vps ** { c2 = vps.c2 } ; SlashVP = predVPSlash ;
AdvSlash slash adv = slash ** { s2 = slash.s2 ++ adv.s } ; AdvSlash slash adv = slash ** { s2 = slash.s2 ++ adv.s } ;
SlashPrep cl prep = cl ** {c2 = prep} ;
-- SlashPrep : Cl -> Prep -> ClSlash
-- Will be awkward to implement in the way ClSlash is now.
-- ClSlash is implemented the way it is now for a good reason:
-- we need to support different word orders.
-- SlashVS np vs sslash = TODO -- SlashVS np vs sslash = TODO
@@ -111,25 +64,26 @@ concrete SentenceAra of Sentence = CatAra ** open
-- EmbedQS qs = {s = qs.s ! QIndir} ; -- EmbedQS qs = {s = qs.s ! QIndir} ;
-- EmbedVP vp = {s = infVP False vp (agrP3 Sg)} ; --- agr -- EmbedVP vp = {s = infVP False vp (agrP3 Sg)} ; --- agr
-- --
UseSlash,
UseCl = \t,p,cl -> UseCl t p cl =
{s = t.s ++ p.s ++ {s = t.s ++ p.s ++
case <t.t,t.a> of { --- IL guessed tenses case <t.t,t.a> of { --- IL guessed tenses
<(Pres|Cond),Simul> => cl.s ! Pres ! p.p ! Nominal ; <Pres,Simul> => cl.s ! Pres ! p.p ! Nominal ;
<Fut ,_ > => cl.s ! Fut ! p.p ! Nominal ; <Pres,Anter> => cl.s ! Past ! p.p ! Nominal ;
<_ ,_ > => cl.s ! Past ! p.p ! Nominal <x ,_ > => cl.s ! x ! p.p ! Nominal
} }
}; };
UseQCl t p qcl = UseQCl t p qcl =
{s = \\q => t.s ++ p.s ++ {s = \\q => t.s ++ p.s ++
case <t.t,t.a> of { --- IL guessed tenses case <t.t,t.a> of { --- IL guessed tenses
<(Pres|Cond),Simul> => qcl.s ! Pres ! p.p ! q ; <Pres,Simul> => qcl.s ! Pres ! p.p ! q ;
<Fut ,_ > => qcl.s ! Fut ! p.p ! q ; <Pres,Anter> => qcl.s ! Past ! p.p ! q ;
<_ ,_ > => qcl.s ! Past ! p.p ! q <x ,_ > => qcl.s ! x ! p.p ! q
} }
}; };
UseRCl t p cl = {s = \\agr,c => t.s ++ p.s ++ cl.s ! t.t ! p.p ! agr ! c} ; 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) ;
} }

View File

@@ -17,10 +17,12 @@ lin
let g = cn.g ; n = sizeToNumber det.n in { 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 ++ cn.s ! Sg ! Def ! c ++ cn.adj ! n ! Def ! c ++ xs.s; ----IL word order?? Seems to be nontrivial according to ResAra comments.
a = dummyAgrP3 n ; a = dummyAgrP3 n ;
empty = []
} ; } ;
CNNumNP cn i = { CNNumNP cn i = {
s = \\c => cn.s ! Sg ! Def ! c ++ uttNum i ! Masc ; s = \\c => cn.s ! Sg ! Def ! c ++ uttNum i ! Masc ;
a = dummyAgrP3 Sg ; a = dummyAgrP3 Sg ;
empty = []
} ; } ;
SymbS sy = sy ; SymbS sy = sy ;

View File

@@ -11,8 +11,8 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra in {
--SlashV2V : V2V -> VP -> VPSlash ; -- beg (her) to go --SlashV2V : V2V -> VP -> VPSlash ; -- beg (her) to go
--SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy --SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy
SlashV2a v = predVSlash v ; SlashV2a = slashV2 ;
Slash3V3 v np = insertObj np (predVSlash v) ** {c2 = v.c3}; Slash3V3 v np = insertObj np (slashV2 v) ** {c2 = v.c3};
ComplSlash vp np = insertObj np vp ; ComplSlash vp np = insertObj np vp ;
@@ -26,7 +26,8 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra in {
vp ** { vp ** {
s = \\pgn,vpf => vvVP.s ! pgn ! vpf s = \\pgn,vpf => vvVP.s ! pgn ! vpf
++ vv.c2.s -- أَنْ ++ vv.c2.s -- أَنْ
++ vp.s ! pgn ! VPImpf Cnj ++ vp.s ! pgn ! VPImpf Cnj ;
isPred = False
} ; } ;
-- ComplVS v s = insertObj (\\_ => conjThat ++ s.s) (predV v) ; -- ComplVS v s = insertObj (\\_ => conjThat ++ s.s) (predV v) ;
@@ -38,13 +39,15 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra in {
-- --
UseComp xabar = kaan xabar ; UseComp xabar = kaan xabar ;
UseCopula = predV copula ;
AdvVP vp adv = insertStr adv.s vp ; AdvVP vp adv = insertStr adv.s vp ;
-- AdVVP adv vp = insertAdV adv.s vp ; -- AdVVP adv vp = insertAdV adv.s vp ;
-- --
-- ReflV2 v = insertObj (\\a => v.c2 ++ reflPron ! a) (predV v) ; -- 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 -- UseVS, UseVQ = \vv -> {s = vv.s ; c2 = [] ; isRefl = vv.isRefl} ; -- no