From 42c4b9712db5efd34b122cffd32d96dd9d18baf5 Mon Sep 17 00:00:00 2001 From: aarne Date: Mon, 5 May 2008 16:45:28 +0000 Subject: [PATCH] new refs in bib ; some Hindi parameter experiments --- doc/gf-bib.bib | 155 +++++-- lib/resource-1.4/hindi/CatHin.gf | 2 +- lib/resource-1.4/hindi/ParadigmsHin.gf | 55 ++- lib/resource-1.4/hindi/ResHin.gf | 571 +++++-------------------- 4 files changed, 252 insertions(+), 531 deletions(-) diff --git a/doc/gf-bib.bib b/doc/gf-bib.bib index 3c63eff4e..6fa80f4a7 100644 --- a/doc/gf-bib.bib +++ b/doc/gf-bib.bib @@ -18,7 +18,42 @@ @STRING{sc = "Soft Computing---A Fusion of Foundations, Methodologies and Applications"} +@article{goldsmith, + author = {John Goldsmith}, + title = {{An Algorithm for the Unsupervised Learning of Morphology}}, + journal = {{Nat. Lang. Eng.}}, + volume = {12}, + number = {4}, + year = {2006}, + issn = {1351-3249}, + pages = {353--371}, + doi = {http://dx.doi.org/10.1017/S1351324905004055}, + publisher = {Cambridge University Press}, + address = {New York, NY, USA}, + } +@article{creutz, + author = {Mathias Creutz and Krista Lagus}, + title = {{Unsupervised Models for Morpheme Segmentation and Morphology Learning}}, + journal = {{ACM Trans. Speech Lang. Process.}}, + volume = {4}, + number = {1}, + year = {2007}, + issn = {1550-4875}, + pages = {3}, + doi = {http://doi.acm.org/10.1145/1187415.1187418}, + publisher = {ACM}, + address = {New York, NY, USA}, + } + +@article{swadesh, + author = {Morris Swadesh}, + title = {{Towards Greater Accuracy in Lexicostatistic Dating}}, + journal = {{International Journal of American Linguistics}}, + volume = {21}, + year = {1955}, + pages = {121--137} + } @INPROCEEDINGS{isar, AUTHOR = {M. Wenzel}, @@ -63,7 +98,7 @@ } @misc{talk-deliv, - author = {P. Ljunglöf and G. Amores and R. Cooper and D. Hjelm and O. Lemon and P. Manchón + author = {P. Ljungl\"of and G. Amores and R. Cooper and D. Hjelm and O. Lemon and P. Manchón and G. Pérez and A. Ranta}, year = 2006, title = {{Multimodal Grammar Library}}, @@ -154,6 +189,13 @@ year = {2006} } +@inproceedings{bos-steedman, + title = {{Wide-Coverage Semantic Representations from a CCG Parser}}, + author = {J. Bos and S. Clark and M. Steedman and J. Curran and J. Hockenmaier}, + booktitle = {{Coling 2004}}, + year = {2004} +} + @inproceedings{FM, title = {{Functional Morphology}}, author = {M. Forsberg and A. Ranta}, @@ -162,6 +204,14 @@ year = {2004} } +@inproceedings{ranta-features, + title = {{Features in Abstract and Concrete Syntax}}, + author = {A. Ranta}, + booktitle = {{NODALIDA Workshop on Typed Feature Structure Grammars, Tartu, 24 May 2007}}, + year = {2007} +} + + @inproceedings{eldada, title = {{Implementing an Open Source Arabic Resource Grammar in GF}}, author = {A. El Dada and A. Ranta}, @@ -170,6 +220,17 @@ } +@incollection{eldada-book, + title = {{Implementing an Open Source Arabic Resource Grammar in GF}}, + author = {A. El Dada and A. Ranta}, + booktitle = {{Perspectives on Arabic Linguistics XX}}, + editor = {M.A. Mughazy}, + publisher = {{John Benjamin's}}, + pages = {209--232}, + year = {2007} + +} + @inproceedings{nganga-africa, title = {{Multilingual content development for eLearning in Africa}}, author = {W. Ng'ang'a}, @@ -204,6 +265,15 @@ year = {2006} } +@inproceedings{ranta-kahn, + title = {{Grammars as Software Libraries}}, + author = {A. Ranta}, + booktitle = {{From Semantics to Computer Science}}, + editor = {Y. Bertot and G. Huet and J-J. L\'evy and G. Plotkin}, + publisher = {{Cambridge University Press}}, + year = {2008} +} + @ARTICLE{landin, @@ -250,7 +320,8 @@ AUTHOR = "A. Ranta", TITLE = {{Modular Grammar Engineering in GF}}, JOURNAL = {{Research on Language and Computation}}, - note = {To appear}, + volume = {5}, + pages = {133--158}, YEAR = {2007} } @@ -350,11 +421,18 @@ @Book{ttg, author = {A. Ranta}, - title = {Type Theoretical Grammar}, - publisher = {Oxford University Press}, + title = {{Type Theoretical Grammar}}, + publisher = {{Oxford University Press}}, year = {1994} } +@Book{lyons, + author = {J. Lyons}, + title = {{Introduction to Theoretical Linguistics}}, + publisher = {{Cambridge University Press}}, + year = {1968} +} + @Book{b-b, author = {P. Blackburn and J. Bos}, title = {Representation and Inference for Natural Language}, @@ -991,14 +1069,6 @@ } -@book{martin-lof, - AUTHOR = {P. Martin-L\"{o}f}, - TITLE = {{Intuitionistic Type Theory}}, - ADDRESS = {Napoli}, - YEAR = {1984}, - PUBLISHER = {Bibliopolis} -} - @InProceedings{dymetman, author = {M.\ Dymetman and V.\ Lux and A.\ Ranta}, title = {{XML} and Multilingual Document Authoring: Convergent Trends}, @@ -1068,7 +1138,7 @@ @ARTICLE{gf-jfp, AUTHOR = "A. Ranta", - TITLE = {{Grammatical Framework: A Type-theoretical Grammar Formalism}}, + TITLE = {{Grammatical Framework: A Type-Theoretical Grammar Formalism}}, JOURNAL = {{The Journal of Functional Programming}}, pages={145--189}, volume={14(2)}, @@ -1083,7 +1153,7 @@ YEAR = {2005} } @InProceedings{extract-2006, - AUTHOR = "M. Forsberg and H. Hammarstroem and A. Ranta", + AUTHOR = {M. Forsberg and H. Hammarstr\"{o}m and A. Ranta}, TITLE = {{Morphological Lexicon Extraction from Raw Text Data}}, booktitle = {{FinTAL 2006}}, year = {{2006}}, @@ -1092,6 +1162,15 @@ editor = {T. Salakoski} } +@InProceedings{numerals, + AUTHOR = {H. Hammarstr\"{o}m and A. Ranta}, + TITLE = {{Cardinal Numerals Revisited in GF}}, + booktitle = {{Workshop on Numerals in the World's Languages, + Dept. of Linguistics, Max Planck Institute for Evolutionary Anthropology, + Leipzig}}, + year = {{2004}} + } + @misc{minnen95offline, author = "G. Minnen and D. Gerdemann and T. Gotz", title = "Off-line optimization for Earleystyle hpsg processing", @@ -1193,7 +1272,7 @@ @InProceedings{brodda-karlsson, author = {B. Brodda and F. Karlsson}, - title = {{An experiment with Automatic morphological Analysis of Finnish}}, + title = {{An Experiment with Automatic Morphological Analysis of Finnish}}, series = {{Papers from the Institute of Linguistics, University of Stockholm}}, volume = 40, year = 1978 @@ -1303,6 +1382,23 @@ note = {Trindi deliverable D1.3, Gothenburg University} } +@misc{cooper-anna, + author = {R. Cooper}, + year = 2008, + title = "The Abstract-Concrete Syncat Distinction and Unification in Multilingual Grammar", + note = {to appear} + } + +@misc{fracas, + author = {H. Kamp and R. Crouch and J. van Genabith and R. Cooper and M. Poesio + and J. van Eijck and J. Jaspars and M. Pinkal and E. Vestre and S. Pulman}, + year = 1994, + title = "Specification of Linguistic Coverage", + note = {{FRACAS Deliverable D2}} + } + + + @Article{teitelbaum, author = "T. Teitelbaum and T. Reps", title = {The {Cornell} {Program} {Synthesizer}: a syntax-directed @@ -2006,6 +2102,14 @@ PAGES = {828--832} } +@BOOK{rei48, + AUTHOR = "Reichenbach, Hans", + TITLE = "Elements of Symbolic Logic", + PUBLISHER = {The MacMillan Company}, + ADDRESS = {New York}, + YEAR = {1948} } + + @InProceedings{BaarHaehnle00a, author = {Thomas Baar and Reiner H\"ahnle}, title = {An Integrated Metamodel for {OCL} Types}, @@ -2279,15 +2383,6 @@ Book{GoldbergRubin95, pages = "854--874", publisher = spv } -@INCOLLECTION{steedman, - AUTHOR = "M. Steedman", - TITLE = "Combinators and grammars", - EDITOR = "R. Oehrle and E. Bach and D. Wheeler", - BOOKTITLE = {{Categorial Grammars and Natural Language Structures}}, - PUBLISHER = {D. Reidel}, - ADDRESS = {Dordrecht}, - YEAR = {1988}, - PAGES = {417-442}} @InProceedings{DLR00, author = {M.\ Dymetman and V.\ Lux and A.\ Ranta}, @@ -2307,7 +2402,7 @@ Book{GoldbergRubin95, } -@inproceedings{ mccarthy62towards, +@inproceedings{mccarthy62towards, author = "J.\ McCarthy", title = "Towards a mathematical science of computation", booktitle = "Proceedings of the Information Processing Cong. 62", @@ -2612,13 +2707,3 @@ Book{GoldbergRubin95, } -@inproceedings{bringert-speechgram, - AUTHOR = {B. Bringert}, - TITLE = {{Speech Recognition Grammar Compilation in Grammatical Framework}}, - BOOKTITLE = - {{SPEECHGRAM 2007: ACL Workshop on Grammar-Based Approaches to Spoken Language Processing, - 29 June 2007, Prague}}, - YEAR = {2007} -} - - diff --git a/lib/resource-1.4/hindi/CatHin.gf b/lib/resource-1.4/hindi/CatHin.gf index b0059b916..ad50d242c 100644 --- a/lib/resource-1.4/hindi/CatHin.gf +++ b/lib/resource-1.4/hindi/CatHin.gf @@ -72,7 +72,7 @@ concrete CatHin of Cat = CommonX ** open ResHin, Prelude in { -- ---- Open lexical classes, e.g. Lexicon -- --- V, VS, VQ, VA = Verb ; -- = {s : VForm => Str} ; + V, VS, VQ, VA = Verb ; -- = {s : VForm => Str} ; -- V2, V2A, V2Q, V2S = Verb ** {c2 : Str} ; -- V3 = Verb ** {c2, c3 : Str} ; -- VV = {s : VVForm => Str ; isAux : Bool} ; diff --git a/lib/resource-1.4/hindi/ParadigmsHin.gf b/lib/resource-1.4/hindi/ParadigmsHin.gf index 0ba22a893..12596ed42 100644 --- a/lib/resource-1.4/hindi/ParadigmsHin.gf +++ b/lib/resource-1.4/hindi/ParadigmsHin.gf @@ -1,61 +1,54 @@ --# -path=.:../abstract:../../prelude:../common -- ----1 Hindi Lexical Paradigms ----- ----- Aarne Ranta 2003--2005 ----- ----- This is an API for the user of the resource grammar ----- for adding lexical items. It gives functions for forming ----- expressions of open categories: nouns, adjectives, verbs. ----- ----- Closed categories (determiners, pronouns, conjunctions) are ----- accessed through the resource syntax API, $Structural.gf$. ----- ----- The main difference with $MorphoHin.gf$ is that the types ----- referred to are compiled resource grammar types. We have moreover ----- had the design principle of always having existing forms, rather ----- than stems, as string arguments of the paradigms. ----- ----- The structure of functions for each word class $C$ is the following: ----- first we give a handful of patterns that aim to cover all ----- regular cases. Then we give a worst-case function $mkC$, which serves as an ----- escape to construct the most irregular words of type $C$. ----- However, this function should only seldom be needed: we have a ----- separate module [``IrregHin`` ../../english/IrregHin.gf], ----- which covers irregular verbss. --- + resource ParadigmsHin = open (Predef=Predef), Prelude, MorphoHin, CatHin in { + --2 Parameters --- --- To abstract over gender names, we define the following identifiers. oper ----- Gender : Type ; - masculine : Gender ; feminine : Gender ; masculine = Masc ; feminine = Fem ; --i + --2 Nouns --- --- Nouns are constructed by the function $mkN$, which takes a varying --- number of arguments. mkN = overload { mkN : Str -> N = \s -> regNoun s ** {lock_N = <>} ; mkN : Str -> Gender -> N = \s,g -> reggNoun s g ** {lock_N = <>} ; - mkN : (x1,_,_,_,_,x6 : Str) -> Gender -> Noun + mkN : (x1,_,_,_,_,x6 : Str) -> Gender -> N = \sd,so,sv,pd,po,pv,g -> mkNoun sd so sv pd po pv g ** {lock_N = <>} ; } ; +--2 Adjectives + + mkA = overload { + mkA : Str -> A + = \s -> regAdjective s ** {lock_A = <>} ; + mkA : (x1,_,x3 : Str) -> A + = \msd,m,f -> mkAdjective msd m f ** {lock_A = <>} ; + } ; + +--2 Verbs + + mkV = overload { + mkV : Str -> V + = \s -> regVerb s ** {lock_V = <>} ; + mkV : (x1,_,_,_,_,_,_,_,_,_,_,_,_,x14 : Str) -> V + = \inf,stem,ims,imp,ifs,ifp,pms,pmp,pfs,pfp,ss1,ss2,sp2,sp3 -> + mkVerb inf stem ims imp ifs ifp pms pmp pfs pfp ss1 ss2 sp2 sp3 ** + {lock_V = <>} ; + } ; + ----3 Compound nouns ---- diff --git a/lib/resource-1.4/hindi/ResHin.gf b/lib/resource-1.4/hindi/ResHin.gf index 555bb1789..ff2ba97d4 100644 --- a/lib/resource-1.4/hindi/ResHin.gf +++ b/lib/resource-1.4/hindi/ResHin.gf @@ -21,473 +21,116 @@ resource ResHin = ParamX ** open Prelude in { g = g } ; - reggNoun : Str -> Gender -> Noun = \s,g -> { - s = (regNoun s).s ; - g = g + reggNoun : Str -> Gender -> Noun = \s,g -> case of { + <-(_ + ("a:" | "i:")), Fem> => mkNoun s s s (s + "e~") (s + "o~") (s + "o") Fem ; + _ => regNoun s ** {g = g} } ; regNoun : Str -> Noun = \s -> case s of { - x + "a:" => mkNoun s (x + "e") (x + "e") (x + "e") (x + "o~") (x + "o") Masc ; - x + "i:" => mkNoun s s s (x + "a:~") (x + "o~") (x + "o") Fem ; - _ => mkNoun s s s s (s + "o~") (s + "o") Masc + x + "iya:" => mkNoun s s s (x + "iya:~") (x + "iyo~") (x + "iyo") Fem ; + x + "a:" => mkNoun s (x + "e") (x + "e") (x + "e") (x + "o~") (x + "o") Masc ; + x + "i:" => mkNoun s s s (x + "iya:~") (x + "iyo~") (x + "iyo") Fem ; + _ => mkNoun s s s s (s + "o~") (s + "o") Masc } ; --- param --- Case = Nom | Acc | Gen ; --- ----- Agreement of $NP$ has 8 values. $Gender$ is needed for "who"/"which" and ----- for "himself"/"herself"/"itself". --- --- param --- Agr = AgP1 Number | AgP2 Number | AgP3Sg Gender | AgP3Pl ; --- --- param --- Gender = Neutr | Masc | Fem ; --- -----2 For $Verb$ --- ----- Only these five forms are needed for open-lexicon verbs. --- --- param --- VForm = --- VInf --- | VPres --- | VPPart --- | VPresPart --- | VPast --# notpresent --- ; --- ----- Auxiliary verbs have special negative forms. --- --- VVForm = --- VVF VForm --- | VVPresNeg --- | VVPastNeg --# notpresent --- ; --- ----- The order of sentence is needed already in $VP$. --- --- Order = ODir | OQuest ; --- --- -----2 For $Adjective$ --- --- AForm = AAdj Degree | AAdv ; --- -----2 For $Relative$ --- --- RAgr = RNoAg | RAg Agr ; --- RCase = RPrep Gender | RC Gender Case ; --- -----2 For $Numeral$ --- --- CardOrd = NCard | NOrd ; --- DForm = unit | teen | ten ; --- -----2 Transformations between parameter types --- --- oper --- toAgr : Number -> Person -> Gender -> Agr = \n,p,g -> --- case p of { --- P1 => AgP1 n ; --- P2 => AgP2 n ; --- P3 => case n of { --- Sg => AgP3Sg g ; --- Pl => AgP3Pl --- } --- } ; --- --- fromAgr : Agr -> {n : Number ; p : Person ; g : Gender} = \a -> case a of { --- AgP1 n => {n = n ; p = P1 ; g = Masc} ; --- AgP2 n => {n = n ; p = P2 ; g = Masc} ; --- AgP3Pl => {n = Pl ; p = P3 ; g = Masc} ; --- AgP3Sg g => {n = Sg ; p = P3 ; g = g} --- } ; --- --- agrP3 : Number -> Agr = \n -> agrgP3 n Neutr ; --- --- agrgP3 : Number -> Gender -> Agr = \n,g -> toAgr n P3 g ; --- --- conjAgr : Agr -> Agr -> Agr = \a0,b0 -> --- let a = fromAgr a0 ; b = fromAgr b0 --- in --- toAgr --- (conjNumber a.n b.n) --- (conjPerson a.p b.p) a.g ; --- ----- For $Lex$. --- ----- For each lexical category, here are the worst-case constructors. --- --- mkNoun : (_,_,_,_ : Str) -> {s : Number => Case => Str} = --- \man,mans,men,mens -> { --- s = table { --- Sg => table { --- Gen => mans ; --- _ => man --- } ; --- Pl => table { --- Gen => mens ; --- _ => men --- } --- } --- } ; --- --- mkAdjective : (_,_,_,_ : Str) -> {s : AForm => Str} = --- \good,better,best,well -> { --- s = table { --- AAdj Posit => good ; --- AAdj Compar => better ; --- AAdj Superl => best ; --- AAdv => well --- } --- } ; --- --- mkVerb : (_,_,_,_,_ : Str) -> Verb = --- \go,goes,went,gone,going -> { --- s = table { --- VInf => go ; --- VPres => goes ; --- VPast => went ; --# notpresent --- VPPart => gone ; --- VPresPart => going --- } ; --- isRefl = False --- } ; --- --- mkIP : (i,me,my : Str) -> Number -> {s : Case => Str ; n : Number} = --- \i,me,my,n -> let who = mkNP i me my n P3 Neutr in { --- s = who.s ; --- n = n --- } ; --- --- mkNP : (i,me,my : Str) -> Number -> Person -> Gender -> --- {s : Case => Str ; a : Agr} = --- \i,me,my,n,p,g -> { --- s = table { --- Nom => i ; --- Acc => me ; --- Gen => my --- } ; --- a = toAgr n p g ; --- } ; --- ----- These functions cover many cases; full coverage inflectional patterns are ----- in $MorphoHin$. --- --- regN : Str -> {s : Number => Case => Str} = \car -> --- mkNoun car (car + "'s") (car + "s") (car + "s'") ; --- --- regA : Str -> {s : AForm => Str} = \warm -> --- mkAdjective warm (warm + "er") (warm + "est") (warm + "ly") ; --- --- regV : Str -> Verb = \walk -> --- mkVerb walk (walk + "s") (walk + "ed") (walk + "ed") (walk + "ing") ; --- --- regNP : Str -> Number -> {s : Case => Str ; a : Agr} = \that,n -> --- mkNP that that (that + "'s") n P3 Neutr ; --- ----- We have just a heuristic definition of the indefinite article. ----- There are lots of exceptions: consonantic "e" ("euphemism"), consonantic ----- "o" ("one-sided"), vocalic "u" ("umbrella"). --- --- artIndef = pre { --- "a" ; --- "an" / strs {"a" ; "e" ; "i" ; "o" ; "A" ; "E" ; "I" ; "O" } --- } ; --- --- artDef = "the" ; --- ----- For $Verb$. --- --- Verb : Type = { --- s : VForm => Str ; --- isRefl : Bool --- } ; --- --- param --- CPolarity = --- CPos --- | CNeg Bool ; -- contracted or not --- --- oper --- contrNeg : Bool -> Polarity -> CPolarity = \b,p -> case p of { --- Pos => CPos ; --- Neg => CNeg b --- } ; --- --- VerbForms : Type = --- Tense => Anteriority => CPolarity => Order => Agr => --- {aux, adv, fin, inf : Str} ; -- would, not, sleeps, slept --- --- VP : Type = { --- s : VerbForms ; --- prp : Str ; -- present participle --- inf : Str ; -- the infinitive form ; VerbForms would be the logical place --- ad : Str ; -- sentence adverb --- s2 : Agr => Str -- complement --- } ; --- --- --- SlashVP = VP ** {c2 : Str} ; --- --- predVc : (Verb ** {c2 : Str}) -> SlashVP = \verb -> --- predV verb ** {c2 = verb.c2} ; --- --- predV : Verb -> VP = \verb -> { --- s = \\t,ant,b,ord,agr => --- let --- inf = verb.s ! VInf ; --- fin = presVerb verb agr ; --- part = verb.s ! VPPart ; --- in --- case of { --- => vff fin [] ; --- => vf (does agr) inf ; --- => vf (have agr) part ; --# notpresent --- => vfn c (have agr) (havent agr) part ; --# notpresent --- => vff (verb.s ! VPast) [] ; --# notpresent --- => vf "did" inf ; --# notpresent --- => vfn c "did" "didn't" inf ; --# notpresent --- => vf "had" part ; --# notpresent --- => vfn c "had" "hadn't" part ; --# notpresent --- => vf "will" inf ; --# notpresent --- => vfn c "will" "won't" inf ; --# notpresent --- => vf "will" ("have" ++ part) ; --# notpresent --- => vfn c "will" "won't"("have" ++ part) ; --# notpresent --- => vf "would" inf ; --# notpresent --- => vfn c "would" "wouldn't" inf ; --# notpresent --- => vf "would" ("have" ++ part) ; --# notpresent --- => vfn c "would" "wouldn't" ("have" ++ part) ; --# notpresent --- => vfn c (does agr) (doesnt agr) inf --- } ; --- prp = verb.s ! VPresPart ; --- inf = verb.s ! VInf ; --- ad = [] ; --- s2 = \\a => if_then_Str verb.isRefl (reflPron ! a) [] --- } ; --- --- predAux : Aux -> VP = \verb -> { --- s = \\t,ant,cb,ord,agr => --- let --- b = case cb of { --- CPos => Pos ; --- _ => Neg --- } ; --- inf = verb.inf ; --- fin = verb.pres ! b ! agr ; --- finp = verb.pres ! Pos ! agr ; --- part = verb.ppart ; --- in --- case of { --- => vf (have agr) part ; --# notpresent --- => vfn c (have agr) (havent agr) part ; --# notpresent --- => vf (verb.past ! b ! agr) [] ; --# notpresent --- => vfn c (verb.past!Pos!agr)(verb.past!Neg!agr) [] ; --# notpresent --- => vf "had" part ; --# notpresent --- => vfn c "had" "hadn't" part ; --# notpresent --- => vf "will" inf ; --# notpresent --- => vfn c "will" "won't" inf ; --# notpresent --- => vf "will" ("have" ++ part) ; --# notpresent --- => vfn c "will" "won't"("have" ++ part) ; --# notpresent --- => vf "would" inf ; --# notpresent --- => vfn c "would" "wouldn't" inf ; --# notpresent --- => vf "would" ("have" ++ part) ; --# notpresent --- => vfn c "would" "wouldn't" ("have" ++ part) ; --# notpresent --- => vf fin [] ; --- => vfn c finp fin [] --- } ; --- prp = verb.prpart ; --- inf = verb.inf ; --- ad = [] ; --- s2 = \\_ => [] --- } ; --- --- vff : Str -> Str -> {aux, adv, fin, inf : Str} = \x,y -> --- {aux = [] ; adv = [] ; fin = x ; inf = y} ; --- --- vf : Str -> Str -> {aux, adv, fin, inf : Str} = \x,y -> vfn True x x y ; --- --- vfn : Bool -> Str -> Str -> Str -> {aux, fin, adv, inf : Str} = --- \contr,x,y,z -> --- case contr of { --- True => {aux = y ; adv = [] ; fin = [] ; inf = z} ; --- False => {aux = x ; adv = "not" ; fin = [] ; inf = z} --- } ; --- --- insertObj : (Agr => Str) -> VP -> VP = \obj,vp -> { --- s = vp.s ; --- prp = vp.prp ; --- inf = vp.inf ; --- ad = vp.ad ; --- s2 = \\a => vp.s2 ! a ++ obj ! a --- } ; --- --- insertObjPre : (Agr => Str) -> VP -> VP = \obj,vp -> { --- s = vp.s ; --- prp = vp.prp ; --- inf = vp.inf ; --- ad = vp.ad ; --- s2 = \\a => obj ! a ++ vp.s2 ! a --- } ; --- --- insertObjc : (Agr => Str) -> SlashVP -> SlashVP = \obj,vp -> --- insertObj obj vp ** {c2 = vp.c2} ; --- ------ The adverb should be before the finite verb. --- --- insertAdV : Str -> VP -> VP = \ad,vp -> { --- s = vp.s ; --- prp = vp.prp ; --- inf = vp.inf ; --- ad = vp.ad ++ ad ; --- s2 = \\a => vp.s2 ! a --- } ; --- ----- --- --- predVV : {s : VVForm => Str ; isAux : Bool} -> VP = \verb -> --- let verbs = verb.s --- in --- case verb.isAux of { --- True => predAux { --- pres = table { --- Pos => \\_ => verbs ! VVF VPres ; --- Neg => \\_ => verbs ! VVPresNeg --- } ; --- past = table { --# notpresent --- Pos => \\_ => verbs ! VVF VPast ; --# notpresent --- Neg => \\_ => verbs ! VVPastNeg --# notpresent --- } ; --# notpresent --- inf = verbs ! VVF VInf ; --- ppart = verbs ! VVF VPPart ; --- prpart = verbs ! VVF VPresPart ; --- } ; --- _ => predV {s = \\vf => verbs ! VVF vf ; isRefl = False} --- } ; --- --- presVerb : {s : VForm => Str} -> Agr -> Str = \verb -> --- agrVerb (verb.s ! VPres) (verb.s ! VInf) ; --- --- infVP : Bool -> VP -> Agr -> Str = \isAux,vp,a -> --- vp.ad ++ --- case isAux of {True => [] ; False => "to"} ++ --- vp.inf ++ vp.s2 ! a ; --- --- agrVerb : Str -> Str -> Agr -> Str = \has,have,agr -> --- case agr of { --- AgP3Sg _ => has ; --- _ => have --- } ; --- --- have = agrVerb "has" "have" ; --- havent = agrVerb "hasn't" "haven't" ; --- does = agrVerb "does" "do" ; --- doesnt = agrVerb "doesn't" "don't" ; --- --- Aux = { --- pres : Polarity => Agr => Str ; --- past : Polarity => Agr => Str ; --# notpresent --- inf,ppart,prpart : Str --- } ; --- --- auxBe : Aux = { --- pres = \\b,a => case of { --- => "am" ; --- => ["am not"] ; --- am not I --- _ => agrVerb (posneg b "is") (posneg b "are") a --- } ; --- past = \\b,a => case a of { --# notpresent --- AgP1 Sg | AgP3Sg _ => posneg b "was" ; --# notpresent --- _ => (posneg b "were") --# notpresent --- } ; --# notpresent --- inf = "be" ; --- ppart = "been" ; --- prpart = "being" --- } ; --- --- posneg : Polarity -> Str -> Str = \p,s -> case p of { --- Pos => s ; --- Neg => s + "n't" --- } ; --- --- conjThat : Str = "that" ; --- --- reflPron : Agr => Str = table { --- AgP1 Sg => "myself" ; --- AgP2 Sg => "yourself" ; --- AgP3Sg Masc => "himself" ; --- AgP3Sg Fem => "herself" ; --- AgP3Sg Neutr => "itself" ; --- AgP1 Pl => "ourselves" ; --- AgP2 Pl => "yourselves" ; --- AgP3Pl => "themselves" --- } ; --- ----- For $Sentence$. --- --- Clause : Type = { --- s : Tense => Anteriority => CPolarity => Order => Str --- } ; --- --- mkClause : Str -> Agr -> VP -> Clause = --- \subj,agr,vp -> { --- s = \\t,a,b,o => --- let --- verb = vp.s ! t ! a ! b ! o ! agr ; --- compl = vp.s2 ! agr --- in --- case o of { --- ODir => subj ++ verb.aux ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf ++ compl ; --- OQuest => verb.aux ++ subj ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf ++ compl --- } --- } ; --- --- ----- For $Numeral$. --- --- mkNum : Str -> Str -> Str -> Str -> {s : DForm => CardOrd => Str} = --- \two, twelve, twenty, second -> --- {s = table { --- unit => table {NCard => two ; NOrd => second} ; --- teen => \\c => mkCard c twelve ; --- ten => \\c => mkCard c twenty --- } --- } ; --- --- regNum : Str -> {s : DForm => CardOrd => Str} = --- \six -> mkNum six (six + "teen") (six + "ty") (regOrd six) ; --- --- regCardOrd : Str -> {s : CardOrd => Str} = \ten -> --- {s = table {NCard => ten ; NOrd => regOrd ten}} ; --- --- mkCard : CardOrd -> Str -> Str = \c,ten -> --- (regCardOrd ten).s ! c ; --- --- regOrd : Str -> Str = \ten -> --- case last ten of { --- "y" => init ten + "ieth" ; --- _ => ten + "th" --- } ; --- --- mkQuestion : --- {s : Str} -> Clause -> --- {s : Tense => Anteriority => CPolarity => QForm => Str} = \wh,cl -> --- { --- s = \\t,a,p => --- let --- cls = cl.s ! t ! a ! p ; --- why = wh.s --- in table { --- QDir => why ++ cls ! OQuest ; --- QIndir => why ++ cls ! ODir --- } --- } ; --- ----- for VP conjunction --- --- param --- VPIForm = VPIInf | VPIPPart ; --- --- + + Adjective = {s : Gender => Number => Case => Str} ; + + mkAdjective : (x1,x2,x3 : Str) -> Adjective = \smd,sm,f -> { + s = \\g,n,c => case of { + => smd ; + => sm ; + _ => f + } + } ; + + regAdjective : Str -> Adjective = \s -> case s of { + acch + "a:" => mkAdjective s (acch + "e") (acch + "i:") ; + _ => mkAdjective s s s + } ; + + param + VForm = + VInf + | VStem + | VImpf Gender Number + | VPerf Gender Number + | VSubj Number Person + | VFut Number Person Gender + ; + + oper + Verb = {s : VForm => Str} ; + + mkVerb : (x1,_,_,_,_,_,_,_,_,_,_,_,_,x14 : Str) -> Verb = + \inf,stem,ims,imp,ifs,ifp,pms,pmp,pfs,pfp,ss1,ss2,sp2,sp3 -> { + s = + let ga : Number -> Gender -> Str = \n,g -> (regAdjective "ga:").s ! g ! n ! Dir + in table { + VInf => inf ; + VStem => stem ; + VImpf Masc Sg => ims ; + VImpf Masc Pl => imp ; + VImpf Fem Sg => ifs ; + VImpf Fem Pl => ifp ; + VPerf Masc Sg => pms ; + VPerf Masc Pl => pmp ; + VPerf Fem Sg => pfs ; + VPerf Fem Pl => pfp ; + VSubj Sg P1 => ss1 ; + VSubj Sg _ => ss2 ; + VSubj Pl P2 => sp2 ; + VSubj Pl _ => sp3 ; + VFut Sg P1 g => ss1 + ga Sg g ; + VFut Sg _ g => ss2 + ga Sg g ; + VFut Pl P2 g => sp2 + ga Pl g ; + VFut Pl _ g => sp3 + ga Pl g + } + } ; + + regVerb : Str -> Verb = \cal -> mkVerb + (cal + "na:") cal + (cal + "ta:") (cal + "te") (cal + "ti:") (cal + "ti:") + (cal + "a:") (cal + "e") (cal + "i:") (cal + "i:~") + (cal + "u:~") (cal + "e") (cal + "o") (cal + "e~") ; + + param + CTense = CPresent | CPast | CFuture ; + oper + copula : CTense -> Number -> Person -> Gender -> Str = \t,n,p,g -> + case of { + => "hu:~" ; + => "hai" ; + => "hai" ; + => "hai:~" ; + => "ho" ; + => "hai:~" ; + => "Ta:" ; + => "Ti:" ; + => "Te" ; + => "Ti:~" ; + => "hu:~ga:" ; + => "hu:~gi:" ; + => "hoga:" ; + => "hogi:" ; + => "hoge" ; + => "hogi:" ; + => "ho~ge" ; + => "ho~gi:" + } ; + + + param + PronCase = PCase Case | PObj | PPoss ; + oper + personalPronoun : Person -> Number -> {s : PronCase => Str} = \p,n -> + case of { + => {s = table PronCase ["mai~" ; "muJ" ; "muJe" ; "mera:"]} ; + => {s = table PronCase ["ham" ; "ham" ; "hame~" ; "hama:ra:"]} ; + => {s = table PronCase ["tu:" ; "tuJ" ; "tuJe" ; "tera:"]} ; + => {s = table PronCase ["tum" ; "tum" ; "tumhe~" ; "tumha:ra:"]} ; + => {s = table PronCase ["vah" ; "us" ; "use~" ; "uska:"]} ; + => {s = table PronCase ["ve" ; "un" ; "unhe~" ; "unka:"]} + } ; + }