1
0
forked from GitHub/gf-rgl

Merge pull request #410 from nemoyjh/master

Added very minimally functional Tamil
This commit is contained in:
Inari Listenmaa
2022-08-14 10:23:08 +02:00
committed by GitHub
33 changed files with 3084 additions and 0 deletions

View File

@@ -45,6 +45,7 @@ Snd,Sindhi,sindhi,,,,,,,,y
Spa,Spanish,spanish,Romance,,y,,,,y,y
Swa,Swahili,swahili,Bantu,,,y,n,n,n,n
Swe,Swedish,swedish,Scand,,y,,,,y,y
Tam,Tamil,tamil,n,n,n,n,n,n,n,n
Tel,Telugu,telugu,,,y,n,n,n,,n
Tha,Thai,thai,,to_thai,,,,,,y
Tur,Turkish,turkish,,,y,,,n,,n
1 Code Name Directory Functor Unlexer Present All Try Symbolic Compatibility Synopsis
45 Spa Spanish spanish Romance y y y
46 Swa Swahili swahili Bantu y n n n n
47 Swe Swedish swedish Scand y y y
48 Tam Tamil tamil n n n n n n n n
49 Tel Telugu telugu y n n n n
50 Tha Thai thai to_thai y
51 Tur Turkish turkish y n n

BIN
src/FileHierarchy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

78
src/README.md Normal file
View File

@@ -0,0 +1,78 @@
# Introduction
## Intended audience of this Readme
This Readme is designed for new developers who wish to either extend/improve on a resource grammar or create a new one. It provides an overview of the relationships between files and a simple working pipeline for developers to get started.
Note that while files in this folder are meant to be named with 3 letter suffixes representing the language, e.g. "ResBul" for the Bulgarian resource file, this Readme will use a 4 letter suffix "Lang" to represent a language in general, e.g. "ResLang".
## Author(s) of this Readme
This Readme was written by Nemo and edited by Inari on 14th August 2022.
# Creating a new resource grammar
If you are working on an RGL for a new language, you will need to run "Clone.hs" in the "src" folder so that you can clone a project from another language to your language to give you a basis to start with.
As per the instructions, the syntax is "Clone fromdir todir fromlang tolang", e.g. "runghc Clone swedish danish Swe Dan". You may want to add the option --comment-body after the word "Clone" to comment out every line in the body of the files to start fresh.
This is especially useful if your new language has very little in common with the language you are copying from because they come from different language families.
# File hierarchy
The number of files may be overwhelming, but they are related together following the graphic under "Module dependencies" under the rgl-tutorial. In the graphic, an example is that GrammarIta and ResIta are dependent on Prelude as they have arrows pointing towards the Prelude ellipse.
http://www.grammaticalframework.org/lib/doc/rgl-tutorial/index.html
The below graphic is an alternative graphic explaining the relations, taken from private correspondence with Inari.
![File Hierarchy](FileHierarchy.png)
CatLang defines the categories, and the modules AdjectiveLang, NounLang, SentenceLang, PhraseLang, and so on, all extend Cat. The Grammar is defined as a collection of all those AdjectiveLang, NounLang, SentenceLang, and so on modules. LangLang is defined as the collection GrammarLang and LexiconLang and is where you will be checking your program. You may ignore:
- AllLangAbs, AllLang, ExtendLang, ExtraLangAbs, ExtraLang, ConstructionLang, DocumentationLang, MarkupLang, BackwardLang
If the language you cloned from has any of these resource modules, you can remove them completely:
- IrregLang (unless you want to populate it with irregular verbs of your own language), MissingLang (see how to generate your own if you need it later: https://inariksit.github.io/gf/2018/08/28/gf-gotchas.html#generating-missingxxx)
# Relationships between functions in files
There may be several ways the functions within the files are organised relative to one another. In other words, there may be several schemas depending on the author. More recent RGLs might implement one schema detailed by this blog post by Inari.
https://inariksit.github.io/gf/2018/08/28/gf-gotchas.html#my-naming-scheme-for-lincats-and-opers
# Main goal
You may think of your long-term goal as eventually implementing all the abstract functions found in the "abstract" folder. In other words, you are somewhat constrained by the available categories in Cat.gf and functions in relevant e.g. Noun.gf, Verb.gf etc. files.
In the future, if you find that the available functions do not apply to your language, you may search in the Extend.gf file for more optional functions, or in Extra.gf. if it doesn't exist, create your own ExtraLangAbs.gf with the concrete ExtraLang.gf, all in the same directory gf-rgl/src/lang. This blog post contains more information.
https://inariksit.github.io/gf/2021/02/15/rgl-api-core-extensions.html#language-specific-extra-modules
There is a prioritised list of RGL functions for new resource grammars written by contributor heatherleaf. You can start by implementing the "+++" functions.
https://github.com/GrammaticalFramework/gf-rgl/issues/238
# Working pipeline example
For a pipeline, You might wish to start with implementing functions that create Noun Phrase like DetCN: Det -> CN -> NP; a function that takes a Determiner and a Common Noun and gives a Noun Phrase. In this case, the workflow is done by editing:
1. ResLang: Contains the relevant Operations (Opers) for e.g. "Noun", "mkN", "Determiner" and "Quant".
2. ParamLang: Contains the language paramters used in ResLang.
3. CatLang: CatLang will be defined in terms of Opers found in ResLang. This means that instead of Defining NP in CatLang as, say, {s: Str}, you will define NP as ResLang.NounPhrase, which points to a NounPhrase Oper in ResLang. Then you need to implement the word syntax in NounLang.
4. NounLang: Contains the relevant lins in defining sentence structure.
5. LexiconLang: Contains the lins that define the Noun words.
As you will have to define a determiner that is created from a Quant, you will have to look at the following files too.
6. StructuralLang: Contains the lins that define the Quant/Determiner words.
Note that you will have to use mkQuant instead of creating Det by mkDet directly.
# Testing your work
When you are done with your implementation, you may test that everything works by starting up LangLang and, in this case, writing something like:
```DetCN (DetQuant xxxx_Quant NumSg) (UseN xxxx_N)```
Where you replace 'xxxx' with the word in Lang.

View File

@@ -0,0 +1,9 @@
--# -path=.:alltenses:prelude
resource CombinatorsTam = Combinators - [ appCN, appCNc ] with
(Cat = CatTam),
(Structural = StructuralTam),
(Noun = NounTam),
(Constructors = ConstructorsTam) **
{}
}

View File

@@ -0,0 +1,5 @@
--# -path=.:alltenses:prelude:../tamil
resource ConstructorsTam = Constructors with (Grammar = GrammarTam) **
open MissingTam in {} ;
}

6
src/api/SymbolicTam.gf Normal file
View File

@@ -0,0 +1,6 @@
--# -path=.:../tamil:../common:../abstract:../prelude
resource SymbolicTam = Symbolic with
(Symbol = SymbolTam),
(Grammar = GrammarTam) ** open MissingTam in {} ;
}

6
src/api/SyntaxTam.gf Normal file
View File

@@ -0,0 +1,6 @@
--# -path=.:alltenses:prelude
instance SyntaxTam of Syntax =
ConstructorsTam, CatTam, StructuralTam, CombinatorsTam ;
}

4
src/api/TryTam.gf Normal file
View File

@@ -0,0 +1,4 @@
--# -path=.:../tamil :../common:../abstract:../prelude
resource TryTam = SyntaxTam, LexiconTam, ParadigmsTam - [mkAdv,mkAdN,mkOrd,mkNum] ;
}

69
src/tamil/AdjectiveTam.gf Normal file
View File

@@ -0,0 +1,69 @@
concrete AdjectiveTam of Adjective = CatTam ** open ResTam, Prelude in {
-- flags optimize=all_subs ;
-- lin
-- -- : AP -> Adv -> AP ; -- warm by nature
-- AdvAP ap adv = ap ** {
-- s = ap.s ++ adv.s ;
-- } ;
-- -- : A -> AP ;
-- PositA a = a ** {
-- compar = [] ;
-- } ;
-- -- : A -> NP -> AP ;
-- ComparA a np = a ** {
-- compar = np.s
-- } ;
-- -- : A2 -> NP -> AP ; -- married to her
-- -- ComplA2 a2 np = a2 ** { } ;
-- -- : A2 -> AP ; -- married to itself
-- -- ReflA2 a2 = a2 ** { } ;
-- -- : A2 -> AP ; -- married
-- UseA2 = PositA ;
-- -- : A -> AP ; -- warmer
-- -- UseComparA a = a ** {
-- -- s = \\af => "???" ++ a.s ! af ;
-- -- compar = []
-- -- } ;
-- -- : CAdv -> AP -> NP -> AP ; -- as cool as John
-- -- CAdvAP adv ap np = ap ** { } ;
-- The superlative use is covered in $Ord$.
-- -- : Ord -> AP ; -- warmest
-- -- AdjOrd ord = ord ** {
-- -- compar = []
-- -- } ;
-- -- AdjOrd : Ord -> AP =
-- AdjOrd ord = ord ;
-- Sentence and question complements defined for all adjectival
-- phrases, although the semantics is only clear for some adjectives.
-- -- : AP -> SC -> AP ; -- good that she is here
-- -- SentAP ap sc = ap ** {
-- -- s = \\af => ap.s ! af ++ sc.s
-- -- } ;
-- An adjectival phrase can be modified by an *adadjective*, such as "very".
-- -- : AdA -> AP -> AP ;
-- -- AdAP ada ap = ap ** { } ;
-- It can also be postmodified by an adverb, typically a prepositional phrase.
--}
}

37
src/tamil/AdverbTam.gf Normal file
View File

@@ -0,0 +1,37 @@
concrete AdverbTam of Adverb = CatTam ** open ResTam, ParamTam, ParadigmsTam, Prelude in {
--lin
-- -- : A -> Adv ;
-- --PositAdvAdj adj = { } ;
-- -- : CAdv -> A -> NP -> Adv ; -- more warmly than John
-- -- ComparAdvAdj cadv a np = { } ;
-- ComparAdvAdjS : CAdv -> A -> S -> Adv ; -- more warmly than he runs
-- -- : Prep -> NP -> Adv ;
-- PrepNP prep np = {s = applyPrep prep np} ;
-- -- PrepNP to_Prep (UsePron youSg_Pron)
-- Adverbs can be modified by 'adadjectives', just like adjectives.
-- --AdAdv : AdA -> Adv -> Adv ; -- very quickly
-- -- AdAdv ada adv = adv **
-- Like adverbs, adadjectives can be produced by adjectives.
-- -- : A -> AdA ; -- extremely
-- -- PositAdAAdj a = { } ;
-- -- Subordinate clauses can function as adverbs.
-- -- : Subj -> S -> Adv ;
-- SubjS subj s = {s = subj.s ++ s.s} ;
-- Comparison adverbs also work as numeral adverbs.
-- --AdnCAdv : CAdv -> AdN ; -- less (than five)
-- --AdnCAdv cadv = {s = } ;
--} ;
}

9
src/tamil/AllTam.gf Normal file
View File

@@ -0,0 +1,9 @@
--# -path=.:../abstract:../common:../prelude
concrete AllTam of AllTamAbs =
LangTam,
ExtendTam
** open ParadigmsTam in {
-- lin sing_V2 = mkV2 "nyanyi" ;
-- } ;
}

8
src/tamil/AllTamAbs.gf Normal file
View File

@@ -0,0 +1,8 @@
--# -path=.:../abstract:../common:prelude
abstract AllTamAbs =
Lang,
Extend
** {
fun sing_V2: V2;
} ;

136
src/tamil/CatTam.gf Normal file
View File

@@ -0,0 +1,136 @@
concrete CatTam of Cat = CommonX - [IAdv] ** open ResTam, Prelude in {
-- flags optimize=all_subs ;
lincat
--2 Sentences and clauses
-- Constructed in SentenceTam, and also in IdiomTam
-- S = ResTam.Sentence ;
-- QS = SS ;
-- RS = ResTam.RS ;
-- -- relative sentence. Tense and polarity fixed,
-- -- but agreement may depend on the CN/NP it modifies.
-- Cl = ResTam.Clause ;
-- ClSlash = ResTam.ClSlash ;
-- SSlash = ResTam.Sentence ; -- sentence missing NP; e.g. "she has looked at"
-- Imp = {s : Number => Polarity => Str} ; -- imperative e.g. "look at this"
--2 Questions and interrogatives
-- Constructed in QuestionTam.
-- QCl = ResTam.Clause ;
-- IComp = {s: Str} ; -- interrogative complement of copula e.g. "where"
-- IDet = ResTam.Determiner ; -- interrogative determiner e.g. "how many"
-- IQuant = ResTam.IQuant ; -- interrogative quantifier e.g. "which"
-- IP = ResTam.IPhrase ; -- interrogative pronoun e.g. "who"
-- IAdv = ResTam.IAdv ;
--2 Subord clauses and pronouns
-- RCl = ResTam.RClause ;
-- RP = SS ;
--2 Verb phrases
-- Constructed in VerbTam.
-- VP = ResTam.VerbPhrase ;
-- VPSlash = ResTam.VPSlash ;
-- Comp = ResTam.VerbPhrase ;
--2 Adjectival phrases
-- Constructed in AdjectiveTam.
-- AP = ResTam.AdjPhrase ;
--2 Nouns and noun phrases
-- Constructed in NounTam.
-- Many atomic noun phrases e.g. "everybody"
-- are constructed in StructuralTam.
-- The determiner structure is
-- ``` Predet (QuantSg | QuantPl Num) Ord
-- as defined in NounTam.
CN = ResTam.CNoun ;
NP = ResTam.NounPhrase ;
-- Pron = ResTam.Pronoun ; --Pronouns need enough info to turn it into NP or Quant.
Det = ResTam.Determiner ;
-- Predet = SS ;
-- Quant = ResTam.Quant ;
Num = ResTam.Num ;
-- Ord = {
-- s : Str ; -- AForm => Str ; -- Ord can came from AP and become AP again
-- -- n : Number -- Ord can come from Num, which has inherent number
-- } ;
-- DAP = ResTam.Determiner ;
--2 Numerals
-- Constructed in NumeralTam.
-- Card = ResTam.CardNum ;
-- Numeral = ResTam.CardOrdNum ;
-- Digits = ResTam.DigNum ;
--2 Structural words
-- Constructed in StructuralTam.
-- Conj = {s2 : Str ; s1 : Str ; n : Number } ;
-- Subj = SS ;
-- Prep = ResTam.Preposition ;
--2 Words of open classes
-- These are constructed in LexiconTam and in
-- additional lexicon modules.
-- -- TODO: eventually different lincats
-- VS, -- sentence-complement verb e.g. "claim"
-- VQ, -- question-complement verb e.g. "wonder"
-- VA, -- adjective-complement verb e.g. "look"
-- V = ResTam.Verb ;
-- VV -- verb-phrase-complement verb e.g. "want"
-- = SS ;
-- V2A, -- verb with NP and AP complement e.g. "paint"
-- V2V, -- verb with NP and V complement e.g. "cause"
-- V2S, -- Reverb with NP and S complement e.g. "tell"
-- V2Q, -- verb with NP and Q complement e.g. "ask"
-- V2 = ResTam.Verb2 ;
-- V3 = ResTam.Verb3 ;
-- A = ResTam.Adjective ;
-- A2 = ResTam.Adjective2 ;
N = ResTam.Noun ;
-- N2 = ResTam.Noun2 ;
-- N3 = ResTam.Noun3 ;
-- PN = ResTam.PNoun ;
-- linref
-- CN = \cn -> cn.s ! NF Sg Bare ++ cn.heavyMod;
-- ClSlash = \cl -> cl.subj ++ cl.pred ! Root ! Pos ++ cl.c2.s;
-- RCl = \cl -> cl.subj ++ cl.pred ! P1 ! Pos;
-- Cl = \cl -> cl.subj ++ cl.pred ! Active ! Pos;
-- Det = linDet ;
--}
-- Determiner : Type = Quant ** {
-- pr : Str ; -- prefix for numbers
-- n : NumType ; -- number as in 5 (noun in singular), Sg or Pl
-- } ;
}

View File

@@ -0,0 +1,98 @@
concrete ConjunctionTam of Conjunction =
CatTam ** open ResTam, Coordination, Prelude in {
-- flags optimize=all_subs ;
-- {- Conjunction for category X needs four things:
-- lincat [X]
-- lin BaseX
-- lin ConsX
-- lin ConjX
-- For example, if X is defined as
-- lincat X = {s : Number => Str ; g : Gender} ;
-- then [X] will split its s field into two, and retain its other fields as is:
-- lincat [X] = {s1,s2 : Number => Str ; g : Gender} ;
-- Let us look at a simple case: Adv is of type {s : Str}
-- Then [Adv] is {s1,s2 : Str}.
-- BaseAdv, ConsAdv and ConjAdv can all use functions defined in prelude/Coordination:
-- BaseAdv = twoSS ;
-- ConsAdv = consrSS comma ;
-- ConjAdv = conjunctSS ;
-- --}
-- Adverb and other simple {s : Str} types.
--lincat
-- [Adv],[AdV],[IAdv] = {s1,s2 : Str} ;
--lin
-- BaseAdv, BaseAdV, BaseIAdv = twoSS ;
-- ConsAdv, ConsAdV, ConsIAdv = consrSS comma ;
-- ConjAdv, ConjAdV, ConjIAdv = conjunctDistrSS ;
--{-
-- RS depends on X, Y and Z, otherwise exactly like previous.
-- RS can modify CNs, which are open for …, and have inherent …
--lincat
-- [RS] = {s1,s2 : … => Str} ;
--lin
-- BaseRS = twoTable3 … ;
-- ConsRS = consrTable3 … comma ;
-- ConjRS = conjunctRSTable ;
--lincat
-- [S] = {} ;
--lin
-- BaseS x y = y ** { } ;
-- ConsS x xs =
-- xs ** { } ;
-- ConjS co xs = {} ;
--lincat
-- [AP] = {} ;
--lin
-- BaseAP x y = twoTable … x y ** y ; --choose all the other fields from second argument
-- ConsAP as a = consrTable … comma as a ** as ;
-- ConjAP co as = conjunctDistrTable … co as ** as ;
--lincat
-- [CN] = { } ;
--lin
-- BaseCN = {} ;
-- ConsCN = {} ;
-- ConjCN co cs = conjunctDistrTable Agr co cs ** cs ;
--lincat
-- [DAP] =
--lin
-- BaseDAP x y = x **
-- ConsDAP xs x = xs **
-- ConjDet conj xs = xs **
-- Noun phrases
--lincat
-- [NP] =
--lin
-- BaseNP x y =
-- ConsNP x xs =
-- ConjNP conj xs =
---}
--}
}

View File

@@ -0,0 +1,120 @@
concrete ConstructionTam of Construction = CatTam ** open ParadigmsTam 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 SyntaxTam.mkAdv for_Prep n_hours_NP | mkAdv (n_hours_NP.s ! R.npNom) ;
-- weekdayPunctualAdv w = ; -- on Sunday
-- weekdayHabitualAdv w = ; -- on Sundays
-- weekdayNextAdv w = -- next Sunday
-- weekdayLastAdv w = -- last Sunday
-- monthAdv m = mkAdv in_Prep (mkNP m) ;
-- yearAdv y = mkAdv in_Prep y ;
-- dayMonthAdv d m = ; -- on 17 Tam
-- monthYearAdv m y = ; -- in Tam 2012
-- dayMonthYearAdv d m y = ; -- on 17 Tam 2013
-- intYear = symb ;
-- intMonthday = symb ;
--lincat Language = N ;
--lin InLanguage l = mkAdv ???_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 = \s -> mkN s ;
----------------------------------------------
---- lexicon of special names
--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 "Arabic" ;
--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 "Euslish" ;
--lin estonian_Language = mkLanguage "Estonian" ;
--lin finnish_Language = mkLanguage "Finnish" ;
--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 "Persian" ;
--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 "Swedish" ;
--lin thai_Language = mkLanguage "Thai" ;
--lin turkish_Language = mkLanguage "Turkish" ;
--lin urdu_Language = mkLanguage "Urdu" ;
--—}
--}
---}
--}
}

106
src/tamil/ExtendTam.gf Normal file
View File

@@ -0,0 +1,106 @@
--# -path=.:../common:../abstract
concrete ExtendTam of Extend = CatTam
{- ** ExtendFunctor - [
VPS -- finite VP's with tense and polarity
, ListVPS
, VPI
, ListVPI -- infinitive VP's (TODO: with anteriority and polarity)
, MkVPS
, PredVPS
-- excluded because RGL funs needed for them not implemented yet
, SlashBareV2S
, PredAPVP
, ComplBareVS
,PresPartAP, PastPartAP
,GenModNP, GenNP, GenRP
,CompoundN
,GerundNP
-- VPS2 ; -- have loved (binary version of VPS)
-- [VPS2] {2} ; -- has loved, hates"
-- VPI2 ; -- to love (binary version of VPI)
-- [VPI2] {2} ; -- to love, to hate
]
with (Grammar=GrammarTam) -}
** open Prelude, Coordination, ResTam, NounTam in {
-- lincat
-- VPS, VPI = SS ;
-- ListVPS, ListVPI = ListX ;
-- lin
-- -- MkVPS : Temp -> Pol -> VP -> VPS ; -- hasn't slept
-- MkVPS t p vp = {
-- s = t.s ++ p.s ++ vp.s ! Active ! p.p;
-- } ;
-- -- BaseVPS : VPS -> VPS -> ListVPS ;
-- BaseVPS vps vps2 = twoSS vps vps2 ;
-- -- ConsVPS : VPS -> ListVPS -> ListVPS ;
-- ConsVPS str listvps vps = consSS "," listvps vps ;
-- -- ConjVPS : Conj -> [VPS] -> VPS ; -- has walked and won't sleep
-- ConjVPS conj listvps = conjunctX conj listvps ;
-- -- PredVPS : NP -> VPS -> S ; -- she [has walked and won't sleep]
-- PredVPS np vps = {
-- s = np.s ! Bare ++ vps.s ;
-- } ;
-- -- SQuestVPS : NP -> VPS -> QS ; -- has she walked
-- -- QuestVPS : IP -> VPS -> QS ; -- who has walked
-- -- RelVPS : RP -> VPS -> RS ; -- which won't sleep
-- -- MkVPI : VP -> VPI ; -- to sleep (TODO: Ant and Pol)
-- MkVPI vp = {s = linVP vp} ;
-- -- BaseVPI : VPI -> VPI -> ListVPI ;
-- BaseVPI vpi vpi2 = twoSS vpi vpi2 ;
-- -- ConsVPI : VPI -> ListVPI -> ListVPI ;
-- ConsVPI str listvpi vpi = consSS "," listvpi vpi ;
-- -- ConjVPI : Conj -> [VPI] -> VPI ; -- to sleep and to walk
-- -- ComplVPIVV : VV -> VPI -> VP ; -- must sleep and walk
-- ComplVPIVV vv vpi = useV {
-- s = \\vf => vv.s ++ vpi.s
-- } ;
-- -- PresPartAP : VP -> AP ; -- (the man) looking at Mary
-- PresPartAP vp = {
-- s = linVP vp
-- } ;
-- PastPartAP vp = {
-- s = linVP vp
-- } ;
-- -- GenModNP : Num -> NP -> CN -> NP ; -- this man's car(s)
-- GenModNP n np cn = variants {};
-- -- GenNP : NP -> Quant ; -- this man's
-- GenNP np = variants {};
-- -- GenRP : Num -> CN -> RP ; -- whose car
-- GenRP n cn = variants {};
-- -- CompoundN : N -> N -> N ; -- control system / controls system / control-system
-- CompoundN n1 n2 = n2 ** {
-- s = \\nf => n1.s ! NF Sg Bare ++ n2.s ! nf
-- } ;
-- -- GerundNP : VP -> NP ; -- publishing the document (by nature definite)
-- GerundNP vp = emptyNP ** {
-- s = \\_ => linVP vp
-- } ;
-- -- MkVPS2 : Temp -> Pol -> VPSlash -> VPS2 ; -- has loved
-- -- ConjVPS2 : Conj -> [VPS2] -> VPS2 ; -- has loved and now hates
-- -- ComplVPS2 : VPS2 -> NP -> VPS ; -- has loved and now hates that person
-- -- ReflVPS2 : VPS2 -> RNP -> VPS ; -- have loved and now hate myself and my car
-- -- MkVPI2 : VPSlash -> VPI2 ; -- to love
-- -- ConjVPI2 : Conj -> [VPI2] -> VPI2 ; -- to love and hate
-- -- ComplVPI2 : VPI2 -> NP -> VPI ; -- to love and hate that person
--} ;
}

25
src/tamil/GrammarTam.gf Normal file
View File

@@ -0,0 +1,25 @@
concrete GrammarTam of Grammar =
NounTam,
VerbTam,
AdjectiveTam,
AdverbTam,
NumeralTam,
SentenceTam,
QuestionTam,
RelativeTam,
ConjunctionTam,
PhraseTam,
TextX - [AAnter, TFut, TCond, IAdv],
StructuralTam,
IdiomTam,
TenseX - [AAnter, TFut, TCond, IAdv]
** open ParamX in {
-- flags startcat = Phr ;
-- lin AAnter = {s = "sudah" ; a = ParamX.Anter} ; --# notpresent
-- TFut = {s = "akan" ; t = ParamX.Fut} ; --# notpresent
-- TCond = {s = "akan" ; t = ParamX.Cond} ; --# notpresent
--} ;
}

59
src/tamil/IdiomTam.gf Normal file
View File

@@ -0,0 +1,59 @@
--1 Idiom: Idiomatic Expressions
concrete IdiomTam of Idiom = CatTam ** open Prelude, ResTam, VerbTam, QuestionTam, NounTam, StructuralTam in {
-- This module defines constructions that are formed in fixed ways,
-- often different even in closely related languages.
-- lin
-- -- ImpersCl : VP -> Cl ; -- it is hot
-- ImpersCl vp = {
-- subj = [] ;
-- pred = \\vf,pol => vp.s ! Root ! pol -- force no prefix -- TODO check if legit?
-- } ;
-- -- : NP -> Cl ; -- there is a house
-- ExistNP np = predVP np (useV copula) ;
-- -- ExistIP : IP -> QCl ; -- which houses are there
-- ExistIP ip = QuestVP ip (useV copula) ;
-- -- GenericCl : VP -> Cl ; -- one sleeps
-- GenericCl = \vp -> predVP emptyNP vp ;
--{-
-- CleftNP : NP -> RS -> Cl ; -- it is I who did it
-- CleftAdv : Adv -> S -> Cl ; -- it is here she slept
-- -- : NP -> Cl ; -- there is a house
-- ExistNP np =
-- ExistIP : IP -> QCl ; -- which houses are there
-- 7/12/2012 generalizations of these
-- ExistNPAdv : NP -> Adv -> Cl ; -- there is a house in Paris
-- ExistIPAdv : IP -> Adv -> QCl ; -- which houses are there in Paris
-- -- : VP -> VP ;
-- ProgrVP vp = vp ** {
-- } ;
-- -- : VP -> Utt ; -- let's go
-- ImpPl1 vp = { } ;
-- ImpP3 : NP -> VP -> Utt ; -- let John walk
-- 3/12/2013 non-reflexive uses of "self"
-- SelfAdvVP : VP -> VP ; -- is at home himself
-- SelfAdVVP : VP -> VP ; -- is himself at home
-- SelfNP : NP -> NP ; -- the president himself (is at home)
---}
--}
}

6
src/tamil/LangTam.gf Normal file
View File

@@ -0,0 +1,6 @@
--# -path=.:../abstract:../common:../prelude:../api
concrete LangTam of Lang =
GrammarTam,
LexiconTam,
ConstructionTam ;

431
src/tamil/LexiconTam.gf Normal file
View File

@@ -0,0 +1,431 @@
concrete LexiconTam of Lexicon = CatTam **
open ParadigmsTam, ResTam in {
----
-- A
-- lin add_V3 = mkV3 "" ;
--lin airplane_N = mkN "" ;
-- lin alas_Interj = mkInterj "" ;
--lin already_Adv = mkA "" ;
--lin animal_N = mkN "" ;
-- lin answer_V2S = mkV2S "" ;
--lin apartment_N = mkN "" ;
--lin apple_N = mkN "" ;
--lin art_N = mkN "" ;
--lin ashes_N = mkN "" ;
--lin ask_V2Q = mkV2 "" ;
----
-- B
--lin baby_N = mkN "" ;
--lin back_N = mkN "" ;
-- lin bad_A = mkA "" ;
--lin bank_N = mkN "" ;
-- lin bark_N = mkN "" ;
--lin beautiful_A = mkA "" ;
-- lin become_VA = mkVA "" ;
--lin beer_N = mkN "" ;
-- lin beg_V2V = mkV2 "" ;
-- lin belly_N = mkN "" ;
--lin big_A = mkA "" ;
--lin bike_N = mkN "" ;
--lin bird_N = mkN "" ;
-- lin bite_V2 = mkV2 "" ;
--lin black_A = mkA "" ;
--lin blood_N = mkN "" ;
-- lin blow_V = mkV "" ;
--lin blue_A = mkA "" ;
--lin boat_N = mkN "" ;
--lin bone_N = mkN "" ;
-- lin boot_N = mkN "" ;
-- lin boss_N = mkN "" ;
--lin book_N = mkN "" ;
-- lin boy_N = mkN "" ;
--lin bread_N = mkN "" ;
--lin break_V2 = mkV4 "" ;
-- lin breast_N = mkN "" ;
-- lin breathe_V = mkV "" ;
-- lin broad_A = mkA "" ;
-- lin brother_N2 = mkN "";
-- lin brown_A = mkA "" ;
--lin burn_V = mkV "" ;
--lin butter_N = mkN "" ;
--lin buy_V2 = mkV2 "" ;
----
-- C
-- lin camera_N = mkN "" ;
-- lin cap_N = mkN "" ;
--lin car_N = mkN "kereta" ;
-- lin carpet_N = mkN "" ;
--lin cat_N = mkN "kucing" ;
-- lin ceiling_N = mkN "" ;
-- lin chair_N = mkN "" ;
-- lin cheese_N = mkN "" ;
-- lin child_N = mkN "" ;
-- lin church_N = mkN "" ;
-- lin city_N = mkN "" ;
--lin clean_A = mkA "" ;
-- lin clever_A = mkA "" ;
-- lin close_V2 = mkV2 "" ;
--lin cloud_N = mkN "" ;
-- lin coat_N = mkN "" ;
-- lin cold_A = mkA "" ;
--lin come_V = mkV "" ;
-- lin computer_N = mkN "" ;
-- lin correct_A = mkA "" ;
-- lin count_V2 = mkV2 "" ;
-- lin country_N = mkN "" ;
-- lin cousin_N = mkN "" ;
--lin cow_N = mkN "" ;
-- lin cut_V2 = mkV2 "" ;
----
-- D
-- lin day_N = mkN "" ;
-- lin die_V = mkV "" ;
-- lin dig_V = mkV "" ;
-- lin dirty_A = mkA "" ;
-- lin distance_N3 = mkN "" ;
-- lin do_V2 = lin V2 "" ;
-- lin doctor_N = mkN "" ;
--lin dog_N = mkN "" ;
--lin door_N = mkN "" ;
--lin drink_V2 = let drink' : V2 = mkV2 "minum" in drink' ** {
-- s = \\_ => "" ;
--};
-- lin dry_A = mkA "" ;
-- lin dull_A = mkA "" ;
-- lin dust_N = mkN "" ;
----
-- E
-- lin ear_N = mkN "" ;
-- lin earth_N = mkN "" ;
--lin eat_V2 = let eat' : V2 = mkV2 "makan" in eat' ** {
-- s = \\_ => "makan" ;
--};
-- lin egg_N = mkN "" ;
-- lin empty_A = mkA "" ;
-- lin enemy_N = mkN "" ;
-- lin eye_N = mkN "" ;
----
-- F
-- lin factory_N = mkN "" ;
-- lin fall_V = mkV "" ;
-- lin far_Adv = mkA "" ;
-- lin fat_N = mkN "" ;
--lin father_N2 = mkN2 "" ;
-- lin fear_V2 = mkV2 "" ;
-- lin fear_VS = mkVS "" ;
-- lin feather_N = mkN "" ;
-- lin fight_V2 = mkV2 "" ;
-- lin find_V2 = mkV2 "" ;
-- lin fingernail_N = mkN "" ;
-- lin fire_N = mkN "" ;
-- lin fish_N = mkN "" ;
-- lin float_V = mkV "" ;
-- lin floor_N = mkN "" ;
-- lin flow_V = mkV "" ;
-- lin flower_N = mkN "" ;
-- lin fly_V = mkV "" ;
-- lin fog_N = mkN "" ;
-- lin foot_N = mkN "" ;
-- lin forest_N = mkN "" ;
-- lin forget_V2 = mkV2 "" ;
-- lin freeze_V = mkV "" ;
-- lin fridge_N = mkN "" ;
-- lin friend_N = mkN "" ;
-- lin fruit_N = mkN "" ;
-- lin full_A = mkA "" ;
-- --lin fun_AV
----
-- G
-- lin garden_N = mkN "" ;
-- lin girl_N = mkN "" ;
--lin give_V3 = mkV3 "" ;
-- lin glove_N = mkN "" ;
--lin go_V = mkV "" ;
-- lin gold_N = mkN "" ;
-- lin good_A = mkA "" ;
-- lin grammar_N = mkN "" ;
-- lin grass_N = mkN "" ;
--lin green_A = mkA "" ;
----
-- H
-- lin hair_N = mkN "" ;
-- lin hand_N = mkN "" ;
-- lin harbour_N = mkN "" ;
-- lin hat_N = mkN "" ;
-- lin hate_V2 = mkV2 "" ;
-- lin head_N = mkN "" ;
-- lin hear_V2 = mkV2 "" ;
-- lin heart_N = mkN "" ;
-- lin heavy_A = mkA "" ;
-- lin hill_N = mkN "" ;
--lin hit_V2 = mkV2 "" ;
-- lin hold_V2 = mkV2 "" ;
-- lin hope_VS = mkV "" ;
-- lin horn_N = mkN "" ;
-- lin horse_N = mkN "" ;
-- lin hot_A = mkA "" ;
lin house_N = mkN "vittu" "vittu" ;
-- lin hunt_V2 = mkV2 "" ;
-- lin husband_N = mkN "" ;
--------
-- I - K
-- lin ice_N = mkN "" ;
-- lin industry_N = mkN "" ;
-- lin iron_N = mkN "" ;
--lin john_PN = mkPN "" ;
-- lin jump_V = mkV "" ;
-- lin kill_V2 = mkV2 "" ;
--lin king_N = mkN "" ;
-- lin knee_N = mkN "" ;
-- lin know_V2 = mkV2 "" ;
-- lin know_VQ = mkVQ "" ;
-- lin know_VS = mkV "" ;
----
-- L
-- lin lake_N = mkN "" ;
-- lin lamp_N = mkN "" ;
-- lin language_N = mkN "" ;
-- lin laugh_V = mkV "" ;
-- lin leaf_N = mkN "" ;
--lin learn_V2 = mkV2 (prefixV (mkV "ajar" Ber)) emptyPrep ;
-- lin leather_N = mkN "" ;
-- lin leave_V2 = mkV2 "" ;
-- lin leg_N = mkN "" ;
-- lin lie_V = mkV "" ;
--lin like_V2 = let like' : V2 = mkV2 "suka" in like' ** {
-- s = \\_ => "suka" ;
-- passive = "disukai" ;
--} ;
-- lin listen_V2 = mkV2 "" ;
-- lin live_V = mkV "";
-- lin liver_N = mkN "" ;
--lin long_A = mkA "" ;
-- lin lose_V2 = mkV2 "" ;
-- lin louse_N = mkN "" ;
-- lin love_N = mkN "" ;
-- lin love_V2 = let love' : V2 = mkV2 "cinta" in love' ** {
-- s = \\_ => "mencintai" ;
-- passive = "dicintai" ;
-- } ;
--lin love_V2 = mkV4 "" "";
----
-- M
--lin man_N = mkN "lelaki" ;
-- lin married_A2 = mkA "" ;
--lin meat_N = mkN "daging" ;
--lin milk_N = mkN "susu" ;
-- lin moon_N = mkN "" ;
--lin mother_N2 = mkN2 "ibu" ;
-- lin mountain_N = mkN "" ;
-- lin mouth_N = mkN "" ;
-- lin music_N = mkN "" ;
----
-- N
-- lin name_N = mkN "" ;
-- lin narrow_A = mkA "" ;
-- lin near_A = mkA "" ;
-- lin neck_N = mkN "" ;
-- lin new_A = mkA "" ;
-- lin newspaper_N = mkN "" ;
-- lin night_N = mkN "" ;
-- lin nose_N = mkN "" ;
--lin now_Adv = mkAdv "sekarang" ;
-- lin number_N = mkN "" ;
--------
-- O - P
-- lin oil_N = mkN "" ;
--lin old_A = mkA "tua" ;
--lin open_V2 = mkV2 "buka" ;
--lin paint_V2A = mkV2 "cat" ;
-- lin paper_N = mkN "" ;
-- lin paris_PN = mkPN "Paris" ;
-- lin peace_N = mkN "" ;
-- lin pen_N = mkN "" ;
--lin person_N = mkN "orang" ;
-- lin planet_N = mkN "" ;
-- lin plastic_N = mkN "" ;
-- lin play_V = mkV "" ;
-- lin policeman_N = mkN "" ;
-- lin priest_N = mkN "" ;
-- lin pull_V2 = mkV2 "" ;
-- lin push_V2 = mkV2 "" ;
-- lin put_V2 = mkV2 "" ;
--------
-- Q - R
--lin queen_N = mkN "ratu" ;
-- lin question_N = mkN "" ;
-- lin radio_N = mkN "" ;
--lin rain_N = mkN "hujan" ;
--lin rain_V0 = mkV "hujan" ;
--lin read_V2 = mkV2 "baca" ;
-- lin ready_A = mkA "" ;
-- lin reason_N = mkN "" ;
-- lin red_A = mkA "" ;
-- lin religion_N = mkN "" ;
-- lin restaurant_N = mkN "" ;
-- lin river_N = mkN "" ;
-- lin road_N = mkN "" ;
-- lin rock_N = mkN "" ;
-- lin roof_N = mkN "" ;
-- lin root_N = mkN "" ;
-- lin rope_N = mkN "" ;
-- lin rotten_A = mkA "" ;
-- lin round_A = mkA "" ;
-- lin rub_V2 = mkV2 "" ;
-- lin rubber_N = mkN "" ;
--lin rule_N = mkN "peraturan" ;
-- lin run_V = mkV "" ;
----
-- S
-- lin salt_N = mkN "" ;
-- lin sand_N = mkN "" ;
-- lin say_VS = mkVS "" ;
--lin school_N = mkN "sekolah" ;
--lin science_N = mkN "sains" ;
-- lin scratch_V2 = mkV2 "" ;
-- lin sea_N = mkN "" ;
--lin see_V2 = mkV2 "lihat" ;
-- lin seed_N = mkN "" ;
-- lin seek_V2 = mkV2 "" ;
-- lin sell_V3 = mkV3 (mkV "jual" Meng) emptyPrep emptyPrep ; -- TODO
-- lin send_V3 = mkV3 "" ;
-- lin sew_V = mkV "" ;
-- lin sharp_A = mkA "" ;
-- lin sheep_N = mkN "" fem ;
-- lin ship_N = mkN "" ;
-- lin shirt_N = mkN "" ;
-- lin shoe_N = mkN "" ;
-- lin shop_N = mkN "" ;
-- lin short_A = mkA "" ;
-- lin silver_N = mkN "" ;
--lin sing_V = mkV "nyanyi" ;
-- lin sister_N = mkN "" ;
-- lin sit_V = mkV "" ;
-- lin skin_N = mkN "" ;
-- lin sky_N = mkN "" ;
-- lin sleep_V = mkV "" ;
--lin small_A = mkA "kecil" ;
-- lin smell_V = mkV "" ;
-- lin smoke_N = mkN "" ;
-- lin smooth_A = mkA "" ;
-- lin snake_N = mkN "" ;
-- lin snow_N = mkN "" ;
-- lin sock_N = mkN "" ;
--lin song_N = mkN "lagu" ;
-- lin speak_V2 = mkV2 "" ;
-- lin spit_V = mkV "" ;
-- lin split_V2 = mkV2 "" ;
-- lin squeeze_V2 = mkV2 "" ;
-- lin stab_V2 = mkV2 "" ;
-- lin stand_V = mkV "" ;
-- lin star_N = mkN "" ;
-- lin steel_N = mkN "" ;
-- lin stick_N = mkN "" ;
-- lin stone_N = mkN "" ;
--lin stop_V = mkV "henti" ;
-- lin stove_N = mkN "" ;
-- lin straight_A = mkA "" ;
-- lin student_N = mkN "" ;
-- lin stupid_A = mkA "" ;
-- lin suck_V2 = mkV2 "" ;
-- lin sun_N = mkN "" ;
-- lin swell_V = mkV "" ;
-- lin swim_V = mkV "" ;
----
-- T
-- lin table_N = mkN "" ;
-- lin tail_N = mkN "" ;
--lin talk_V3 = mkV3 (mkV "cakap" Ber) (mkPrep "tentang") (mkPrep "dengan") ;
--lin teach_V2 = mkV2 "ajar" ;
-- lin teacher_N = mkN "" ;
-- lin television_N = mkN "" ;
-- lin thick_A = mkA "" ;
-- lin thin_A = mkA "" ;
-- lin think_V = mkV "" ;
-- lin throw_V2 = mkV2 "" ;
-- lin tie_V2 = mkV2 "" ;
-- lin today_Adv = mkA "" ;
-- lin tongue_N = mkN "" ;
-- lin tooth_N = mkN "" ;
-- lin train_N = mkN "" ;
-- lin travel_V = mkV "" ;
-- lin tree_N = mkN "" ;
-- lin turn_V = mkV "" ;
--------
-- U - V
--lin ugly_A = mkA "jelek" ;
-- lin uncertain_A = mkA "" ;
-- lin understand_V2 = mkV2 "" ;
-- lin university_N = mkN "" ;
-- lin village_N = mkN "" ;
-- lin vomit_V = mkV2 "" ;
--------
-- W - Y
-- lin wait_V2 = mkV2 "" ;
--lin walk_V = mkV "jalan" ;
-- lin war_N = mkN "" ;
-- lin warm_A = mkA "" ;
-- lin wash_V2 = mkV2 "" ;
-- lin watch_V2 = mkV2 "" ;
-- lin water_N = mkNoun "" ;
-- lin wet_A = mkA "" ;
-- lin white_A = mkA "" ;
-- lin wide_A = mkA "" ;
-- lin wife_N = mkN "" ;
-- lin win_V2 = mkV2 "" ;
-- lin wind_N = mkN "" ;
-- lin window_N = mkN "" ;
-- lin wine_N = mkN "" ;
-- lin wing_N = mkN "" ;
-- lin wipe_V2 = mkV2 "" ;
--lin woman_N = mkN "perempuan" ;
-- lin wonder_VQ = mkVQ "" ;
-- lin wood_N = mkN "" ;
-- lin worm_N = mkN "" ;
--lin write_V2 = mkV2 "tulis" ;
-- lin year_N = mkN "" ;
-- lin yellow_A = mkA "" ;
--lin young_A = mkA "muda" ;
--}
}

237
src/tamil/NounTam.gf Normal file
View File

@@ -0,0 +1,237 @@
concrete NounTam of Noun = CatTam ** open ResTam, Prelude in {
flags optimize=all_subs ;
lin
--2 Noun phrases
-- : Det -> CN -> NP
DetCN det cn = {s = det.s ++ cn.s ! Sg ! Nom} ;
-- -- : PN -> NP ;
-- UsePN pn = MassNP (UseN pn) ;
-- -- : Pron -> NP ;
-- UsePron pron = pron ** {
-- s = \\_ => pron.s ;
-- a = IsPron pron.p ;
-- };
-- -- : Predet -> NP -> NP ; -- only the man
-- -- PredetNP predet np =
-- A noun phrase can also be postmodified by the past participle of a
-- verb, by an adverb, or by a relative clause
-- -- : NP -> V2 -> NP ; -- the man seen
-- -- PPartNP np v2 = np ** {
-- -- s = \\c => v2.s ! ??? ++ np.s ! c } ; ----
-- -- : NP -> Adv -> NP ; -- Paris today ; boys, such as ..
-- AdvNP,ExtAdvNP = \np,adv -> np ** {
-- s = \\pos => np.s ! pos ++ adv.s
-- } ;
-- -- : NP -> RS -> NP ; -- Paris, which is here
-- RelNP np rs = np ** {
-- s = \\poss => np.s ! poss ++ rs.s ! agr2p np.a
-- } ;
-- Determiners can form noun phrases directly.
-- -- : Det -> NP ;
-- DetNP det = emptyNP ** {
-- s = \\_ => linDet det ;
-- } ;
-- -- MassNP : CN -> NP ;
-- MassNP cn = emptyNP ** {
-- s = \\poss => cn.s ! NF Sg poss ++ cn.heavyMod
-- } ;
--2 Determiners
-- The determiner has a fine-grained structure, in which a 'nucleus'
-- quantifier and an optional numeral can be discerned.
-- -- : Quant -> Num -> Det ;
DetQuant quant num = quant ** {
pr = num.s ; -- if it's not a number or digit, num.s is empty
s = quant.s ;
n = num.n ;
count = "ke" ++ BIND ++ num.s ++ BIND ++ "-" ++ BIND ++ num.s;
} ;
-- -- : Quant -> Num -> Ord -> Det ;
-- DetQuantOrd quant num ord = quant ** {
-- pr = num.s ;
-- n = num.n ;
-- s = ord.s ++ quant.s ;
-- count = "" ;
-- } ;
-- Whether the resulting determiner is singular or plural depends on the
-- cardinal.
-- All parts of the determiner can be empty, except $Quant$, which is
-- the "kernel" of a determiner. It is, however, the $Num$ that determines
-- the inherent number.
NumSg = baseNum ;
-- NumPl = baseNum ** {n = NoNum Pl} ;
-- -- : Card -> Num ;
-- NumCard card = card ** {
-- n = IsNumber -- for the purposes of modifying a noun, this is singular
-- } ;
-- -- : Digits -> Card ;
-- NumDigits dig = {
-- s = dig.s ! NCard
-- } ;
-- -- : Numeral -> Card ;
-- NumNumeral num = num ;
--{-
-- -- : AdN -> Card -> Card ;
-- AdNum adn card = card ** { s = adn.s ++ card.s } ;
-- -- : Digits -> Ord ;
-- OrdDigits digs = digs ** { s = digs.s ! NOrd } ;
---}
-- -- : Numeral -> Ord ;
-- OrdNumeral num = {
-- s = num.ord
-- } ;
-- -- : A -> Ord ;
-- OrdSuperl a = {
-- s = "ter" ++ BIND ++ a.s
-- } ;
-- One can combine a numeral and a superlative.
-- -- : Numeral -> A -> Ord ; -- third largest
-- OrdNumeralSuperl num a = {
-- s = num.ord ++ "ter" ++ BIND ++ a.s
-- } ;
-- -- : Quant
-- DefArt = mkQuant [] ;
-- -- : Quant
-- IndefArt = mkQuant [] ;
-- -- : Pron -> Quant
-- PossPron pron = mkQuant pron.s ** {
-- poss = Bare ; -- this becomes "kucing dia". for "kucingnya", use PossNP.
-- } ;
--2 Common nouns
-- -- : N -> CN
-- -- : N2 -> CN ;
UseN = ResTam.useN ;
-- UseN2 = ResTam.useN ;
-- -- : N2 -> NP -> CN ;
-- ComplN2 n2 np = useN n2 ** {
-- s = \\nf =>
-- case <n2.c2.prepType, np.a, nf> of {
-- <DirObj, IsPron p, NF num _>
-- => n2.s ! NF num (Poss p) ++ np.empty ; -- DirObj is reused here to mean possession
-- _ => n2.s ! nf ++ applyPrep n2.c2 np
-- }
-- } ;
-- -- : N3 -> NP -> N2 ; -- distance from this city (to Paris)
-- -- ComplN3 n3 np =
-- -- : N3 -> N2 ; -- distance (from this city)
-- -- Use2N3 n3 = lin N2 n3 ** { c2 = n3.c3 } ;
-- -- : N3 -> N2 ; -- distance (to Paris)
-- -- Use3N3 n3 = lin N2 n3 ;
-- -- : AP -> CN -> CN
-- AdjCN ap cn = cn ** {
-- s = \\nf => cn.s ! nf ++ ap.s
-- } ;
-- -- : CN -> RS -> CN ;
-- RelCN cn rs = cn ** {
-- heavyMod = cn.heavyMod ++ rs.s ! P3
-- } ;
-- -- : CN -> Adv -> CN ;
-- AdvCN cn adv = cn ** {
-- heavyMod = cn.heavyMod ++ adv.s
-- } ;
--{-
-- -- : CN -> Adv -> CN ;
-- AdvCN cn adv = cn ** { } ;
-- Nouns can also be modified by embedded sentences and questions.
-- For some nouns this makes little sense, but we leave this for applications
-- to decide. Sentential complements are defined in VerbTam.
-- -- : CN -> SC -> CN ; -- question where she sleeps
-- SentCN cn sc = cn ** { } ;
--2 Apposition
-- This is certainly overgenerating.
-- -- : CN -> NP -> CN ; -- city Paris (, numbers x and y)
-- ApposCN cn np = cn ** { s = } ;
---}
--2 Possessive and partitive constructs
-- -- : PossNP : CN -> NP -> CN ;
-- -- this produces "bukunya".
-- PossNP cn np = cn ** {
-- s = \\nf => case <np.a, nf> of {
-- <IsPron p, NF num _>
-- => cn.s ! NF num (Poss p) ++ np.empty ;
-- _ => cn.s ! nf ++ np.s ! Bare
-- }
-- } ;
-- -- : Det -> NP -> NP ;
-- CountNP det np = np **
-- {
-- s = \\pos => det.count ++ np.s ! pos;
-- } ; -- Nonsense for DefArt or IndefArt
-- -- : CN -> NP -> CN ; -- glass of wine / two kilos of red apples
-- -- PartNP cn np = cn ** {
-- -- } ;
--{-
-- This is different from the partitive, as shown by many languages.
-- -- : Det -> NP -> NP ;
-- CountNP det np = np **
-- { } ; -- Nonsense for DefArt or IndefArt
--3 Conjoinable determiners and ones with adjectives
-- -- : DAP -> AP -> DAP ; -- the large (one)
-- AdjDAP dap ap = dap ** { } ;
-- -- : Det -> DAP ; -- this (or that)
-- DetDAP det = det ;
---}
--}
}

162
src/tamil/NumeralTam.gf Normal file
View File

@@ -0,0 +1,162 @@
-- David Wahlstedt 2002 (cardinal numbers)
-- Inari Listenmaa 2020 (ordinals + cosmetic changes)
concrete NumeralTam of Numeral = CatTam [Numeral,Digits] **
open Prelude, ResTam in {
-- lincat
-- Digit = OrdNum ; -- 2..9
-- Sub10, -- 1..9
-- Sub100, -- 1..99
-- Sub1000 = LinNumber ; -- 1..999
-- Sub1000000 = OrdNum ; -- 1..999999
-- oper
-- LinNumber : Type = {
-- s : DForm => Str ;
-- n : Number ; -- This is an internal number that tells which form of digits to choose. When quantifying a noun, the noun is in singular.
-- ord : Str ;
-- } ;
-- OrdNum : Type = CardOrdNum ** {n : Number} ;
-- lin
-- -- : Sub1000000 -> Numeral ; -- 123456 [coercion to top category]
-- num x = x ;
-- -- : Digit ;
-- n2 = mkDigit "dua" ;
-- n3 = mkDigit "tiga" ;
-- n4 = mkDigit "empat" ;
-- n5 = mkDigit "lima" ;
-- n6 = mkDigit "enam" ;
-- n7 = mkDigit "tujuh" ;
-- n8 = mkDigit "lapan" ; -- "delapan" for Indonesian
-- n9 = mkDigit "sembilan" ;
-- -- : Sub10 ; -- 1
-- pot01 = {
-- s = table {
-- Attrib => [] ;
-- Indep => "satu" } ;
-- n = Sg ;
-- ord = "pertama"
-- } ;
-- -- : Digit -> Sub10 ; -- d * 1
-- pot0 d = d ** {s = \\_ => d.s} ;
-- -- : Sub100 ; -- 10
-- pot110 = mkNum "sepuluh" ;
-- -- : Sub100 ; -- 11
-- pot111 = mkNum "sebelas" ;
-- -- : Digit -> Sub100 ; -- 10 + d
-- pot1to19 d = mkNum3 d "belas" [] ;
-- -- : Sub10 -> Sub100 ; -- coercion of 1..9
-- pot0as1 n = n ;
-- -- : Digit -> Sub100 ; -- d * 10
-- pot1 d = mkNum3 d "puluh" [] ;
-- -- : Digit -> Sub10 -> Sub100 ; -- d * 10 + n
-- pot1plus d e = -- 21 = dua puluh satu, so we choose Indep form of 1.
-- mkNum3 d "puluh" (e.s ! Indep) ;
-- -- : Sub100 -> Sub1000 ; -- coercion of 1..99
-- pot1as2 n = n ;
-- -- : Sub10 -> Sub1000 ; -- m * 100
-- pot2 d = potNum d ratus [] ;
-- -- : Sub10 -> Sub100 -> Sub1000 ; -- m * 100 + n
-- pot2plus d e = potNum d ratus (e.s ! Indep) ;
-- -- : Sub1000 -> Sub1000000 ; -- coercion of 1..999
-- pot2as3 n = n ** {s = n.s ! Indep} ;
-- -- : Sub1000 -> Sub1000000 ; -- m * 1000
-- pot3 d = pot2as3 (potNum d ribu []) ;
-- -- : Sub1000 -> Sub1000 -> Sub1000000 ; -- m * 1000 + n
-- pot3plus d e = pot2as3 (potNum d ribu (e.s ! Indep)) ;
--oper
-- ratus : Number*CardOrd => Str = table { -- 100
-- <Sg, NCard> => "seratus" ;
-- <Sg, NOrd> => "keseratus" ;
-- <Pl,_> => "ratus"
-- } ;
-- ribu : Number*CardOrd => Str = table { -- 1000
-- <Sg, NCard> => "seribu" ;
-- <Sg, NOrd> => "keseribu" ;
-- <Pl,_> => "ribu"
-- } ;
-- -- To make Sub* funs directly from a string.
-- -- ordnumeral from here
-- mkNum : Str -> LinNumber = \s -> {
-- n = Pl ;
-- s = \\_ => s ; -- Indep vs. Attrib only matters for number 1
-- ord = "ke" + s ; -- Works for all but number 1
-- } ;
-- mkDigit : Str -> OrdNum = \s -> mkNum s ** {s=s} ;
-- -- Only for Digit -> Sub*: we won't run into 1 here.
-- mkNum3 : (digit : OrdNum) -> (ten,unit : Str) -> LinNumber = \tiga,puluh,dua -> {
-- n = Pl ;
-- s = \\_ => tiga.s ++ puluh ++ dua ;
-- ord = tiga.ord ++ puluh ++ dua
-- } ;
-- -- The most general oper for making new numbers out of old ones.
-- potNum : LinNumber -> (Number*CardOrd => Str) -> Str -> LinNumber = \satu,ribuTbl,dua -> {
-- n = Pl ;
-- s = \\_ =>
-- satu.s ! Attrib ++ -- Attrib form is empty string in 1, and normal for others.
-- ribuTbl ! <satu.n, NCard> ++ dua ;
-- ord = case satu.n of {
-- Sg => satu.s ! Attrib ++ ribuTbl ! <Sg, NOrd> ++ dua ;
-- Pl => satu.ord ++ ribuTbl ! <Pl, NCard> ++ dua }
-- } ;
-- -- Numerals as sequences of digits have a separate, simpler grammar
-- lincat
-- Dig = DigNum ; -- single digit 0..9
-- lin
-- -- : Dig -> Digits ; -- 8
-- IDig d = d ;
-- -- : Dig -> Digits -> Digits ; -- 876
-- IIDig d e = {
-- s = table {
-- NCard => glue (d.s ! NCard) (e.s ! NCard) ;
-- NOrd => glue (d.s ! NOrd) (e.s ! NCard)
-- }
-- } ;
-- -- : Dig ;
-- D_0 = mkDig "0" ;
-- D_1 = mkDig "1" ;
-- D_2 = mkDig "2" ;
-- D_3 = mkDig "3" ;
-- D_4 = mkDig "4" ;
-- D_5 = mkDig "5" ;
-- D_6 = mkDig "6" ;
-- D_7 = mkDig "7" ;
-- D_8 = mkDig "8" ;
-- D_9 = mkDig "9" ;
-- oper
-- mkDig : Str -> DigNum = \s -> {
-- s = table {
-- NCard => s ;
-- NOrd => "ke-" + s
-- }
-- } ;
--}
}

166
src/tamil/ParadigmsTam.gf Normal file
View File

@@ -0,0 +1,166 @@
resource ParadigmsTam = open CatTam, ResTam, ParamTam, NounTam, Prelude in {
--oper
--2 Parameters
--
-- To abstract over number, valency and (some) case names,
-- we define the following identifiers. The application programmer
-- should always use these constants instead of the constructors
-- defined in $ResSom$.
--noPrep : Prep = mkPrep "" ;
--2 Nouns
-- mkN : overload {
-- mkN : (noun : Str) -> N ; -- Predictable nouns
-- } ;
-- mkPN : overload {
-- mkPN : Str -> PN ; -- Proper nouns
-- } ;
--2 Adjectives
-- mkA : overload {
-- mkA : (adj : Str) -> A ;
-- } ;
-- mkA2 : overload {
-- mkA2 : (adj : Str) -> Prep -> A2 ;
-- } ;
--2 Verbs
-- -- Verbs
-- mkV : overload {
-- mkV : (root : Str) -> V ; -- Verb that takes meng as a active prefix
-- mkV : (root : Str) -> Prefix -> V -- Root and prefix
-- } ;
-- mkV2 : overload {
-- mkV2 : (root : Str) -> V2 ; -- The prefix is meng and no preposition
-- mkV2 : V -> Prep -> V2 ; -- V and Prep
-- } ;
-- mkV3 : overload {
-- mkV3 : V -> V3 ; -- No prepositions
-- mkV3 : V -> Prep -> Prep -> V3 ; -- Prepositions for direct and indirect objects given
-- } ;
-- mkVV : overload {
-- mkVV : Str -> VV ;
-- } ;
-- --
-- -- mkVA : Str -> VA
-- -- = \s -> lin VA (regV s) ;
-- -- mkVQ : Str -> VQ
-- -- = \s -> lin VQ (regV s) ;
-- mkVS : overload {
-- mkV : (root : Str) -> V ; -- Verb that takes meng as a active prefix
-- mkV : (root : Str) -> Prefix -> V -- Root and prefix
-- } ;
-- --
-- -- mkV2A : Str -> V2A
-- -- = \s -> lin V2A (regV s ** {c2 = noPrep}) ;
-- -- mkV2V : Str -> V2V
-- -- = \s -> lin V2V (regV s ** {c2 = noPrep}) ;
-- -- mkV2Q : Str -> V2Q
-- -- = \s -> lin V2Q (regV s ** {c2 = noPrep}) ;
-- -----
--2 Structural categories
-- -- mkPrep = overload {
-- -- } ;
-- -- mkConj : (_,_ : Str) -> Number -> Conj = \s1,s2,num ->
-- -- lin Conj { s = s1 ; s2 = s2 } ;
-- -- mkSubj : Str -> Bool -> Subj = \s,b ->
-- -- lin Subj { } ;
-- mkAdv : Str -> Adv = \s -> lin Adv {s = s} ;
-- mkAdV : Str -> AdV = \s -> lin AdV {s = s} ;
-- mkAdA : Str -> AdA = \s -> lin AdA {s = s} ;
--.
-------------------------------------------------------------------------------
-- The definitions should not bother the user of the API. So they are
-- hidden from the document.
-- mkN = overload {
-- mkN : Str -> N = \s -> lin N (mkNoun s) ;
-- mkN : Str -> Animacy -> N = \s,a -> lin N (mkNoun s) ;
-- } ;
-- mkN2 = overload {
-- mkN2 : Str -> N2 = \s -> lin N2 (mkNoun s ** {c2 = dirPrep}) ;
-- mkN2 : N -> N2 = \n -> lin N2 (n ** {c2 = dirPrep}) ;
-- } ;
-- mkN3 = overload {
-- mkN3 : Str -> N3 = \s -> lin N3 (mkNoun s ** {c2,c3 = dirPrep}) ;
-- mkN3 : N -> N3 = \n -> lin N3 (n ** {c2,c3 = dirPrep}) ;
-- mkN3 : N -> Prep -> Prep -> N3 = \n,c2,c3 -> lin N3 (n ** {c2,c3 = dirPrep}) ;
-- } ;
-- mkPN = overload {
-- mkPN : Str -> PN = \s -> lin PN {s = \\_ => s} ;
-- } ;
-- mkA = overload {
-- mkA : (adj : Str) -> A = \s -> lin A (mkAdj s) ;
-- } ;
-- mkA2 = overload {
-- mkA2 : (adj : Str) -> A = \s -> lin A2 (mkAdj s) ;
-- mkA2 : A -> Prep -> A = \a,p -> lin A2 (a) ;
-- } ;
-- mkV = overload {
-- mkV : Str -> V = \v -> lin V (mkVerb v Ber) ;
-- mkV : Str -> Prefix -> V = \v,p -> lin V (mkVerb v p)
-- } ;
-- prefixV : V -> V = \v -> v ** {
-- s = table {
-- Root => v.s ! Active ;
-- x => v.s ! x -- TODO: how does it work with passives?
-- }
-- } ;
-- mkV2 = overload {
-- mkV2 : Str -> V2 = \v2 -> lin V2 (mkVerb2 (mkVerb v2 Meng) dirPrep) ;
-- mkV2 : V -> Prep -> V2 = \v,p -> lin V2 (mkVerb2 v p)
-- } ;
-- mkV3 = overload {
-- mkV3 : V -> V3 = \v ->
-- lin V3 (mkVerb3 v dirPrep dirPrep) ;
-- mkV3 : V -> (p,q : Prep) -> V3 = \v,p,q ->
-- lin V3 (mkVerb3 v p q)
-- } ;
-- mkV4 = overload {
-- mkV4 : Str -> Str -> V2 = \v2,str ->
-- lin V2 (mkVerb4 (mkVerb v2 Meng) dirPrep str) ;
-- mkV4 : V -> Prep -> Str -> V2 = \v,p,str -> lin V2 (mkVerb4 v p str)
-- } ;
-- mkVV = overload {
-- mkVV : Str -> VV = \vv -> lin VV (ss vv)
-- } ;
--------------------------------------------------------------------------------
--}
}

135
src/tamil/ParamTam.gf Normal file
View File

@@ -0,0 +1,135 @@
resource ParamTam = ParamX ** open Prelude in {
--------------------------------------------------------------------------------
-- Phonology
--oper
-- v : pattern Str = #("a"|"e"|"i"|"o"|"u") ;
-- diphthong : pattern Str = #("ai"|"au"|"oi") ;
-- c : pattern Str = #("m"|"n"|"ny"|"ng"
-- |"p"|"b"|"t"|"d"|"k"|"g"
-- |"s"|"z"|"c"|"j"|"sy"
-- |"f"|"v"|"kh"|"gh"|"h"
-- |"l"|"r"
-- |"w"|"y") ;
-- -- not sure if needed anywhere, this is just my standard helper function.
-- voiced : Str -> Str = \s -> case s of {
-- "k" => "g" ; "t" => "d" ; "p" => "b" ;
-- "s" => "z" ; "c" => "j" ; "kh" => "gh" ;
-- _ => s } ;
--------------------------------------------------------------------------------
-- Morphophonology
-- prefix : Prefix -> Str -> Str = \p -> case p of {
-- Meng => prefixMeng ;
-- Ber => prefixBer
-- } ;
-- prefixMeng : Str -> Str = \makan -> case makan of {
-- ? + ? + ? => "menge" + makan ;
-- (#v|"g"|"h") + _
-- => "meng" + makan ; -- prefix meng: e.g. meng+atur
-- "k" + enal
-- => "meng" + enal ; -- replace k with meng
-- "b" + _
-- => "mem" + makan ; -- prefix mem: e.g. mem+beli
-- ("p"|"f") + ikir
-- => "mem" + ikir ; -- replace p/f with mem
-- ("j"|"c"|"z"|"d") + _
-- => "men" + makan ; -- prefix men: e.g. men+jadi
-- "t" + ipu
-- => "men" + ipu ; -- replace t with men
-- "s" + alak
-- => "meny" + alak ; -- replace s with meny
-- ("r"|"l"|"w"|"y"|"m"|"n"|"ny"|"ng") + _
-- => "me" + makan ; -- prefix me
-- -- We can throw an error
-- -- _ => Predef.error "Not a valid verb root" ;
-- -- or we can let it pass with some default allomorph
-- _ => "meng" + makan
-- } ;
-- prefixBer : Str -> Str = \jalan -> case jalan of {
-- -- Exception
-- "ajar" => "belajar" ;
-- -- Drop the r
-- (#c + "er" + _ -- be+kerja
-- |"r" + _ ) -- be+rehat
-- => "be" + jalan ;
-- -- Default allomorph: ber
-- _ => "ber" + jalan
-- } ;
--------------------------------------------------------------------------------
-- Nouns
param
Case = Nom | Acc | Dat | Soc | Gen | Instr | Loc | Abl ;
-- Number = Already available from ParamX.gf under "common" folder
--------------------------------------------------------------------------------
-- Numerals
--param
-- DForm = Indep | Attrib ;
-- CardOrd = NOrd | NCard ;
NumType = NoNum Number | IsNumber ;
--oper
-- isNum : NumType -> Bool = \nt -> case nt of {
-- NoNum _ => False ;
-- _ => True
-- } ;
-- toNum : NumType -> Number = \nt -> case nt of {
-- NoNum n => n ;
-- _ => Sg
-- } ;
--------------------------------------------------------------------------------
-- Adjectives
--param
-- AForm = TODOAdj ;
--------------------------------------------------------------------------------
-- Prepositions
--param
-- PrepType = DirObj | EmptyPrep | OtherPrep ;
--------------------------------------------------------------------------------
-- Adverbs
--------------------------------------------------------------------------------
-- Verbs
param
--Tense = Already available from ParamX.gf under "common" folder
Gender = Masc | Fem | Neu | Hon | Hum ; -- Male, Female, Neuter, Honorary, Humble
VForm = VF Person Number | VFP3 Number Gender ;
--------------------------------------------------------------------------------
-- Clauses
--param
-- ClType = Statement | PolarQuestion | WhQuestion | Subord ;
--}
}

29
src/tamil/PhraseTam.gf Normal file
View File

@@ -0,0 +1,29 @@
concrete PhraseTam of Phrase = CatTam ** open Prelude, ResTam in {
-- lin
-- PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ;
-- UttS s = s ;
-- UttQS qs = qs ;
-- UttIAdv iadv = iadv ;
-- UttNP np = {s = np.s ! Bare} ;
-- UttIP ip = {s = ip.sp ! NF Sg Bare} ;
-- UttImpSg pol imp = { s = pol.s ++ imp.s ! Sg ! pol.p } ;
-- UttImpPol pol imp = {s = pol.s ++ imp.s ! Sg ! pol.p} ;
-- UttVP vp = {s = linVP vp} ;
-- UttAP ap = { s = ap.s } ;
--{-
-- UttImpPl pol imp =
-- UttAdv adv = {s = } ;
-- UttCN n = {s = } ;
-- UttCard n = {s = } ;
-- UttInterj i = i ;
---}
-- NoPConj = {s = []} ;
-- PConjConj conj = {s = conj.s1 ++ conj.s2 ! …} ;
-- NoVoc = {s = []} ;
-- VocNP np = { s = "," ++ np.s ! … } ; -}
--}
}

152
src/tamil/QuestionTam.gf Normal file
View File

@@ -0,0 +1,152 @@
concrete QuestionTam of Question = CatTam ** open
Prelude, ResTam, ParadigmsTam, (VS=VerbTam), (NM=NounTam), (SS=StructuralTam) in {
-- A question can be formed from a clause ('yes-no question') or
-- with an interrogative.
-- Interrogative pronouns can be formed with interrogative
-- determiners, with or without a noun.
--lin
-- -- : IDet -> CN -> IP ; -- which five songs
-- IdetCN idet cn = NM.DetCN idet cn ** {
-- sp = \\nf => idet.sp ! nf ++ cn.s ! nf
-- } ;
-- -- : IDet -> IP ; -- which five
-- IdetIP idet = NM.DetNP idet ** {sp = idet.sp};
-- -- : IQuant -> Num -> IDet ; -- which (five)
-- IdetQuant iquant num = iquant ** {
-- pr = num.s ++ case iquant.isPre of {True => iquant.s ; False => [] } ;
-- -- if isPre is True, then: "berapa kucing"
-- s = case iquant.isPre of { False => iquant.s ; True => [] };
-- -- if isPre is False, use s: "kucing berapa"
-- n = num.n ;
-- count = "" ;
-- } ;
-- -- : IP -> ClSlash -> QCl ; -- whom does John love
-- QuestSlash ip cls = cls ** {
-- pred = \\vf,pol => cls.pred ! vf ! pol ++ ip.s ! Bare
-- } ;
-- -- : Subj -> Pred -> QCl ;
-- -- QuestCl cl = cl ** {
-- -- pred = \\vf,pol => cl.pred ! vf ! pol
-- -- };
-- QuestCl cl = cl ** {
-- subj = "adakah" ++ cl.subj;
-- } ;
-- -- missing record fields: pred type of vp
-- -- : IP -> VP -> QCl ;
-- -- expected: ParamTam.VForm => ParamX.Polarity => Str
-- -- inferred: {s : ParamTam.VForm => ParamX.Polarity => Str}
-- QuestVP ip cl = cl ** {
-- pred = \\vf,pol => cl.s ! vf ! pol;
-- subj = ip.s ! Bare ;
-- };
-- -- : IAdv -> Cl -> QCl ; -- why does John walk
-- QuestIAdv iadv cls = {
-- subj = case iadv.isPre of {
-- True => iadv.s ++ cls.subj ; False => cls.subj
-- } ;
-- pred = \\vf,pol => case iadv.isPre of {
-- True => cls.pred ! iadv.vf ! pol ;
-- False => cls.pred ! iadv.vf ! pol ++ iadv.s
-- } ;
-- } ;
-- -- : IP -> IComp ;
-- CompIP ip = {s = ip.s ! Bare } ; -- who (is it)
-- -- : IComp -> NP -> QCl ; -- where is John?
-- QuestIComp icomp np = {
-- pred = \\vf,pol => np.s ! Bare ;
-- subj = icomp.s ;
-- } ;
-- \\vf,pol,posadv =>
-- -- {
-- -- pred = \\vf,pol => ip.s ++ vp.s ! vf ! pol;
-- -- } ;
--{- ----
-- s = \\t,a,p =>
-- let
-- cl = oldClause slash ;
-- cls : Direct -> Str =
-- \d -> cl.s ! d ! t ! a ! p ! Indic ;
---- \d -> cl.s ! ip.a ! d ! t ! a ! p ! Indic ;
-- who = slash.c2.s ++ ip.s ! slash.c2.c
-- in table {
-- QDir => who ++ cls DInv ;
-- QIndir => who ++ cls DDir
-- }
---}
--{-
-- lin
-- -- : IComp -> NP -> QCl ; -- where is John?
-- QuestIComp icomp np =
-- Interrogative pronouns can be formed with interrogative
-- determiners, with or without a noun.
-- -- : IDet -> CN -> IP ; -- which five songs
-- IdetCN idet cn = {contractSTM = False} ** NS.DetCN idet cn ;
-- -- : IDet -> IP ; -- which five
-- IdetIP idet = {contractSTM = False} ** NS.DetNP idet ;
-- They can be modified with adverbs.
-- -- : IP -> Adv -> IP ; -- who in Paris
-- --AdvIP = NS.AdvNP ;
-- Interrogative quantifiers have number forms and can take number modifiers.
-- -- : IQuant -> Num -> IDet ; -- which (five)
-- IdetQuant = NS.DetQuant ;
-- Interrogative adverbs can be formed prepositionally.
-- -- : Prep -> IP -> IAdv ; -- with whom
-- PrepIP prep ip = SS.prepIP prep (ip.s ! Abs) False ;
-- They can be modified with other adverbs.
-- -- : IAdv -> Adv -> IAdv ; -- where in Paris
-- -- AdvIAdv iadv adv =
-- Interrogative complements to copulas can be both adverbs and
-- pronouns.
-- -- : IAdv -> IComp ;
-- CompIAdv iadv = iadv ; -- where (is it)
-- More $IP$, $IDet$, and $IAdv$ are defined in $Structural$.
-- Wh questions with two or more question words require a new, special category.
-- cat
-- QVP ; -- buy what where
-- fun
-- ComplSlashIP : VPSlash -> IP -> QVP ; -- buys what
-- AdvQVP : VP -> IAdv -> QVP ; -- lives where
-- AddAdvQVP : QVP -> IAdv -> QVP ; -- buys what where
-- QuestQVP : IP -> QVP -> QCl ; -- who buys what where
---}
--}
}

25
src/tamil/README.md Normal file
View File

@@ -0,0 +1,25 @@
# Tamil
## Language info
- English name: Tamil
- Autonym: தமிழ்
- ISO code: Tam
## History
This tamil resource grammar library was started on 13th August 2022. It was copied from the Malay resource grammar library with all bodies commented out.
## Author(s)
Created and maintained by Nemo, 2022
## Publications
None
## Implementation information
### 13th August 2022
A conjugation table for verbs and an inference table for nouns have been implemented. A basic DetCN function taking a determiner and a common noun to combine to a noun phrase has also been implemented, with one determiner ("this_Quant") and one noun ("house_N") in use. Use the command "gr -cat=NP" to generate the tree.

41
src/tamil/RelativeTam.gf Normal file
View File

@@ -0,0 +1,41 @@
concrete RelativeTam of Relative = CatTam ** open
ResTam, Prelude in {
--lin
-- -- : Cl -> RCl ; -- such that John loves her
-- -- RelCl cl = cl ** {
-- -- subj = cl.subj ;
-- -- pred = cl.pred ;
-- -- };
-- -- : RP -> VP -> RCl ;
-- RelVP rp vp = {
-- subj = rp.s ;
-- pred = \\per,pol => vp.s ! Active ! pol;
-- } ;
-- -- : RP -> ClSlash -> RCl ; -- who I went with
-- RelSlash rp cls = {
-- subj = rp.s -- yang
-- ++ cls.subj ; -- aku
-- pred = \\per,pol =>
-- let object : Str = case cls.c2.prepType of {
-- OtherPrep
-- => cls.c2.obj ! per ; -- depends on the head, not known yet
-- _ => [] -- if the preposition is dir.obj or empty, no obj. pronoun
-- } ;
-- in cls.pred ! Active ! pol -- ikut sama
-- ++ object -- dengan+nya
-- } ;
-- -- : RP ;
-- IdRP = {s = "yang"} ;
-- -- Mintz page 49: aku jumpa orang /yang kaki+nya/ patah.
-- -- 'I met a man /whose foot/ was broken.'
-- -- : Prep -> NP -> RP -> RP ; -- the mother of whom
-- -- FunRP prep np rp = {} ;
--}
}

421
src/tamil/ResTam.gf Normal file
View File

@@ -0,0 +1,421 @@
resource ResTam = ParamTam ** open Prelude, Predef in {
--------------------------------------------------------------------------------
-- Nouns
oper
Noun : Type = {s: ParamX.Number => ParamTam.Case => Str} ;
-- Noun2 : Type = Noun ** {c2 : Preposition} ;
-- Noun3 : Type = Noun2 ** {c3 : Preposition} ;
CNoun : Type = Noun ;
-- heavyMod : Str ; -- heavy stuff like relative clauses after determiner
-- PNoun : Type = Noun ;
mkN : (_,_ : Str) -> Noun = \x,y -> {
s = table {
Sg => table{
Nom => x ;
Acc => x + "ai" ;
Dat => x + "ukku" ;
Soc => x + "otu" ;
Gen => x + "utaiya" ;
Instr => x + "al" ;
Loc => x + "itam" ;
Abl => x + "itamiruntu"
} ;
Pl => table{
Nom => y + "kal" ;
Acc => y + "kal" + "ai" ;
Dat => y + "kal" + "ukku" ;
Soc => y + "kal" + "otu" ;
Gen => y + "kal" + "utaiya" ;
Instr => y + "kal" + "al" ;
Loc => y + "kal" + "itam" ;
Abl => y + "kal" + "itamiruntu"
}
} ;
} ;
useN : Noun -> CNoun = \n -> n ** {
heavyMod = []
} ;
---------------------------------------------
-- Pronoun
-- Pronoun : Type = {
-- s : Str ;
-- p : Person ; -- for relative clauses
-- empty : Str ; -- need to avoid GF being silly. See https://inariksit.github.io/gf/2018/08/28/gf-gotchas.html#metavariables-or-those-question-marks-that-appear-when-parsing
-- } ;
-- mkPron : Str -> Person -> Pronoun = \str,p -> {
-- s = str ;
-- p = p ;
-- empty = []
-- } ;
---------------------------------------------
-- NP
NounPhrase : Type = {
s : Str ;
-- empty : Str ; -- need to avoid GF being silly. See https://inariksit.github.io/gf/2018/08/28/gf-gotchas.html#metavariables-or-those-question-marks-that-appear-when-parsing
} ;
-- IPhrase : Type = NounPhrase ** {
-- sp : NForm => Str ; -- standalone berapa banyak kucing
-- } ;
-- emptyNP : NounPhrase = {
-- s = \\_ => [] ;
-- a = NotPron ;
-- empty = []
-- } ;
mkNounPhrase : Str -> NounPhrase = \str -> {
s = str ;
-- a = NotPron ;
-- empty = []
} ;
-- mkIP : Str -> IPhrase = \str -> {
-- s = \\_ => str ;
-- a = NotPron ;
-- empty = [] ;
-- sp = \\_ => str ;
-- } ;
--------------------------------------------------------------------------------
-- Det, Quant, Card, Ord
Quant : Type = {
s : Str ; -- quantifier in a context, eg. 'berapa (kucing)' (Tamil: I (Nemo) am uncommenting only this part)
-- sp : NForm => Str ; -- a standalone, eg. '(kucing) berapa banyak'
-- poss : Possession ;
} ;
-- IQuant : Type = Quant ** {
-- isPre : Bool ;
-- } ;
-- linDet : Determiner -> Str = \det -> det.pr ++ det.s ;
Determiner : Type = Quant ** {
pr : Str ; -- prefix for numbers
n : NumType ; -- number as in 5 (noun in singular), Sg or Pl
count: Str ;
} ;
CardNum : Type = {
s : Str ;
} ;
Num : Type = CardNum ** {
n : NumType
} ; -- (Tamil: Necessary for DetQuant : Quant -> Num -> Det ;)
baseNum : Num = {
s = [] ;
n = NoNum Sg
} ;
-- CardOrdNum : Type = CardNum ** {
-- ord : Str
-- } ;
-- DigNum : Type = {
-- s : CardOrd => Str ;
-- } ;
baseQuant : Quant = {
s = [] ;
sp = \\_ => [] ;
-- poss = Bare ;
} ;
-- -- \\vf,pol, =>
-- -- let
-- -- verb : Str = joinVP vp tense ant pol agr ;
-- -- obj : Str = vp.s2 ! agr ;
-- -- in case ord of {
-- -- ODir => subj ++ verb ++ obj ; -- Ġanni jiekol ħut
-- -- OQuest => verb ++ obj ++ subj -- jiekol ħut Ġanni ?
-- -- }
mkQuant : Str -> Quant = \str -> baseQuant ** {
s = str ; -- (Tamil: Extra arguments leftover from Malay)
sp = \\_ => str
} ;
mkDet : Str -> Str -> Number -> Determiner = \cnt, str, num -> mkQuant str ** {
pr = "" ;
n = NoNum num ;
count = "" ;
} ;
-- mkIdet : Str -> Str -> Str -> Number -> Bool -> Determiner = \cnt, str, standalone, num, isPre -> mkDet cnt str num ** {
-- pr = case isPre of {True => str ; False => [] } ;
-- -- if isPre is True, then: "berapa kucing"
-- s = case isPre of { False => str ; True => [] };
-- count = cnt ;
-- sp = \\_ => standalone ;
-- } ;
-- -- s = \\p,a => vp.topic ++ np ++ vp.prePart ++ useVerb vp.verb ! p ! a ++ vp.compl ++ compl ;
-- -- np = vp.topic ++ np ;
-- -- vp = insertObj (ss compl) vp ;
--------------------------------------------------------------------------------
-- Prepositions
-- Preposition : Type = {
-- s : Str ; -- dengan
-- obj : Person => Str ; -- dengan+nya -- needed in relative clauses to refer to the object
-- prepType : PrepType ; -- TODO rename, the name is confusing
-- } ;
-- mkPrep : Str -> Preposition = \dengan -> {
-- s = dengan ;
-- obj = \\p => dengan + poss2str (Poss p) ;
-- prepType = OtherPrep ;
-- } ;
-- -- direct object: "hits him" -> "memukul+nya"
-- dirPrep : Preposition = {
-- s = [] ;
-- obj = table {
-- P1 => BIND ++ "ku" ;
-- P2 => BIND ++ "mu" ;
-- P3 => BIND ++ "nya" } ;
-- prepType = DirObj ;
-- } ;
-- -- truly empty
-- emptyPrep : Preposition = {
-- s = [] ;
-- obj = \\_ => [] ;
-- prepType = EmptyPrep ;
-- } ;
-- datPrep : Preposition = mkPrep "kepada" ;
-- applyPrep : Preposition -> NounPhrase -> Str = \prep,np ->
-- case <np.a, prep.prepType> of {
-- <IsPron p,OtherPrep> => prep.obj ! p ++ np.empty ;
-- _ => prep.s ++ np.s ! Bare
-- } ;
--------------------------------------------------------------------------------
-- Adjectives
-- Adjective : Type = SS ;
-- Adjective2 : Type = Adjective ;
-- mkAdj : Str -> Adjective = \str -> {s = str} ;
-- AdjPhrase : Type = Adjective ; -- ** {compar : Str} ;
--------------------------------------------------------------------------------
-- Verbs
Verb : Type = {s: Tense => VForm => Str} ;
mkVerb : (s : Str) -> Verb = \x -> {
s = table {
Past => table {
VF P1 Sg => x + "nt" + "en" ;
VF P2 Sg => x + "nt" + "ay" ;
VFP3 Sg Hon => x + "nt" + "ar" ;
VFP3 Sg Masc => x + "nt" + "an" ;
VFP3 Sg Fem => x + "nt" + "al" ;
VFP3 Sg Neu => x + "nt" + "atu" ;
VF P1 Pl => x + "nt" + "om" ;
VF P2 Pl => x + "nt" + "irkal" ;
VFP3 Pl Hum => x + "nt" + "arkal" ;
VFP3 Pl Neu => x + "nt" + "ana" ;
VF _ _ => x ;
VFP3 _ _ => x
} ;
Pres => table{
VF P1 Sg => x + "kir" + "en" ;
VF P2 Sg => x + "kir" + "ay" ;
VFP3 Sg Hon => x + "kir" + "ar" ;
VFP3 Sg Masc => x + "kir" + "an" ;
VFP3 Sg Fem => x + "kir" + "al" ;
VFP3 Sg Neu => x + "kir" + "atu" ;
VF P1 Pl => x + "kir" + "om" ;
VF P2 Pl => x + "kir" + "irkal" ;
VFP3 Pl Hum => x + "kir" + "arkal" ;
VFP3 Pl Neu => x + "kir" + "ana" ;
VF _ _ => x ;
VFP3 _ _ => x
} ;
Fut => table{
VF P1 Sg => x + "v" + "en" ;
VF P2 Sg => x + "v" + "ay" ;
VFP3 Sg Hon => x + "v" + "ar" ;
VFP3 Sg Masc => x + "v" + "an" ;
VFP3 Sg Fem => x + "v" + "al" ;
VFP3 Sg Neu => x + "v" + "atu" ;
VF P1 Pl => x + "v" + "om" ;
VF P2 Pl => x + "v" + "irkal" ;
VFP3 Pl Hum => x + "v" + "arkal" ;
VFP3 Pl Neu => x + "v" + "ana" ;
VF _ _ => x ;
VFP3 _ _ => x
} ;
Cond => table{
VF P1 Sg => x + "v" + "en" ;
VF P2 Sg => x + "v" + "ay" ;
VFP3 Sg Hon => x + "v" + "ar" ;
VFP3 Sg Masc => x + "v" + "an" ;
VFP3 Sg Fem => x + "v" + "al" ;
VFP3 Sg Neu => x + "v" + "atu" ;
VF P1 Pl => x + "v" + "om" ;
VF P2 Pl => x + "v" + "irkal" ;
VFP3 Pl Hum => x + "v" + "arkal" ;
VFP3 Pl Neu => x + "v" + "ana" ;
VF _ _ => x ;
VFP3 _ _ => x
}
} ;
} ; -- N.B. Cond is just a placeholder, it uses the Future Tamil case
-- mkVerb2 : Verb -> Preposition -> Verb2 = \v,pr -> v ** {
-- c2 = pr ;
-- passive = "di" ++ BIND ++ v.s ! Root
-- } ;
-- mkVerb3 : Verb -> (p,q : Preposition) -> Verb3 = \v,p,q ->
-- mkVerb2 v p ** {c3 = q} ;
-- mkVerb4 : Verb -> Preposition -> Str -> Verb4 = \v,pr,str -> v ** {
-- s = \\_ => v.s ! Active ++ str;
-- c2 = pr ;
-- passive = "di" ++ BIND ++ v.s ! Root ++ str
-- } ;
-- copula : Verb = {s = \\_ => "ada"} ; -- TODO
------------------
-- Adv
-- Adverb : Type = {
-- s : Str;
-- } ;
-- IAdv : Type = Adverb ** {
-- isPre : Bool ;
-- vf : VForm ;
-- } ;
------------------
-- VP
-- VerbPhrase : Type = {
-- s : VForm => Polarity => Str ; -- tidak or bukan
-- } ;
-- VPSlash : Type = VerbPhrase ** {
-- c2 : Preposition ;
-- adjCompl : Str ;
-- } ;
-- useV : Verb -> VerbPhrase = \v -> v ** {
-- s = \\vf,pol => verbneg pol ++ v.s ! vf
-- } ;
-- useComp : Str -> VerbPhrase = \s -> {
-- s = \\vf,pol => nounneg pol ++ s ;
-- } ;
-- linVP : VerbPhrase -> Str = \vp -> vp.s ! Active ! Pos;
-- https://www.reddit.com/r/indonesian/comments/gsizsv/when_to_use_tidak_bukan_jangan_belum/
-- verbneg : Polarity -> Str = \pol -> case pol of {
-- Neg => "tidak" ; -- or "tak"?
-- Pos => []
-- } ;
-- nounneg : Polarity -> Str = \pol -> case pol of {
-- Neg => "bukan" ;
-- Pos => []
-- } ;
-- impneg : Polarity -> Str = \pol -> case pol of {
-- Neg => "jangan" ;
-- Pos => []
-- } ;
--------------------------------------------------------------------------------
-- Cl, S
-- Clause : Type = {
-- subj : Str ;
-- pred : VForm => Polarity => Str -- Cl may become relative clause, need to keep open VForm
-- } ;
-- RClause : Type = {
-- subj : Str ;
-- pred : Person => Polarity => Str
-- } ;
-- RS : Type = {s : Person => Str} ;
-- ClSlash : Type = Clause ** {c2 : Preposition} ;
-- Sentence : Type = {s : Str} ;
-- predVP : NounPhrase -> VerbPhrase -> Clause = \np,vp -> {
-- subj = np.s ! Bare ;
-- pred = vp.s
-- } ;
-- predVPSlash : NounPhrase -> VPSlash -> ClSlash = \np,vps ->
-- predVP np <vps : VerbPhrase> ** {c2 = vps.c2} ;
-- -- mkClause : Str -> NounPhrase -> VPSlash -> Clause = \str,np,vp -> {
-- -- subj = str ++ np.s ! Bare;
-- -- pred = vp.s
-- -- } ;
-- -- mkClause : Str -> IPhrase -> VerbPhrase -> Clause = \str,ip,vp -> {
-- -- subj = ip.s ! Bare ;
-- -- pred = vp.s ;
-- -- } ;
-- -- baseQuant : Quant = {
-- -- s = [] ;
-- -- sp = \\_ => [] ;
-- -- poss = Bare ;
-- -- } ;
-- -- -- \\vf,pol, =>
-- -- -- let
-- -- -- verb : Str = joinVP vp tense ant pol agr ;
-- -- -- obj : Str = vp.s2 ! agr ;
-- -- -- in case ord of {
-- -- -- ODir => subj ++ verb ++ obj ; -- Ġanni jiekol ħut
-- -- -- OQuest => verb ++ obj ++ subj -- jiekol ħut Ġanni ?
-- -- -- }
-- -- mkQuant : Str -> Quant = \str -> baseQuant ** {
-- -- s = str ;
-- -- sp = \\_ => str
-- -- } ;
--------------------------------------------------------------------------------
-- linrefs
--}
}

99
src/tamil/SentenceTam.gf Normal file
View File

@@ -0,0 +1,99 @@
concrete SentenceTam of Sentence = CatTam ** open
TenseX, ResTam, (AM=AdverbTam), Prelude in {
--flags optimize=all_subs ;
--lin
--2 Clauses
-- -- : NP -> VP -> Cl
-- PredVP = predVP ;
-- -- : SC -> VP -> Cl ; -- that she goes is good (Saeed p. 94)
-- --PredSCVP sc vp = ;
--2 Clauses missing object noun phrases
-- -- : NP -> VPSlash -> ClSlash ;
-- SlashVP = predVPSlash ;
-- -- : ClSlash -> Adv -> ClSlash ; -- (whom) he sees today
-- -- AdvSlash cls adv = cls ** insertAdv adv cls ;
-- -- : Cl -> Prep -> ClSlash ; -- (with whom) he walks
-- SlashPrep cl prep = cl ** {c2 = prep} ;
--2 Imperatives
-- -- : VP -> Imp ;
-- ImpVP vp = {
-- s = \\num,pol => case pol of {
-- Neg => "jangan" ++ vp.s ! Imperative ! Pos;
-- Pos => vp.s ! Imperative ! Pos
-- }
-- } ;
-- -- : VP -> SC ;
-- EmbedVP vp = {s = vp.s ! Root ! Pos} ;
-- {-
-- -- : NP -> VS -> SSlash -> ClSlash ; -- (whom) she says that he loves
-- SlashVS np vs ss = {} ;
-- -- : Temp -> Pol -> ClSlash -> SSlash ; -- (that) she had not seen
-- UseSlash t p cls = {} ;
--2 Imperatives
-- -- : VP -> Imp ;
-- -- ImpVP vp = {s = \\num,pol => linVP (VImp num pol) Statement vp} ;
--2 Embedded sentences
-- -- : S -> SC ;
-- EmbedS s = {s = s.s ! True} ; -- choose subordinate
-- -- : QS -> SC ;
-- -- EmbedQS qs = { } ;
-- -- : VP -> SC ;
-- EmbedVP vp = {s = infVP vp} ;
---}
--2 Sentences
-- -- : Temp -> Pol -> Cl -> S ;
-- UseCl t p cl = {
-- s = cl.subj ++ t.s ++ p.s ++ cl.pred ! Active ! p.p;
-- } ;
-- -- : Temp -> Pol -> QCl -> QS ;
-- UseQCl t p cl = {
-- s = t.s ++ p.s ++ cl.subj ++ cl.pred ! Active ! p.p ;
-- } ;
-- -- : Temp -> Pol -> RCl -> RS ;
-- UseRCl t p cl = {
-- s = \\per => cl.subj ++ t.s ++ p.s ++ cl.pred ! per ! p.p ;
-- } ;
-- -- AdvS : Adv -> S -> S ; -- then I will go home
-- AdvS = advS "" ;
-- -- ExtAdvS : Adv -> S -> S ; -- next week, I will go home
-- ExtAdvS = advS (SOFT_BIND ++ ",");
-- -- : S -> Subj -> S -> S ;
-- -- SSubjS s1 subj s2 = AdvS (AM.SubjS subj s2) s1 ;
-- -- : S -> RS -> S ; -- she sleeps, which is good
-- -- RelS sent rs = advS {s = rs.s ! Sg3 Masc ++ SOFT_BIND ++ ","} sent ;
--oper
-- advS : (comma : Str) -> Adverb -> S -> S = \comma,a,sent -> sent ** {
-- s = a.s ++ comma ++ sent.s
-- } ;
--}
}

190
src/tamil/StructuralTam.gf Normal file
View File

@@ -0,0 +1,190 @@
concrete StructuralTam of Structural = CatTam **
open Prelude, ResTam, (N=NounTam), ParadigmsTam in {
-------
-- Ad*
{-
--lin almost_AdA = mkAdA "" ;
--lin almost_AdN = ss "" ;
--lin at_least_AdN = ss "" ;
--lin at_most_AdN = ss "" ;
--lin so_AdA = ss "" ;
--lin too_AdA = ss "" ;
--lin very_AdA = mkAdA "" ;
--lin as_CAdv = { s = "" ; p = [] } ;
--lin less_CAdv = { s = "" ; p = [] } ;
--lin more_CAdv = { s = "" ; p = [] } ;
--lin how8much_IAdv = ss "" ;
--lin when_IAdv = ss "" ;
---}
--lin how_IAdv = { s = "bagaimana"; isPre = True ; vf = Active } ;
--lin where_IAdv = { s = "mana"; isPre = False ; vf = Root } ;
--lin why_IAdv = {s = "mengapa"; isPre = True ; vf = Root } ;
--{-
--lin always_AdV = ss "" ;
--lin everywhere_Adv = ss "" ;
--lin here7from_Adv = ss "" ;
--lin here7to_Adv = ss "" ;
--lin here_Adv = ss "" ;
--lin quite_Adv = ss "" ;
--lin somewhere_Adv = ss "" ;
--lin there7from_Adv = ss "" ;
--lin there7to_Adv = ss "" ;
--lin there_Adv = ss "" ;
---}
-------
-- Conj
--lin and_Conj = {s2 = "dan" ; s1 = [] ; n = Pl} ;
-- lin or_Conj = {s2 = \\_ => "" ; s1 = [] ; n = Sg} ;
-- lin if_then_Conj = mkConj
-- lin both7and_DConj = mkConj "" "" pl ;
-- lin either7or_DConj = {s2 = \\_ => "" ; s1 = "" ; n = Sg} ;
--
-- lin but_PConj = ss "" ;
-- lin otherwise_PConj = ss "" ;
-- lin therefore_PConj = ss "" ;
-----------------
-- *Det and Quant
--lin how8many_IDet = mkIdet "berapa" "berapa banyak" "" Sg True;
--lin every_Det = mkDet "semua" "semua" Sg ; -- to check
--{-}
--lin all_Predet = {s = ""} ;
--lin not_Predet = { s = "" } ;
--lin only_Predet = { s = "" } ;
--lin most_Predet = {s = ""} ;
--lin few_Det = R.indefDet "" pl ;
--lin many_Det = R.indefDet "" pl ;
--lin much_Det = R.indefDet "" sg ;
--lin somePl_Det =
--lin someSg_Det =
--lin no_Quant = -}
--lin that_Quant = mkQuant "itu" ;
lin this_Quant = mkQuant "idhu" ;
--lin which_IQuant = mkQuant "yang mana" ** {isPre = False} ;
-----
-- NP
--lin somebody_NP = mkNounPhrase "seorang" ; --todo
--{-
--lin everybody_NP = defNP "" N.NumPl ;
--lin everything_NP = defNP "" N.NumSg ;
--lin nobody_NP = mkVerb; ""
--lin nothing_NP = defNP "" N.NumSg ;
--lin somebody_NP = defNP "" N.NumSg ;
--lin something_NP = defNP "" N.NumSg ;
--oper
-- defNP : Str -> Num -> NP = {} ;
---}
-------
-- Prep
-- lin above_Prep = mkPrep ""
-- lin after_Prep = mkPrep ""
-- lin before_Prep = mkPrep "" ;
-- lin behind_Prep = mkPrep "" ;
-- lin between_Prep = = mkPrep "" ;
--lin by8agent_Prep = mkPrep "oleh" ; -- for pronoun agent, see Mintz p. 170, 5.4.1
--lin by8means_Prep = mkPrep "dengan" ;
-- lin during_Prep = mkPrep ;
-- lin except_Prep = mkPrep ;
-- lin for_Prep = mkPrep ;
-- lin from_Prep = mkPrep "" ;
-- lin in8front_Prep = mkPrep "" ;
--lin in_Prep = mkPrep "di" ;
-- lin on_Prep = mkPrep "" ;
-- lin part_Prep = mkPrep ;
--lin possess_Prep = mkPrep [] ; -- TODO check Mintz p. 39-40, 2.2.1.2
-- lin through_Prep = mkPrep ;
-- lin to_Prep = mkPrep "ke" ;
--lin to_Prep =
-- let ke : Preposition = mkPrep "ke";
-- kepada : Preposition = mkPrep "kepada" ;
-- in ke ** {
-- obj = kepada.obj
-- } ;
-- lin have_V2 = let have' : V2 = mkV2 "ada" in have' ** {
-- s = \\_ => "ada" ;
-- passive = "diadakan" ;
-- } ;
-- lin under_Prep = mkPrep "" ;
--lin with_Prep = mkPrep "dengan" ;
-- lin without_Prep = mkPrep "" ;
-------
-- Pron
-- Pronouns are closed class, no constructor in ParadigmsTam.
--lin it_Pron = mkPron "dia" P3 ;
--lin i_Pron = mkPron "aku" P1 ;
--lin youPol_Pron = mkPron "kamu" P2 ;
--lin youSg_Pron = mkPron "kamu" P2 ;
--lin he_Pron = mkPron "dia" P3 ;
--lin she_Pron = mkPron "dia" P3 ;
-- inclusive we
--lin we_Pron = mkPron "kita" P1 ;
--lin youPl_Pron = mkPron "kamu" P2;
--lin they_Pron = mkPron "mereka" P3 ;
--lin whatPl_IP = ;
--lin whatSg_IP = mkIP "apa";
--lin whoPl_IP = ;
--lin whoSg_IP = mkIP "siapa";
-- expected: {s : ParamTam.Possession => Str; a : ParamTam.NPAgr;
-- empty : Str; sp : ParamTam.NForm => Str}
-------
-- Subj
-- lin although_Subj =
-- lin because_Subj =
--lin if_Subj = ss "sekiranya" ;
--lin that_Subj = ss "yang" ;
--lin when_Subj = ss "kalau" ;
------
-- Utt
--lin language_title_Utt = ss "bahasa Melayu" ;
-- lin no_Utt = ss "" ;
-- lin yes_Utt = ss "" ;
-------
-- Verb
--lin have_V2 = let have' : V2 = mkV2 "ada" in have' ** {
-- s = \\_ => "ada" ;
-- passive = "diadakan" ;
--} ;
-- lin can8know_VV = can_VV ; -- can (capacity)
--lin can_VV = mkVV "boleh" ; -- can (possibility)
--lin must_VV = mkVV "perlu" ;
--lin want_VV = mkVV "mahu" ;
------
-- Voc
--{-
--lin please_Voc = ss "" ;
---}
--}
}

51
src/tamil/SymbolTam.gf Normal file
View File

@@ -0,0 +1,51 @@
--# -path=.:../abstract:../common:../prelude
concrete SymbolTam of Symbol = CatTam **
open Prelude, ParadigmsTam, ResTam, (NM=NounTam) in {
--lin
-- -- : Symb -> PN ; -- x
-- SymbPN i = mkPN i.s ;
-- -- : Int -> PN ; -- 27
-- IntPN i = mkPN i.s ;
-- -- : Float -> PN ; -- 3.14159
-- FloatPN i = mkPN i.s ;
-- -- : Card -> PN ; -- twelve [as proper name]
-- NumPN i = mkPN i.s ;
--lin
-- CNIntNP cn i = {} ;
-- -- : Det -> CN -> [Symb] -> NP ; -- (the) (2) numbers x and y
-- CNSymbNP det cn xs =
-- let cnSymb = cn ** {heavyMod = cn.heavyMod ++ xs.s}
-- in NM.DetCN det cnSymb ;
-- -- : CN -> Card -> NP ; -- level five ; level 5
-- CNNumNP cn i = NM.MassNP (cn ** {heavyMod = cn.heavyMod ++ i.s}) ;
-- -- : Symb -> S ;
-- SymbS sy = sy ;
-- -- : Symb -> Card ;
-- SymbNum sy = sy ;
-- -- : Symb -> Ord ;
-- SymbOrd sy = sy ;
--lincat
-- Symb, [Symb] = SS ;
--lin
-- MkSymb s = s ;
-- BaseSymb = infixSS "dan" ; -- TODO check
-- ConsSymb = infixSS "," ;
--}
}

163
src/tamil/VerbTam.gf Normal file
View File

@@ -0,0 +1,163 @@
concrete VerbTam of Verb = CatTam ** open ResTam, AdverbTam, Prelude in {
--lin
-----
-- VP
-- -- : V -> VP
-- UseV = ResTam.useV ;
-- -- : V2 -> VP ; -- be loved
-- PassV2 v2 = useV {s = \\_ => v2.passive} ;
-- -- : VPSlash -> VP ;
-- -- ReflVP = ResTam.insertRefl ;
-- -- : VV -> VP -> VP ;
-- ComplVV vv vp = vp ** useV {
-- s = \\vf => vv.s ++ linVP vp
-- } ;
-- -- : VS -> S -> VP ;
-- -- ComplVS vs s =
-- -- let vps = useV vs ;
-- -- subord = SubjS {s=""} s ;
-- -- in vps ** {} ;
--{-
-- -- : VQ -> QS -> VP ;
-- ComplVQ vq qs = ;
-- -- : VA -> AP -> VP ; -- they become red
-- ComplVA va ap = ResTam.insertComp (CompAP ap).s (useV va) ;
---}
--------
-- Slash
-- -- : V2 -> VPSlash
-- SlashV2a v2 = useV v2 ** {
-- c2 = v2.c2 ;
-- adjCompl = []
-- } ;
-- -- : V3 -> NP -> VPSlash ; -- give it (to her)
-- Slash2V3 v3 dobj = useV {
-- s = \\vf => v3.s ! vf ++ applyPrep v3.c2 dobj
-- } ** {
-- c2 = v3.c3; -- Now the VPSlash is missing only the indirect object
-- adjCompl = []
-- } ;
-- -- : V3 -> NP -> VPSlash ; -- give (it) to her
-- Slash3V3 v3 iobj = useV {
-- s = \\vf => v3.s ! vf ++ applyPrep v3.c3 emptyNP ++ iobj.s ! Bare;
-- --iobj.s ! Bare -- applyPrep v3.c3 iobj -- TODO check if this works for all -- probably not
-- } ** {
-- c2 = v3.c2 ;-- Now the VPSlash is missing only the direct object
-- adjCompl = []
-- } ;
-- -- insertObjc : (Agr => Str) -> SlashVP -> SlashVP = \obj,vp ->
-- -- insertObj obj vp ** {c2 = vp.c2 ; gapInMiddle = vp.gapInMiddle ; missingAdv = vp.missingAdv } ;
-- SlashV2A v2 adj = useV {
-- s = \\vf => v2.s ! vf;
-- } ** {
-- c2 = v2.c2;
-- adjCompl = adj.s
-- } ;
-- {-
-- -- : V2S -> S -> VPSlash ; -- answer (to him) that it is good
-- SlashV2S v2s s =
-- -- : V2V -> VP -> VPSlash ; -- beg (her) to go
-- SlashV2V v2v vp = ;
-- -- : V2Q -> QS -> VPSlash ; -- ask (him) who came
-- SlashV2Q v2q qs = ;
-- -- : V2A -> AP -> VPSlash ; -- paint (it) red
-- SlashV2A v2a ap = ;
---}
-- -- : VPSlash -> NP -> VP
-- ComplSlash vps np = vps ** {
-- s = \\vf,pol =>
-- vps.s ! vf ! pol
-- ++ applyPrep vps.c2 np ++ vps.adjCompl
-- -- s = \\vf,pol => vps.s ! vf ! pol ++ applyPrep vps.c2 np
-- } ;
-- -- : VV -> VPSlash -> VPSlash ;
-- SlashVV vv vps = ComplVV vv vps ** {
-- c2 = vps.c2 ; -- like ComplVV except missing object
-- passive = vv.s ++ vps.passive;
-- adjCompl = vps.adjCompl ;
-- } ;
-- -- SlashVV vv vp = vp ** useV {
-- -- s = \\vf => vv.s ++ linVP vp ;
-- -- c2 = vp.c2 ;
-- -- passive = vv.s ++ vp.passive;
-- -- adjCompl = vp.adjCompl ;
-- -- } ;
-- -- : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy
-- -- SlashV2VNP v2v np vps =
-- -- : Comp -> VP ;
-- UseComp comp = comp ;
-- -- : VP -> Adv -> VP ; -- sleep here
-- AdvVP vp adv = vp ** {
-- s = \\vf,pol => vp.s ! vf ! pol ++ adv.s
-- } ;
-- -- : AdV -> VP -> VP ; -- always sleep
-- AdVVP adv vp = vp ** {
-- s = \\vf,pol => vp.s ! vf ! pol ++ adv.s
-- } ;
--{-
-- -- : VPSlash -> Adv -> VPSlash ; -- use (it) here
-- AdvVPSlash = insertAdv ;
-- -- : VP -> Adv -> VP ; -- sleep , even though ...
-- ExtAdvVP vp adv = ;
-- -- : AdV -> VPSlash -> VPSlash ; -- always use (it)
-- AdVVPSlash adv vps = vps ** { adv = adv.s ++ vps.adv } ;
---}
-- -- : VP -> Prep -> VPSlash ; -- live in (it)
-- -- VPSlashPrep vp prep = vp ** {c2 = prep} ;
--2 Complements to copula
-- Adjectival phrases, noun phrases, and adverbs can be used.
-- -- : AP -> Comp ;
-- CompAP ap = useComp ap.s ;
-- -- : CN -> Comp ;
-- CompCN cn = useComp (cn.s ! NF Sg Bare) ;
-- -- NP -> Comp ;
-- CompNP np = useComp (np.s ! Bare) ;
-- -- : Adv -> Comp ;
-- --"Both bukan and tidak may negate prepositional phrases. The choice of either
-- --depends on whether it is the noun within the phrase that is being negated
-- --or the implied verb associated with the phrase." Mintz p. 281 (10.1.4)
-- CompAdv adv = useV {s = \\_ => adv.s} ;
-- -- : VP -- Copula alone;
-- UseCopula = useV copula ;
--}
}