forked from GitHub/gf-rgl
Merge branch 'master' into new-website
This commit is contained in:
20
Config.hs
20
Config.hs
@@ -15,6 +15,7 @@ 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
|
||||
@@ -44,15 +45,16 @@ loadLangsFrom configFile = do
|
||||
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
|
||||
, langSynopsis = boolBit bits 9 False
|
||||
, 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
|
||||
|
||||
10
Make.sh
10
Make.sh
@@ -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"
|
||||
|
||||
@@ -34,6 +34,7 @@ This file should be kept up-to-date and all build methods should read this confi
|
||||
| Column | Description | Default |
|
||||
|:--------------|:-----------------------------------------|:-------:|
|
||||
| Code | e.g. `Eng` | - |
|
||||
| Name | language name in English, e.g. `English` | - |
|
||||
| Directory | folder name under `src`, e.g. `english` | - |
|
||||
| Functor | (not used) | - |
|
||||
| Unlexer | (not used) | - |
|
||||
|
||||
@@ -1,45 +1,45 @@
|
||||
Code,Directory,Functor,Unlexer,Present,All,Try,Symbolic,Compatibility,Synopsis
|
||||
Afr,afrikaans,,,,,,n,,y
|
||||
Amh,amharic,,,,,n,n,,n
|
||||
Ara,arabic,,,,,,y,,y
|
||||
Bul,bulgarian,,,y,,,,,y
|
||||
Cat,catalan,Romance,,y,,,,y,y
|
||||
Chi,chinese,,,,,,,,y
|
||||
Dan,danish,Scand,,y,,,,,y
|
||||
Dut,dutch,,,y,,,,,y
|
||||
Eng,english,,,y,,,,y,y
|
||||
Est,estonian,,,,,,,,y
|
||||
Eus,basque,,,,,,,,y
|
||||
Fin,finnish,,,y,,,,y,y
|
||||
Fre,french,Romance,,y,,,,y,y
|
||||
Ger,german,,,,,,,,y
|
||||
Grc,ancient_greek,,,y,,n,n,,n
|
||||
Gre,greek,,,,,,,,y
|
||||
Heb,hebrew,,,,,n,n,,n
|
||||
Hin,hindi,Hindustani,to_devanagari,y,,,,,y
|
||||
Hun,hungarian,,,y,n,n,n,,n
|
||||
Ice,icelandic,,,,,,n,,y
|
||||
Ina,interlingua,,,y,,n,n,,n
|
||||
Ita,italian,Romance,,y,,,,y,y
|
||||
Jpn,japanese,,,,,,,,y
|
||||
Lat,latin,,,y,,n,n,,n
|
||||
Lav,latvian,,,,,,,y,y
|
||||
Mlt,maltese,,,,,,,,y
|
||||
Mon,mongolian,,,,,,n,,y
|
||||
Nep,nepali,,,,,,n,,y
|
||||
Nno,nynorsk,,,y,,,,,y
|
||||
Nor,norwegian,Scand,,y,,,,,y
|
||||
Pes,persian,,,,,,,,y
|
||||
Pnb,punjabi,,,y,,,,,y
|
||||
Pol,polish,,,,,,,,y
|
||||
Por,portuguese,Romance,,y,,,,y,y
|
||||
Ron,romanian,,,y,,,,,y
|
||||
Rus,russian,,,y,,,,,y
|
||||
Snd,sindhi,,,,,,,,y
|
||||
Spa,spanish,Romance,,y,,,,y,y
|
||||
Swa,swahili,,,,n,n,n,y,n
|
||||
Swe,swedish,Scand,,y,,,,y,y
|
||||
Tel,telugu,,,y,n,n,n,,n
|
||||
Tha,thai,,to_thai,,,,,,y
|
||||
Tur,turkish,,,,,n,n,,n
|
||||
Urd,urdu,Hindustani,,,,,,,y
|
||||
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
|
||||
|
||||
|
@@ -93,5 +93,6 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in {
|
||||
linref
|
||||
|
||||
CN = \cn -> uttCN cn ! Masc ;
|
||||
N = \n -> uttCN (useN n) ! Masc ;
|
||||
|
||||
}
|
||||
|
||||
147
src/arabic/ConstructionAra.gf
Normal file
147
src/arabic/ConstructionAra.gf
Normal 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" ;
|
||||
|
||||
}
|
||||
@@ -4,16 +4,36 @@ 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
|
||||
]
|
||||
with (Grammar=GrammarAra)
|
||||
** open
|
||||
|
||||
Prelude,
|
||||
ResAra
|
||||
ResAra,
|
||||
ParamX
|
||||
|
||||
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} ;
|
||||
|
||||
-- : 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
|
||||
}
|
||||
}) ;
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ oper ReflA2 : A2 -> AP = notYet "ReflA2" ;
|
||||
oper ReflVP : VPSlash -> VP = notYet "ReflVP" ;
|
||||
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" ;
|
||||
|
||||
@@ -13,8 +13,8 @@ lin
|
||||
cn.s ! number
|
||||
! nounState det.d number
|
||||
! nounCase c det.n det.d ;
|
||||
adj : Case -> Str = \c ->
|
||||
cn.adj ! number
|
||||
adj : NTable -> Case -> Str = \ntable,c ->
|
||||
ntable ! number
|
||||
! (definite ! det.d) -- Indef remains Indef, rest become Def
|
||||
! c
|
||||
} in {
|
||||
@@ -22,30 +22,34 @@ lin
|
||||
case cnB4det det.isPron det.isNum det.n det.d of {
|
||||
False => determiner c
|
||||
++ noun c
|
||||
++ adj c
|
||||
++ adj cn.s2 c
|
||||
++ adj cn.adj c
|
||||
++ cn.np ! c ;
|
||||
True => noun (cas c) -- deal with possessive suffix
|
||||
++ determiner c
|
||||
++ adj c
|
||||
++ determiner c
|
||||
++ adj cn.s2 c
|
||||
++ adj cn.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 = {
|
||||
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}
|
||||
} ;
|
||||
|
||||
{-
|
||||
@@ -167,26 +171,23 @@ lin
|
||||
|
||||
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}} ;
|
||||
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.s ++ np.s ! n2.c2.c} ;
|
||||
|
||||
ComplN2 n2 np = UseN n2 ** {np=np.s} ;
|
||||
|
||||
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
|
||||
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};
|
||||
|
||||
@@ -34,10 +34,16 @@ oper
|
||||
l@(""|"ال") + ("أ"|"أَ") + #hamza + tail => l + "آ" + tail;
|
||||
l@(""|"ال") + #hamza + v@("َ"|"ُ") + tail => l + "أ" + v + tail;
|
||||
l@(""|"ال") + #hamza + v@("ِ") + tail => l + "إ" + v + tail;
|
||||
head + v1@("ِ"|"ُ"|"َ"|"ْ"|"ا"|"ي"|"و")
|
||||
head + v1@(#vow|"ْ"|"ا"|"ي"|"و")
|
||||
+ #hamza + v2@(#vow|"ْ") + tail =>
|
||||
case v2 of { "ْ" => head + v1 + tHmz v1 + tail ; -- unsure about this /IL
|
||||
_ => head + v1 + tHmz v1 + v2 + 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 ;
|
||||
|
||||
head + #hamza + tail => head + (bHmz (dp 2 head) (take 2 tail)) + tail; --last head , take 1 tail
|
||||
_ => word
|
||||
|
||||
@@ -70,7 +70,8 @@ resource ParadigmsAra = open
|
||||
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 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
|
||||
--- = sdfN ;
|
||||
} ;
|
||||
@@ -97,6 +98,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 ! Bare}) ; -- no idea /IL
|
||||
mkPN : Str -> Gender -> Species -> PN
|
||||
= mkFullPN ;
|
||||
} ;
|
||||
@@ -343,7 +346,12 @@ resource ParadigmsAra = open
|
||||
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)
|
||||
= \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 {
|
||||
@@ -374,15 +382,15 @@ resource ParadigmsAra = open
|
||||
|
||||
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 ->
|
||||
@@ -464,6 +472,7 @@ resource ParadigmsAra = open
|
||||
|
||||
mkFullN nsc gen spec =
|
||||
{ s = nsc; --NTable
|
||||
s2 = emptyNTable;
|
||||
g = gen;
|
||||
h = spec;
|
||||
lock_N = <>
|
||||
@@ -476,14 +485,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 =
|
||||
@@ -525,29 +532,31 @@ resource ParadigmsAra = open
|
||||
lin N3 (n ** {c2 = mkPreposition p ; c3 = mkPreposition q}) ;
|
||||
} ;
|
||||
|
||||
mkPron : (_,_,_ : Str) -> PerGenNum -> NP = \ana,nI,I,pgn ->
|
||||
{ s =
|
||||
mkPron : (_,_,_ : Str) -> PerGenNum -> Pron = \ana,nI,I,pgn ->
|
||||
lin Pron { s =
|
||||
table {
|
||||
Acc => BIND ++ nI; -- object suffix
|
||||
Gen => BIND ++ I; -- possessive suffix
|
||||
_ => ana
|
||||
};
|
||||
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
|
||||
regNP : Str -> Number -> NP = \word,n ->
|
||||
regNP : Str -> Number -> NP = \word,n -> lin NP
|
||||
{ s = \\c => fixShd word (dec1sg ! Def ! c) ;
|
||||
a = {pgn = Per3 Masc n; isPron = False };
|
||||
lock_NP = <>
|
||||
empty = []
|
||||
};
|
||||
|
||||
-- e.g. hadha, dhaalika
|
||||
indeclNP : Str -> Number -> NP = \word,n ->
|
||||
indeclNP : Str -> Number -> NP = \word,n -> lin NP
|
||||
{ s = \\c => word ;
|
||||
a = {pgn = Per3 Masc n; isPron = False };
|
||||
lock_NP = <>
|
||||
empty = []
|
||||
};
|
||||
|
||||
mkQuant7 : (_,_,_,_,_,_,_ : Str) -> State -> Quant =
|
||||
|
||||
@@ -11,7 +11,7 @@ concrete PhraseAra of Phrase = CatAra ** open
|
||||
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} ;
|
||||
|
||||
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
|
||||
UttCard c = {s = ResAra.uttNum c} ; --IL
|
||||
|
||||
|
||||
@@ -29,44 +29,47 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA
|
||||
-- : IComp -> NP -> QCl
|
||||
QuestIComp ic np =
|
||||
let vp = kaan (CompNP np) ;
|
||||
ip : ResAra.IP = np ** {
|
||||
s = \\_,_,_ => ic.s ! pgn2gn np.a.pgn } ;
|
||||
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 ;
|
||||
|
||||
-- : IP -> IComp ;
|
||||
CompIP ip = ip ** {
|
||||
s = \\_ => ip.s ! True -- True=IP will be a subject of predicative sentence
|
||||
! Def ! Nom ; -- IP will be a subject
|
||||
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
|
||||
} ;
|
||||
|
||||
CompIAdv iadv = { s = \\_ => iadv.s ; a = ResAra.Sg } ;
|
||||
|
||||
-- QCl = {s : Tense => Polarity => QForm => Str} ;
|
||||
QuestSlash ip cl = { ----IL just guessing
|
||||
QuestSlash ip cls = { ----IL just guessing
|
||||
s = \\t,p,qf =>
|
||||
let o = case qf of { QDir => Nominal ; _ => Verbal } ; -- purely guessing
|
||||
in cl.c2.s ++ ip.s ! False ! Def ! Nom ++ cl.s ! t ! p ! o
|
||||
let cl : ResAra.Cl = complClSlash cls ; -- dummy conversion to Cl
|
||||
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
|
||||
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 = \\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
|
||||
IdetIP idet = idet ** {
|
||||
s = \\isPred => idet.s ! Masc ;
|
||||
s = \\isPred => idet.s ;
|
||||
a = { pgn = agrP3 NoHum Masc idet.n ; isPron = False }
|
||||
} ;
|
||||
|
||||
-- : IDet -> CN -> IP
|
||||
IdetCN idet cn = {
|
||||
s = \\isPred,s,c
|
||||
s = \\isPred,g,s,c
|
||||
=> idet.s ! cn.g ! s ! c ++
|
||||
cn.s ! idet.n ! Indef ! Gen ; --idaafa
|
||||
a = { pgn = agrP3 NoHum cn.g idet.n ; isPron = False }
|
||||
|
||||
@@ -13,19 +13,20 @@ concrete RelativeAra of Relative = CatAra **
|
||||
s = \\t,p,agr,c =>
|
||||
let
|
||||
npS : Case => Str = \\_ => rp.s ! agr2ragr agr c ;
|
||||
np = {s = npS ; a = agr} ;
|
||||
np = emptyNP ** {s = npS ; a = agr} ;
|
||||
cl = Se.PredVP np vp ;
|
||||
in
|
||||
cl.s ! t ! p ! Nominal
|
||||
} ;
|
||||
|
||||
-- : RP -> ClSlash -> RCl ; -- whom John loves
|
||||
RelSlash rp cl = cl ** {
|
||||
RelSlash rp cls = cls ** {
|
||||
s = \\t,p,agr,c =>
|
||||
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 } ;
|
||||
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 = {
|
||||
|
||||
@@ -26,7 +26,8 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in {
|
||||
-- case vowel retained
|
||||
Mood = Ind | Cnj | Jus ;
|
||||
Voice = Act | Pas ;
|
||||
Order = Verbal | Nominal ;
|
||||
Order = Verbal | Nominal
|
||||
| VOS ; -- Relative clauses with resumptive pronouns
|
||||
|
||||
oper
|
||||
|
||||
@@ -105,9 +106,10 @@ 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 : NTable ; g : Gender; h : Species} ;
|
||||
Noun : Type = {s,s2 : NTable ; g : Gender; h : Species} ;
|
||||
Noun2 : Type = Noun ** {c2 : 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
|
||||
|
||||
CN : Type = Noun ** {adj : NTable ; np : Case => Str};
|
||||
|
||||
useN : Noun -> CN = \n -> n ** {adj = \\_,_,_ => []; np = \\_ => []} ;
|
||||
|
||||
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 = {
|
||||
s : Gender => State => Case => Str ;
|
||||
@@ -552,6 +559,12 @@ 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 : 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 =
|
||||
table {
|
||||
u => fcu ;
|
||||
@@ -641,7 +654,6 @@ v4doubleweak : Root3 -> Verb = \r'y ->
|
||||
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 ->
|
||||
let {
|
||||
@@ -1129,12 +1141,12 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
||||
|
||||
mkIP = overload {
|
||||
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 }
|
||||
} ;
|
||||
mkIP : (_,_ : Str) -> Number -> IP = \maa,maadhaa,n -> {
|
||||
s = table { True => \\_s,_c => maa ;
|
||||
False => \\_s,_c => maadhaa } ;
|
||||
s = table { True => \\_g,_s,_c => maa ;
|
||||
False => \\_g,_s,_c => maadhaa } ;
|
||||
a = { pgn = agrP3 NoHum Masc n ; isPron = False }
|
||||
}
|
||||
} ;
|
||||
@@ -1181,6 +1193,8 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
||||
Agr = { pgn : PerGenNum; isPron : Bool} ;
|
||||
AAgr = { g : Gender ; n : Number} ;
|
||||
|
||||
|
||||
|
||||
Comp : Type = {
|
||||
s : AAgr => Case => Str
|
||||
} ;
|
||||
@@ -1198,18 +1212,32 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
||||
|
||||
NP : Type = {
|
||||
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 = {
|
||||
s : Bool -- different forms for "what is this" and "what do you do"
|
||||
=> State => Case -- because of PrepIP: e.g. "in which" chooses definite accusative
|
||||
=> Gender -- because an IP can be made into an IComp
|
||||
=> State => Case -- because of PrepIP: e.g. "in which" chooses definite accusative
|
||||
=> 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 = {
|
||||
s : Gender -- IdetCN needs to choose the gender of the CN
|
||||
=> State => Case => Str ;
|
||||
@@ -1220,7 +1248,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
||||
s : State => Case => Str
|
||||
} ;
|
||||
|
||||
param VPForm =
|
||||
param VPForm =
|
||||
VPPerf
|
||||
| VPImpf Mood
|
||||
| VPImp ;
|
||||
@@ -1228,7 +1256,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
||||
oper
|
||||
|
||||
VP : Type = {
|
||||
s : PerGenNum => VPForm => Str;
|
||||
s : PerGenNum => VPForm => Str ;
|
||||
obj : Obj;
|
||||
pred : Comp;
|
||||
isPred : Bool; --indicates if there is a predicate (xabar)
|
||||
@@ -1263,8 +1291,63 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
||||
isPred = False
|
||||
};
|
||||
|
||||
predVSlash : Verb2 -> 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
|
||||
};
|
||||
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 Gender but not in number
|
||||
@@ -1286,17 +1369,36 @@ 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);
|
||||
|
||||
copula : Verb = v1hollow {f = "ك"; c = "و" ; l = "ن"} u ;
|
||||
-- Slash categories
|
||||
|
||||
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} ;
|
||||
QCl : Type = {s : Tense => Polarity => QForm => Str} ;
|
||||
|
||||
-- Relative
|
||||
param
|
||||
-- Relative
|
||||
param
|
||||
RAgr = RSg Gender | RPl Gender | RDl Gender Case ;
|
||||
|
||||
oper
|
||||
@@ -1304,9 +1406,8 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
||||
agr2ragr : Agr -> Case -> RAgr = \a,c ->
|
||||
let gn = pgn2gn a.pgn in case <gn.n,gn.g,a> of {
|
||||
<Sg,x> => RSg x ;
|
||||
<Pl,x> => RPl x ;
|
||||
<Dl,x> => RDl x c ;
|
||||
_ => Predef.error "agr2ragr"} ;
|
||||
<Pl,x> => RPl x } ;
|
||||
agr2ragr : Number -> Case -> Gender -> RAgr = \n,c,g ->
|
||||
case n of {
|
||||
Sg => RSg g ;
|
||||
|
||||
@@ -26,58 +26,7 @@ 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 : 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)
|
||||
}
|
||||
};
|
||||
PredVP = predVP ;
|
||||
|
||||
-- PredSCVP sc vp = mkClause sc.s (agrP3 Sg) vp ;
|
||||
|
||||
@@ -100,9 +49,13 @@ 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} ;
|
||||
|
||||
-- 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
|
||||
|
||||
@@ -111,25 +64,26 @@ concrete SentenceAra of Sentence = CatAra ** open
|
||||
-- EmbedQS qs = {s = qs.s ! QIndir} ;
|
||||
-- EmbedVP vp = {s = infVP False vp (agrP3 Sg)} ; --- agr
|
||||
--
|
||||
UseSlash,
|
||||
UseCl = \t,p,cl ->
|
||||
{s = t.s ++ p.s ++
|
||||
|
||||
UseCl t p cl =
|
||||
{s = t.s ++ p.s ++
|
||||
case <t.t,t.a> of { --- IL guessed tenses
|
||||
<(Pres|Cond),Simul> => cl.s ! Pres ! p.p ! Nominal ;
|
||||
<Fut ,_ > => cl.s ! Fut ! p.p ! Nominal ;
|
||||
<_ ,_ > => cl.s ! Past ! p.p ! Nominal
|
||||
<Pres,Simul> => cl.s ! Pres ! p.p ! Nominal ;
|
||||
<Pres,Anter> => cl.s ! Past ! p.p ! Nominal ;
|
||||
<x ,_ > => cl.s ! x ! p.p ! Nominal
|
||||
}
|
||||
};
|
||||
|
||||
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
|
||||
<(Pres|Cond),Simul> => qcl.s ! Pres ! p.p ! q ;
|
||||
<Fut ,_ > => qcl.s ! Fut ! p.p ! q ;
|
||||
<_ ,_ > => qcl.s ! Past ! p.p ! q
|
||||
<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 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) ;
|
||||
}
|
||||
|
||||
@@ -17,10 +17,12 @@ lin
|
||||
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.
|
||||
a = dummyAgrP3 n ;
|
||||
empty = []
|
||||
} ;
|
||||
CNNumNP cn i = {
|
||||
s = \\c => cn.s ! Sg ! Def ! c ++ uttNum i ! Masc ;
|
||||
a = dummyAgrP3 Sg ;
|
||||
empty = []
|
||||
} ;
|
||||
|
||||
SymbS sy = sy ;
|
||||
|
||||
@@ -11,8 +11,8 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra in {
|
||||
--SlashV2V : V2V -> VP -> VPSlash ; -- beg (her) to go
|
||||
--SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy
|
||||
|
||||
SlashV2a v = predVSlash v ;
|
||||
Slash3V3 v np = insertObj np (predVSlash v) ** {c2 = v.c3};
|
||||
SlashV2a = slashV2 ;
|
||||
Slash3V3 v np = insertObj np (slashV2 v) ** {c2 = v.c3};
|
||||
|
||||
ComplSlash vp np = insertObj np vp ;
|
||||
|
||||
@@ -26,7 +26,8 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra in {
|
||||
vp ** {
|
||||
s = \\pgn,vpf => vvVP.s ! pgn ! vpf
|
||||
++ vv.c2.s -- أَنْ
|
||||
++ vp.s ! pgn ! VPImpf Cnj
|
||||
++ vp.s ! pgn ! VPImpf Cnj ;
|
||||
isPred = False
|
||||
} ;
|
||||
|
||||
-- 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 ;
|
||||
|
||||
UseCopula = predV copula ;
|
||||
|
||||
AdvVP vp adv = insertStr adv.s vp ;
|
||||
|
||||
-- AdVVP adv vp = insertAdV adv.s vp ;
|
||||
--
|
||||
-- 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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user