forked from GitHub/gf-rgl
Merge master into prepDefArt
This commit is contained in:
BIN
src/FileHierarchy.png
Normal file
BIN
src/FileHierarchy.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
78
src/README.md
Normal file
78
src/README.md
Normal 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.
|
||||
|
||||

|
||||
|
||||
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.
|
||||
@@ -126,7 +126,10 @@ abstract Cat = Common ** {
|
||||
N ; -- common noun e.g. "house"
|
||||
N2 ; -- relational noun e.g. "son"
|
||||
N3 ; -- three-place relational noun e.g. "connection"
|
||||
PN ; -- proper name e.g. "Paris"
|
||||
GN ; -- given name e.g. "George"
|
||||
SN ; -- second name e.g. "Washington"
|
||||
LN ; -- location name e.g. "Sweden"
|
||||
PN ; -- proper name
|
||||
|
||||
-- DEPRECATED: QuantSg, QuantPl
|
||||
--- QuantSg ;-- quantifier ('nucleus' of sing. Det) e.g. "every"
|
||||
|
||||
@@ -44,4 +44,8 @@ abstract Common = {
|
||||
Pol ; -- polarity e.g. positive, negative
|
||||
Ant ; -- anteriority e.g. simultaneous, anterior
|
||||
|
||||
--2 Measures
|
||||
|
||||
MU ; -- unit of measurement e.g. "km", "cm", "%"
|
||||
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@ fun
|
||||
InflectionN2 : N2 -> Inflection ;
|
||||
InflectionN3 : N3 -> Inflection ;
|
||||
InflectionPN : PN -> Inflection ;
|
||||
InflectionGN : GN -> Inflection ;
|
||||
InflectionSN : SN -> Inflection ;
|
||||
InflectionA : A -> Inflection ;
|
||||
InflectionA2 : A2 -> Inflection ;
|
||||
InflectionV : V -> Inflection ;
|
||||
|
||||
@@ -267,6 +267,7 @@ abstract Extend = Cat ** {
|
||||
weFem_Pron : Pron ; -- we (Fem)
|
||||
youPlFem_Pron : Pron ; -- you plural (Fem)
|
||||
theyFem_Pron : Pron ; -- they (Fem)
|
||||
theyNeutr_Pron : Pron ; -- they (Neutr)
|
||||
youPolFem_Pron : Pron ; -- you polite (Fem)
|
||||
youPolPl_Pron : Pron ; -- you polite plural (Masc)
|
||||
youPolPlFem_Pron : Pron ; -- you polite plural (Fem)
|
||||
@@ -289,7 +290,14 @@ fun UseDAP : DAP -> NP ;
|
||||
|
||||
cat X ; -- for words that are difficult to classify, mainly for MorphoDict
|
||||
|
||||
fun
|
||||
UseComp_estar : Comp -> VP ; -- esta lleno, as opposed to es lleno
|
||||
UseComp_ser : Comp -> VP ; -- es lleno, as opposed to esta lleno
|
||||
|
||||
fun
|
||||
CardCNCard : Card -> CN -> Card ; -- three million, four lakh, six dozen etc
|
||||
|
||||
fun
|
||||
AnaphPron : NP -> Pron ;
|
||||
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ abstract Grammar =
|
||||
Structural,
|
||||
Idiom,
|
||||
Tense,
|
||||
Names,
|
||||
Transfer
|
||||
;
|
||||
|
||||
|
||||
14
src/abstract/Names.gf
Normal file
14
src/abstract/Names.gf
Normal file
@@ -0,0 +1,14 @@
|
||||
abstract Names = Cat ** {
|
||||
|
||||
fun GivenName : GN -> NP ;
|
||||
MaleSurname : SN -> NP ;
|
||||
FemaleSurname : SN -> NP ;
|
||||
PlSurname : SN -> NP ;
|
||||
FullName : GN -> SN -> NP ;
|
||||
|
||||
fun UseLN : LN -> NP ;
|
||||
PlainLN : LN -> NP ;
|
||||
InLN : LN -> Adv ;
|
||||
AdjLN : AP -> LN -> LN ;
|
||||
|
||||
}
|
||||
@@ -58,6 +58,7 @@ abstract Noun = Cat ** {
|
||||
|
||||
data
|
||||
NumDigits : Digits -> Card ; -- 51
|
||||
NumFloat : Digits -> Digits -> Card ; -- 3.14
|
||||
NumNumeral : Numeral -> Card ; -- fifty-one
|
||||
|
||||
-- The construction of numerals is defined in [Numeral Numeral.html].
|
||||
@@ -155,4 +156,9 @@ abstract Noun = Cat ** {
|
||||
AdjDAP : DAP -> AP -> DAP ; -- the large (one)
|
||||
DetDAP : Det -> DAP ; -- this (or that)
|
||||
|
||||
--2 Quantities
|
||||
|
||||
QuantityNP : Digits -> MU -> NP ;
|
||||
QuantityFloatNP : Digits -> Digits -> MU -> NP ;
|
||||
|
||||
}
|
||||
|
||||
@@ -20,11 +20,13 @@
|
||||
abstract Numeral = Cat [Numeral,Digits] ** {
|
||||
|
||||
cat
|
||||
Digit ; -- 2..9
|
||||
Sub10 ; -- 1..9
|
||||
Sub100 ; -- 1..99
|
||||
Sub1000 ; -- 1..999
|
||||
Sub1000000 ; -- 1..999999
|
||||
Digit ; -- 2..9
|
||||
Sub10 ; -- 1..9
|
||||
Sub100 ; -- 1..99
|
||||
Sub1000 ; -- 1..999
|
||||
Sub1000000 ; -- 1..999999
|
||||
Sub1000000000 ; -- 1..999999999
|
||||
Sub1000000000000 ; -- 1..999999999999
|
||||
|
||||
data
|
||||
num : Sub1000000 -> Numeral ; -- 123456 [coercion to top category]
|
||||
@@ -33,18 +35,36 @@ data
|
||||
|
||||
pot01 : Sub10 ; -- 1
|
||||
pot0 : Digit -> Sub10 ; -- d * 1
|
||||
pot0as1 : Sub10 -> Sub100 ; -- coercion of 1..9
|
||||
|
||||
pot110 : Sub100 ; -- 10
|
||||
pot111 : Sub100 ; -- 11
|
||||
pot1to19 : Digit -> Sub100 ; -- 10 + d
|
||||
pot0as1 : Sub10 -> Sub100 ; -- coercion of 1..9
|
||||
pot1 : Digit -> Sub100 ; -- d * 10
|
||||
pot1plus : Digit -> Sub10 -> Sub100 ; -- d * 10 + n
|
||||
pot1as2 : Sub100 -> Sub1000 ; -- coercion of 1..99
|
||||
|
||||
pot21 : Sub1000 ; -- a hundred instead of one hundred
|
||||
pot2 : Sub10 -> Sub1000 ; -- m * 100
|
||||
pot2plus : Sub10 -> Sub100 -> Sub1000 ; -- m * 100 + n
|
||||
pot2as3 : Sub1000 -> Sub1000000 ; -- coercion of 1..999
|
||||
|
||||
pot31 : Sub1000000 ; -- a thousand instead of one thousand
|
||||
pot3 : Sub1000 -> Sub1000000 ; -- m * 1000
|
||||
pot3plus : Sub1000 -> Sub1000 -> Sub1000000 ; -- m * 1000 + n
|
||||
pot3as4 : Sub1000000 -> Sub1000000000 ; -- coercion of 1..999999
|
||||
pot3float : Float -> Sub1000000 ; -- 3.5 thousand
|
||||
|
||||
pot41 : Sub1000000000 ; -- a million instead of one million
|
||||
pot4 : Sub1000 -> Sub1000000000 ; -- m * 1000000000
|
||||
pot4plus : Sub1000 -> Sub1000000 -> Sub1000000000 ; -- m * 1000000000 + n
|
||||
pot4as5 : Sub1000000000 -> Sub1000000000000 ; -- coercion of 1..999999999
|
||||
pot4float : Float -> Sub1000000000 ; -- 3.5 million
|
||||
|
||||
pot51 : Sub1000000000000 ; -- a billion instead of one billion
|
||||
pot5 : Sub1000 -> Sub1000000000000 ; -- m * 1000000000
|
||||
pot5plus : Sub1000 -> Sub1000000000 -> Sub1000000000000 ; -- m * 1000000000 + n
|
||||
pot5float : Float -> Sub1000000000000 ; -- 3.5 billion
|
||||
|
||||
-- Numerals as sequences of digits have a separate, simpler grammar
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
concrete AllAfr of AllAfrAbs =
|
||||
LangAfr,
|
||||
IrregAfr,
|
||||
ExtraAfr
|
||||
ExtendAfr
|
||||
**
|
||||
{
|
||||
--{} ;
|
||||
|
||||
@@ -83,6 +83,6 @@ concrete CatAfr of Cat =
|
||||
N = Noun ;
|
||||
N2 = {s : NForm => Str ; g : Gender} ** {c2 : Preposition} ;
|
||||
N3 = {s : NForm => Str ; g : Gender} ** {c2,c3 : Preposition} ;
|
||||
PN = {s : NPCase => Str} ;
|
||||
GN, SN, LN, PN = {s : NPCase => Str} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -28,6 +28,18 @@ lin
|
||||
s2 = paragraph (pn.s ! NPNom)
|
||||
} ;
|
||||
|
||||
InflectionGN = \pn -> {
|
||||
t = "vnm" ;
|
||||
s1 = heading1 "Voornaam" ;
|
||||
s2 = paragraph (pn.s ! NPNom)
|
||||
} ;
|
||||
|
||||
InflectionSN = \pn -> {
|
||||
t = "van" ;
|
||||
s1 = heading1 "Van" ;
|
||||
s2 = paragraph (pn.s ! NPNom)
|
||||
} ;
|
||||
|
||||
InflectionA, InflectionA2 = \adj ->
|
||||
let
|
||||
gforms : AForm -> Str = \a ->
|
||||
|
||||
15
src/afrikaans/ExtendAfr.gf
Normal file
15
src/afrikaans/ExtendAfr.gf
Normal file
@@ -0,0 +1,15 @@
|
||||
concrete ExtendAfr of Extend =
|
||||
CatAfr ** ExtendFunctor - [PassVPSlash,PassAgentVPSlash]
|
||||
with
|
||||
(Grammar = GrammarAfr) **
|
||||
|
||||
open
|
||||
ParadigmsAfr, ResAfr in {
|
||||
|
||||
-- KA: guessed from PassV2 in Afrikaans and the equivalents in Dutch
|
||||
lin PassVPSlash vps =
|
||||
insertInf (vps.s.s ! VPerf) (predV word_V) ;
|
||||
PassAgentVPSlash vps np =
|
||||
insertAdv (appPrep "door" np.s) (insertInf (vps.s.s ! VPerf) (predV word_V)) ;
|
||||
|
||||
}
|
||||
@@ -14,4 +14,5 @@ concrete GrammarAfr of Grammar =
|
||||
TextX,
|
||||
IdiomAfr,
|
||||
StructuralAfr,
|
||||
TenseX ;
|
||||
TenseX,
|
||||
NamesAfr ;
|
||||
|
||||
6
src/afrikaans/NamesAfr.gf
Normal file
6
src/afrikaans/NamesAfr.gf
Normal file
@@ -0,0 +1,6 @@
|
||||
concrete NamesAfr of Names = CatAfr ** open ResAfr, Prelude in {
|
||||
|
||||
lin GivenName, MaleSurname, FemaleSurname = \n -> {s = n.s ; a = agrP3 Sg ; isPron = False} ;
|
||||
lin FullName gn sn =
|
||||
{s = \\c => gn.s ! NPNom ++ sn.s ! c ; a = agrP3 Sg ; isPron = False} ;
|
||||
}
|
||||
@@ -77,6 +77,8 @@ concrete NounAfr of Noun = CatAfr ** open ResAfr, Prelude in {
|
||||
NumDigits numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ;
|
||||
OrdDigits numeral = {s = \\af => numeral.s ! NOrd af} ;
|
||||
|
||||
NumFloat n1 n2 = {s = \\g,c => n1.s ! NCard Neutr Nom ++ BIND ++ "." ++ BIND ++ n1.s ! NCard g c; n = Pl } ;
|
||||
|
||||
NumNumeral numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ;
|
||||
OrdNumeral numeral = {s = \\af => numeral.s ! NOrd af} ;
|
||||
|
||||
@@ -177,4 +179,16 @@ concrete NounAfr of Noun = CatAfr ** open ResAfr, Prelude in {
|
||||
isMod = cn.isMod
|
||||
} ;
|
||||
|
||||
QuantityNP n m = {
|
||||
s = \\c => preOrPost m.isPre m.s (n.s ! NCard Neutr Nom) ;
|
||||
a = agrP3 n.n ;
|
||||
isPron = False
|
||||
} ;
|
||||
|
||||
QuantityFloatNP n1 n2 m = {
|
||||
s = \\c => preOrPost m.isPre m.s (n1.s ! NCard Neutr Nom ++ BIND ++ "." ++ BIND ++ n1.s ! NCard Neutr Nom) ;
|
||||
a = agrP3 Pl ;
|
||||
isPron = False
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ flags optimize = all_subs ;
|
||||
lincat
|
||||
Digit = {s : DForm => CardOrd => Str ; en : Str} ;
|
||||
Sub10 = {s : DForm => CardOrd => Str ; n : Number ; en : Str ; attr : Str} ;
|
||||
Sub100, Sub1000, Sub1000000 =
|
||||
Sub100, Sub1000, Sub1000000, Sub1000000000, Sub1000000000000 =
|
||||
{s : CardOrd => Str ; n : Number ; attr : Str} ;
|
||||
|
||||
lin
|
||||
@@ -50,6 +50,8 @@ lin
|
||||
pot3plus n m =
|
||||
addAttr {s = \\g => n.attr ++ "duisend" ++ m.s ! g ; n = Pl} ;
|
||||
|
||||
pot3as4 n = n ;
|
||||
pot4as5 n = n ;
|
||||
|
||||
lincat
|
||||
Dig = TDigit ;
|
||||
|
||||
@@ -494,4 +494,6 @@ oper
|
||||
--
|
||||
--}
|
||||
|
||||
mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -323,8 +323,8 @@ concrete ExtraGrc of ExtraGrcAbs = CatGrc, NumeralGrc[Sub1000000,tenthousand] **
|
||||
Sub10000 = {s : CardOrd => Str ; n : Number} ; -- TODO: constructors
|
||||
|
||||
lin -- d * 10000
|
||||
pot4 d = { s = \\f => d.s ! NAdv ++ (tenthousand ! f) ; n = Pl } ;
|
||||
pot4plus d m = {
|
||||
pot3X d = { s = \\f => d.s ! NAdv ++ (tenthousand ! f) ; n = Pl } ;
|
||||
pot3Xplus d m = {
|
||||
s = \\f => d.s ! NAdv ++ tenthousand ! f ++ "kai`" ++ m.s ! f ; n = Pl} ;
|
||||
|
||||
|
||||
|
||||
@@ -153,8 +153,8 @@ abstract ExtraGrcAbs = Extra, Numeral[Sub1000000] ** {
|
||||
Sub10000 ; -- 1..9999
|
||||
|
||||
data
|
||||
pot4 : Sub10000 -> Sub1000000 ; -- m * 10000
|
||||
pot4plus : Sub10000 -> Sub10000 -> Sub1000000 ; -- m * 10000 + n
|
||||
pot3X : Sub10000 -> Sub1000000 ; -- m * 10000
|
||||
pot3Xplus : Sub10000 -> Sub10000 -> Sub1000000 ; -- m * 10000 + n
|
||||
|
||||
-- Conjunctions:
|
||||
|
||||
|
||||
@@ -5,9 +5,11 @@ concrete NumeralGrc of Numeral = CatGrc ** open ResGrc, MorphoGrc in {
|
||||
lincat
|
||||
Digit = {s : DForm => CardOrd => Str} ;
|
||||
Sub10 = {s : DForm => CardOrd => Str ; n : Number} ;
|
||||
Sub100 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000000 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub100 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000000 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000000000 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000000000000 = {s : CardOrd => Str ; n : Number} ;
|
||||
|
||||
lin num x = x ;
|
||||
|
||||
@@ -52,6 +54,8 @@ lin -- mkDigit d (d+10) (d*10) d-th d-times
|
||||
pot3plus d m = {
|
||||
s = \\f => d.s ! NAdv ++ thousand ! f ++ "kai`" ++ m.s ! f ; n = Pl} ;
|
||||
|
||||
pot3as4 n = n ;
|
||||
pot4as5 n = n ;
|
||||
|
||||
-- numerals as sequences of digits
|
||||
|
||||
|
||||
9
src/api/CombinatorsHrv.gf
Normal file
9
src/api/CombinatorsHrv.gf
Normal file
@@ -0,0 +1,9 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource CombinatorsHrv = Combinators with
|
||||
(Cat = CatHrv),
|
||||
(Structural = StructuralHrv),
|
||||
(Constructors = ConstructorsHrv)
|
||||
** open MissingHrv in {}
|
||||
|
||||
|
||||
9
src/api/CombinatorsTam.gf
Normal file
9
src/api/CombinatorsTam.gf
Normal file
@@ -0,0 +1,9 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource CombinatorsTam = Combinators - [ appCN, appCNc ] with
|
||||
(Cat = CatTam),
|
||||
(Structural = StructuralTam),
|
||||
(Noun = NounTam),
|
||||
(Constructors = ConstructorsTam) **
|
||||
{}
|
||||
}
|
||||
@@ -121,9 +121,9 @@ incomplete resource Constructors = open Grammar in { --%
|
||||
mkText : QS -> Text -- Did she sleep?
|
||||
= \q -> TQuestMark (PhrUtt NoPConj (UttQS q) NoVoc) TEmpty ; --%
|
||||
mkText : (Pol) -> Imp -> Text -- Don't sleep!
|
||||
= \p,i -> TExclMark (PhrUtt NoPConj (UttImpSg p i) NoVoc) TEmpty; --%
|
||||
= \p,i -> TExclMark (PhrUtt NoPConj (UttImpSg p i) NoVoc) TEmpty ; --%
|
||||
mkText : Imp -> Text -- Sleep! --%
|
||||
= \i -> TExclMark (PhrUtt NoPConj (UttImpSg PPos i) NoVoc) TEmpty; --%
|
||||
= \i -> TExclMark (PhrUtt NoPConj (UttImpSg PPos i) NoVoc) TEmpty ; --%
|
||||
|
||||
-- Finally, two texts can be combined into a text.
|
||||
|
||||
@@ -374,11 +374,11 @@ incomplete resource Constructors = open Grammar in { --%
|
||||
mkCl = overload {
|
||||
|
||||
mkCl : NP -> V -> Cl -- she sleeps
|
||||
= \s,v -> PredVP s (UseV v); --%
|
||||
= \s,v -> PredVP s (UseV v) ; --%
|
||||
mkCl : NP -> V2 -> NP -> Cl -- she loves him
|
||||
= \s,v,o -> PredVP s (ComplV2 v o); --%
|
||||
= \s,v,o -> PredVP s (ComplV2 v o) ; --%
|
||||
mkCl : NP -> V3 -> NP -> NP -> Cl -- she sends it to him
|
||||
= \s,v,o,i -> PredVP s (ComplV3 v o i); --%
|
||||
= \s,v,o,i -> PredVP s (ComplV3 v o i) ; --%
|
||||
mkCl : NP -> VV -> VP -> Cl -- she wants to sleep
|
||||
= \s,v,vp -> PredVP s (ComplVV v vp) ; --%
|
||||
mkCl : NP -> VS -> S -> Cl -- she says that she sleeps
|
||||
@@ -1006,9 +1006,9 @@ incomplete resource Constructors = open Grammar in { --%
|
||||
|
||||
|
||||
mkCN : A -> N -> CN -- big house
|
||||
= \x,y -> AdjCN (PositA x) (UseN y); --%
|
||||
= \x,y -> AdjCN (PositA x) (UseN y) ; --%
|
||||
mkCN : A -> CN -> CN -- big blue house
|
||||
= \x,y -> AdjCN (PositA x) y; --%
|
||||
= \x,y -> AdjCN (PositA x) y ; --%
|
||||
mkCN : AP -> N -> CN -- very big house
|
||||
= \x,y -> AdjCN x (UseN y) ; --%
|
||||
mkCN : AP -> CN -> CN -- very big blue house
|
||||
@@ -1211,11 +1211,11 @@ incomplete resource Constructors = open Grammar in { --%
|
||||
mkQCl : IP -> VP -> QCl -- who sleeps --:
|
||||
= QuestVP ; --%
|
||||
mkQCl : IP -> V -> QCl -- who sleeps
|
||||
= \s,v -> QuestVP s (UseV v); --%
|
||||
= \s,v -> QuestVP s (UseV v) ; --%
|
||||
mkQCl : IP -> V2 -> NP -> QCl -- who loves her
|
||||
= \s,v,o -> QuestVP s (ComplV2 v o); --%
|
||||
= \s,v,o -> QuestVP s (ComplV2 v o) ; --%
|
||||
mkQCl : IP -> V3 -> NP -> NP -> QCl -- who sends it to her
|
||||
= \s,v,o,i -> QuestVP s (ComplV3 v o i); --%
|
||||
= \s,v,o,i -> QuestVP s (ComplV3 v o i) ; --%
|
||||
mkQCl : IP -> VV -> VP -> QCl -- who wants to sleep
|
||||
= \s,v,vp -> QuestVP s (ComplVV v vp) ; --%
|
||||
mkQCl : IP -> VS -> S -> QCl -- who says that she sleeps
|
||||
@@ -1408,11 +1408,11 @@ incomplete resource Constructors = open Grammar in { --%
|
||||
= RelVP ; --%
|
||||
|
||||
mkRCl : RP -> V -> RCl -- who sleeps
|
||||
= \s,v -> RelVP s (UseV v); --%
|
||||
= \s,v -> RelVP s (UseV v) ; --%
|
||||
mkRCl : RP -> V2 -> NP -> RCl -- who loves her
|
||||
= \s,v,o -> RelVP s (ComplV2 v o); --%
|
||||
= \s,v,o -> RelVP s (ComplV2 v o) ; --%
|
||||
mkRCl : RP -> V3 -> NP -> NP -> RCl -- who sends it to her
|
||||
= \s,v,o,i -> RelVP s (ComplV3 v o i); --%
|
||||
= \s,v,o,i -> RelVP s (ComplV3 v o i) ; --%
|
||||
mkRCl : RP -> VV -> VP -> RCl -- who wants to sleep
|
||||
= \s,v,vp -> RelVP s (ComplVV v vp) ; --%
|
||||
mkRCl : RP -> VS -> S -> RCl -- who says that she sleeps
|
||||
|
||||
5
src/api/ConstructorsHrv.gf
Normal file
5
src/api/ConstructorsHrv.gf
Normal file
@@ -0,0 +1,5 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource ConstructorsHrv = Constructors with (Grammar = GrammarHrv)
|
||||
** open MissingHrv in {}
|
||||
|
||||
5
src/api/ConstructorsTam.gf
Normal file
5
src/api/ConstructorsTam.gf
Normal file
@@ -0,0 +1,5 @@
|
||||
--# -path=.:alltenses:prelude:../tamil
|
||||
|
||||
resource ConstructorsTam = Constructors with (Grammar = GrammarTam) **
|
||||
open MissingTam in {} ;
|
||||
}
|
||||
6
src/api/SymbolicHrv.gf
Normal file
6
src/api/SymbolicHrv.gf
Normal file
@@ -0,0 +1,6 @@
|
||||
--# -path=.:../slovak:../common:../abstract:../prelude
|
||||
|
||||
resource SymbolicHrv = Symbolic with
|
||||
(Symbol = SymbolHrv),
|
||||
(Grammar = GrammarHrv)
|
||||
** open MissingHrv in {}
|
||||
6
src/api/SymbolicTam.gf
Normal file
6
src/api/SymbolicTam.gf
Normal file
@@ -0,0 +1,6 @@
|
||||
--# -path=.:../tamil:../common:../abstract:../prelude
|
||||
|
||||
resource SymbolicTam = Symbolic with
|
||||
(Symbol = SymbolTam),
|
||||
(Grammar = GrammarTam) ** open MissingTam in {} ;
|
||||
}
|
||||
4
src/api/SyntaxHrv.gf
Normal file
4
src/api/SyntaxHrv.gf
Normal file
@@ -0,0 +1,4 @@
|
||||
--# -path=.:./alltenses:../prelude
|
||||
|
||||
instance SyntaxHrv of Syntax =
|
||||
ConstructorsHrv, CatHrv, StructuralHrv, CombinatorsHrv ;
|
||||
6
src/api/SyntaxTam.gf
Normal file
6
src/api/SyntaxTam.gf
Normal file
@@ -0,0 +1,6 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
instance SyntaxTam of Syntax =
|
||||
ConstructorsTam, CatTam, StructuralTam, CombinatorsTam ;
|
||||
|
||||
}
|
||||
13
src/api/TryHrv.gf
Normal file
13
src/api/TryHrv.gf
Normal file
@@ -0,0 +1,13 @@
|
||||
--# -path=.:../slovak:../common:../abstract:../prelude
|
||||
|
||||
resource TryHrv = SyntaxHrv, LexiconHrv, ParadigmsHrv -[mkAdv, mkAdN, mkOrd, mkDet, mkQuant]**
|
||||
open (P = ParadigmsHrv) in {
|
||||
|
||||
-- oper
|
||||
|
||||
-- mkAdv = overload SyntaxHrv {
|
||||
-- mkAdv : Str -> Adv = P.mkAdv ;
|
||||
-- } ;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
--# -path=.:../russian:../common:../abstract:../prelude
|
||||
|
||||
resource TryRus = SyntaxRus, LexiconRus, ParadigmsRus - [mkAdv,mkIAdv,mkOrd] ;
|
||||
resource TryRus = SyntaxRus, LexiconRus, ParadigmsRus - [mkAdv,mkIAdv,mkOrd,mkAdN] ;
|
||||
|
||||
4
src/api/TryTam.gf
Normal file
4
src/api/TryTam.gf
Normal file
@@ -0,0 +1,4 @@
|
||||
--# -path=.:../tamil :../common:../abstract:../prelude
|
||||
|
||||
resource TryTam = SyntaxTam, LexiconTam, ParadigmsTam - [mkAdv,mkAdN,mkOrd,mkNum] ;
|
||||
}
|
||||
@@ -81,7 +81,7 @@ incomplete concrete CatBantu of Cat =
|
||||
-- N2 = {s : Number => Case => Str ; g : Gender} ** {c2 : Str} ;
|
||||
N2 = {s : Number => Case => Str ; g : Gender} ** {c2 : Prep} ;
|
||||
N3 = {s : Number => Case => Str ; g : Gender} ** {c2,c3 : Prep} ;
|
||||
PN = {s : Case => Str ; g : Gender} ;
|
||||
GN, SN, LN, PN = {s : Case => Str ; g : Gender} ;
|
||||
--Tense = {s : Str ; t : ResKam.Tense} ;
|
||||
|
||||
linref
|
||||
|
||||
@@ -86,7 +86,9 @@ concrete CatBul of Cat = CommonX - [IAdv,AdV] ** open ResBul, Prelude, Predef, (
|
||||
N = {s : NForm => Str; rel : AForm => Str; relType : NRelType; g : AGender} ;
|
||||
N2 = {s : NForm => Str; rel : AForm => Str; relType : NRelType; g : AGender} ** {c2 : Preposition} ;
|
||||
N3 = {s : NForm => Str; rel : AForm => Str; relType : NRelType; g : AGender} ** {c2,c3 : Preposition} ;
|
||||
PN = {s : Str; gn : GenNum} ;
|
||||
GN = {s : Str; g : Sex} ;
|
||||
SN = {s : Sex => Str; pl : Str} ;
|
||||
LN, PN = {s : Str; gn : GenNum} ;
|
||||
|
||||
lindef
|
||||
SSlash = \s -> {s = \\_ => s; c2 = {s=""; c=Acc}};
|
||||
|
||||
@@ -92,6 +92,26 @@ lin
|
||||
s3 = ""
|
||||
} ;
|
||||
|
||||
InflectionGN = \gn -> {
|
||||
t = "същ.с.л." ;
|
||||
s1= heading1 (case gn.g of {
|
||||
Male => "Мъжко Име" ;
|
||||
Female => "Женско Име"
|
||||
}) ;
|
||||
s2 = gn.s ;
|
||||
s3 = ""
|
||||
} ;
|
||||
|
||||
InflectionSN = \sn -> {
|
||||
t = "същ.с.ф." ;
|
||||
s1= heading1 ("Фамилно Име") ;
|
||||
s2 = frameTable (
|
||||
tr (th "мъжко" ++ td (sn.s ! Male)) ++
|
||||
tr (th "женско" ++ td (sn.s ! Female)) ++
|
||||
tr (th "семейно" ++ td sn.pl)) ;
|
||||
s3 = ""
|
||||
} ;
|
||||
|
||||
InflectionA, InflectionA2 = \a -> {
|
||||
t = "пр" ;
|
||||
s1= heading1 ("Прилагателно") ;
|
||||
|
||||
@@ -300,5 +300,22 @@ lin UseDAP dap = {
|
||||
p = NounP3 dap.p
|
||||
} ;
|
||||
|
||||
lin UseComp_estar = UseComp ;
|
||||
UseComp_ser = UseComp ;
|
||||
|
||||
lin ProDrop pro = pro ;
|
||||
|
||||
lin AnaphPron np =
|
||||
case <np.gn, np.p> of {
|
||||
<GSg _, PronP1> => i_Pron ;
|
||||
<GSg _, PronP2> => youSg_Pron ;
|
||||
<GSg Masc, _> => he_Pron ;
|
||||
<GSg Fem, _> => she_Pron ;
|
||||
<GSg Neutr, _> => it_Pron ;
|
||||
<GPl, PronP1> => we_Pron ;
|
||||
<GPl, PronP2> => youPl_Pron ;
|
||||
<GPl, _> => they_Pron
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,8 @@ concrete GrammarBul of Grammar =
|
||||
TextBul,
|
||||
StructuralBul,
|
||||
IdiomBul,
|
||||
TenseX - [CAdv,IAdv,AdV,SC]
|
||||
TenseX - [CAdv,IAdv,AdV,SC],
|
||||
NamesBul
|
||||
** {
|
||||
flags coding=utf8 ;
|
||||
|
||||
|
||||
@@ -266,7 +266,25 @@ oper
|
||||
|
||||
--2 Proper Names
|
||||
--
|
||||
|
||||
masculine : Gender = Masc ;
|
||||
feminine : Gender = Fem ;
|
||||
neutr : Gender = Neut ;
|
||||
|
||||
male : Sex = Male ;
|
||||
female : Sex = Female ;
|
||||
|
||||
mkGN : Str -> Sex -> GN =
|
||||
\s,g -> lin GN {s = s; g = g} ;
|
||||
mkSN = overload {
|
||||
mkSN : Str -> SN =
|
||||
\s -> lin SN {s = \\_ => s; pl = s} ;
|
||||
mkSN : Str -> Str -> Str -> SN =
|
||||
\m,f,pl -> lin SN {s = table Sex [m; f]; pl = pl} ;
|
||||
} ;
|
||||
|
||||
mkPN = overload {
|
||||
mkPN : Str -> PN = \s -> {s = s; gn = GSg Masc ; lock_PN = <>} ;
|
||||
mkPN : Str -> Gender -> PN =
|
||||
\s,g -> {s = s; gn = GSg g ; lock_PN = <>} ;
|
||||
mkPN : Str -> GenNum -> PN =
|
||||
|
||||
39
src/bulgarian/NamesBul.gf
Normal file
39
src/bulgarian/NamesBul.gf
Normal file
@@ -0,0 +1,39 @@
|
||||
concrete NamesBul of Names = CatBul ** open ResBul in {
|
||||
|
||||
lin GivenName = \n -> {
|
||||
s = table { RObj c => linCase c Pos ++ n.s;
|
||||
_ => n.s
|
||||
} ;
|
||||
gn = GSg (sex2gender n.g) ;
|
||||
p = NounP3 Pos
|
||||
} ;
|
||||
lin MaleSurname = \n -> {
|
||||
s = table { RObj c => linCase c Pos ++ n.s ! Male;
|
||||
_ => n.s ! Male
|
||||
} ;
|
||||
gn = GSg Masc ;
|
||||
p = NounP3 Pos
|
||||
} ;
|
||||
lin FemaleSurname = \n -> {
|
||||
s = table { RObj c => linCase c Pos ++ n.s ! Female;
|
||||
_ => n.s ! Female
|
||||
} ;
|
||||
gn = GSg Fem ;
|
||||
p = NounP3 Pos
|
||||
} ;
|
||||
lin PlSurname = \n -> {
|
||||
s = table { RObj c => linCase c Pos ++ n.pl ;
|
||||
_ => n.pl
|
||||
} ;
|
||||
gn = GPl ;
|
||||
p = NounP3 Pos
|
||||
} ;
|
||||
lin FullName gn sn = {
|
||||
s = table { RObj c => linCase c Pos ++ gn.s ++ sn.s ! gn.g ;
|
||||
_ => gn.s ++ sn.s ! gn.g
|
||||
} ;
|
||||
gn = GSg (sex2gender gn.g) ;
|
||||
p = NounP3 Pos
|
||||
} ;
|
||||
|
||||
}
|
||||
@@ -118,6 +118,8 @@ concrete NounBul of Noun = CatBul ** open ResBul, Prelude in {
|
||||
NumDigits n = {s = \\gspec => n.s ! NCard gspec; nn = case n.n of {Sg => NNum Sg; Pl => NCountable}} ;
|
||||
OrdDigits n = {s = \\aform => n.s ! NOrd aform} ;
|
||||
|
||||
NumFloat n1 n2 = {s = \\gspec => n1.s ! NCard (CFMasc Indef NonHuman) ++ BIND ++ "." ++ BIND ++ n2.s ! NCard gspec ; nn = NCountable} ;
|
||||
|
||||
NumNumeral numeral = {s = \\gspec => numeral.s ! NCard gspec; nn = case numeral.n of {Sg => NNum Sg; Pl => NCountable}} ;
|
||||
OrdNumeral numeral = {s = \\aform => numeral.s ! NOrd aform} ;
|
||||
|
||||
@@ -238,4 +240,17 @@ concrete NounBul of Noun = CatBul ** open ResBul, Prelude in {
|
||||
p = dap.p
|
||||
} ;
|
||||
DetDAP det = det ;
|
||||
|
||||
QuantityNP n m = {
|
||||
s = \\role => preOrPost m.isPre m.s (n.s ! NCard (CFMasc Indef NonHuman)) ;
|
||||
gn = gennum (AMasc NonHuman) n.n ;
|
||||
p = NounP3 Pos
|
||||
} ;
|
||||
|
||||
QuantityFloatNP n1 n2 m = {
|
||||
s = \\role => preOrPost m.isPre m.s (n1.s ! NCard (CFMasc Indef NonHuman) ++ BIND ++ "." ++ BIND ++ n2.s ! NCard (CFMasc Indef NonHuman)) ;
|
||||
gn = gennum (AMasc NonHuman) Pl ;
|
||||
p = NounP3 Pos
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -4,11 +4,13 @@ concrete NumeralBul of Numeral = CatBul [Numeral,Digits] ** open Prelude, ResBul
|
||||
|
||||
|
||||
lincat
|
||||
Digit = {s : DForm => CardOrd => Str} ;
|
||||
Sub10 = {s : DForm => CardOrd => Str; n : Number} ;
|
||||
Sub100 = {s : CardOrd => NumF => Str; n : Number; i : Bool} ;
|
||||
Sub1000 = {s : CardOrd => NumF => Str; n : Number; i : Bool} ;
|
||||
Sub1000000 = {s : CardOrd => NumF => Str; n : Number} ;
|
||||
Digit = {s : DForm => CardOrd => Str} ;
|
||||
Sub10 = {s : DForm => CardOrd => Str; n : Number} ;
|
||||
Sub100 = {s : CardOrd => NumF => Str; n : Number; i : Bool} ;
|
||||
Sub1000 = {s : CardOrd => NumF => Str; n : Number; i : Bool} ;
|
||||
Sub1000000 = {s : CardOrd => NumF => Str; n : Number} ;
|
||||
Sub1000000000 = {s : CardOrd => NumF => Str; n : Number} ;
|
||||
Sub1000000000000 = {s : CardOrd => NumF => Str; n : Number} ;
|
||||
|
||||
lin num x = {s = \\c => x.s ! c ! Formal; n=x.n} ;
|
||||
lin n2 = mkDigit "два" "двама" "две" "втори" "двайсет" "двеста" "двестата" ;
|
||||
@@ -52,24 +54,33 @@ lin pot01 =
|
||||
;n = Sg
|
||||
} ;
|
||||
lin pot0 d = d ** {n = Pl} ;
|
||||
lin pot0as1 n = {s = \\c,nf => n.s ! unit ! c; n = n.n; i = True} ;
|
||||
|
||||
lin pot110 = {s=\\c,nf => pot01.s ! ten nf ! c; n = Pl; i = True} ;
|
||||
lin pot111 = {s=\\c,nf => pot01.s ! teen nf ! c; n = Pl; i = True} ;
|
||||
lin pot1to19 d = {s = \\c,nf => d.s ! teen nf ! c; n = Pl; i = True} ;
|
||||
lin pot0as1 n = {s = \\c,nf => n.s ! unit ! c; n = n.n; i = True} ;
|
||||
lin pot1 d = {s = \\c,nf => d.s ! ten nf ! c; n = Pl; i = True} ;
|
||||
lin pot1plus d e = {
|
||||
s = \\c,nf => d.s ! ten nf ! NCard (CFMasc Indef NonHuman) ++ "и" ++ e.s ! unit ! c ; n = Pl; i = False} ;
|
||||
|
||||
lin pot1as2 n = n ;
|
||||
|
||||
lin pot21 = {
|
||||
s = \\o,_ => mkCardOrd100 "сто" "стоте" "стотен" ! o ;
|
||||
i = False ;
|
||||
n = Pl
|
||||
} ;
|
||||
lin pot2 n = {s = \\c,nf => n.s ! hundred ! c; n = Pl; i = True} ;
|
||||
lin pot2plus d e = {
|
||||
s = \\c,nf => d.s ! hundred ! NCard (CFMasc Indef NonHuman) ++ case e.i of {False => []; True => "и"} ++ e.s ! c ! nf ;
|
||||
n = Pl ;
|
||||
i = False
|
||||
} ;
|
||||
|
||||
lin pot2as3 n = n ;
|
||||
|
||||
lin pot31 = {
|
||||
s = \\o,_ => mkCardOrd100 "хиляда" "хилядата" "хиляден" ! o ;
|
||||
n = Pl
|
||||
} ;
|
||||
lin pot3 n = {
|
||||
s = \\c,nf => case n.n of {
|
||||
Sg => mkCardOrd100 "хиляда" "хилядата" "хиляден" ! c ;
|
||||
@@ -85,7 +96,52 @@ lin pot3plus n m = {
|
||||
++ case m.i of {False => []; True => "и"} ++ m.s ! c ! nf ;
|
||||
n = Pl
|
||||
} ;
|
||||
lin pot3as4 n = n ;
|
||||
lin pot3float f = {
|
||||
s = \\c,nf => f.s ++ mkCardOrd100 "хиляди" "хилядите" "хиляден" ! c ;
|
||||
n = Pl
|
||||
} ;
|
||||
|
||||
lin pot41 = {
|
||||
s = \\o,_ => mkCardOrd100 "милион" "милионите" "милионен" ! o ;
|
||||
n = Pl
|
||||
} ;
|
||||
lin pot4 n = {
|
||||
s = \\c,nf => case n.n of {
|
||||
Sg => mkCardOrd100 "милион" "милионите" "милионен" ! c ;
|
||||
Pl => n.s ! NCard (CFFem Indef) ! nf ++ mkCardOrd100 "милиони" "милионите" "милионен" ! c
|
||||
} ;
|
||||
n = Pl
|
||||
} ;
|
||||
lin pot4plus n1 n2 = {
|
||||
s = \\o,f => (pot4 n1).s ! o ! f ++ "и" ++ n2.s ! o ! f;
|
||||
n = Pl
|
||||
} ;
|
||||
lin pot4as5 n = n ;
|
||||
lin pot4float f = {
|
||||
s = \\c,nf => f.s ++ mkCardOrd100 "милиона" "милиона" "милионен" ! c ;
|
||||
n = Pl
|
||||
} ;
|
||||
|
||||
lin pot51 = {
|
||||
s = \\o,_ => mkCardOrd100 "милиярд" "милиярдите" "милиярден" ! o ;
|
||||
n = Pl
|
||||
} ;
|
||||
lin pot5 n = {
|
||||
s = \\c,nf => case n.n of {
|
||||
Sg => mkCardOrd100 "милиярд" "милиярдите" "милиярден" ! c ;
|
||||
Pl => n.s ! NCard (CFFem Indef) ! nf ++ mkCardOrd100 "милиярд" "милиярдите" "милиярден" ! c
|
||||
} ;
|
||||
n = Pl
|
||||
} ;
|
||||
lin pot5plus n1 n2 = {
|
||||
s = \\o,f => (pot5 n1).s ! o ! f ++ "и" ++ n2.s ! o ! f;
|
||||
n = Pl
|
||||
} ;
|
||||
lin pot5float f = {
|
||||
s = \\c,nf => f.s ++ mkCardOrd100 "милиярда" "милиярда" "милиярден" ! c ;
|
||||
n = Pl
|
||||
} ;
|
||||
|
||||
-- numerals as sequences of digits
|
||||
|
||||
|
||||
@@ -2116,4 +2116,7 @@ oper
|
||||
|
||||
adjAdv : A -> Str -> A =
|
||||
\a,adv -> a ** {adv = adv} ;
|
||||
|
||||
mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -47,7 +47,8 @@ resource ResBul = ParamX ** open Prelude, Predef in {
|
||||
|
||||
param
|
||||
Gender = Masc | Fem | Neut ;
|
||||
|
||||
Sex = Male | Female ;
|
||||
|
||||
Species = Indef | Def ;
|
||||
|
||||
-- The plural never makes a gender distinction.
|
||||
@@ -851,4 +852,11 @@ resource ResBul = ParamX ** open Prelude, Predef in {
|
||||
APl Indef => "свои" ;
|
||||
APl Def => "своите"
|
||||
} ;
|
||||
|
||||
sex2gender : Sex -> Gender = \g ->
|
||||
case g of {
|
||||
Male => Masc ;
|
||||
Female => Fem
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -225,4 +225,7 @@ oper
|
||||
|
||||
polNegDirSubj = RPos ;
|
||||
|
||||
param
|
||||
HasArt = NoArt | UseArt ;
|
||||
|
||||
}
|
||||
|
||||
@@ -15,5 +15,4 @@ concrete ExtendCat of Extend = CatCat ** ExtendRomanceFunctor-- -
|
||||
ParadigmsCat in {
|
||||
-- put your own definitions here
|
||||
|
||||
|
||||
} ;
|
||||
|
||||
@@ -14,7 +14,8 @@ concrete GrammarCat of Grammar =
|
||||
TextX - [SC,Temp,Tense,Pol,PPos,PNeg],
|
||||
IdiomCat,
|
||||
StructuralCat,
|
||||
TenseCat
|
||||
TenseCat,
|
||||
NamesCat
|
||||
|
||||
** {
|
||||
|
||||
|
||||
9
src/catalan/NamesCat.gf
Normal file
9
src/catalan/NamesCat.gf
Normal file
@@ -0,0 +1,9 @@
|
||||
concrete NamesCat of Names = CatCat ** open ResCat in {
|
||||
|
||||
lin GivenName, MaleSurname, FemaleSurname = \n -> pn2np n ;
|
||||
lin FullName gn sn = pn2np {
|
||||
s = gn.s ++ sn.s ;
|
||||
g = gn.g
|
||||
} ;
|
||||
|
||||
}
|
||||
@@ -12,6 +12,8 @@ lincat
|
||||
Sub100 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000000 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000000000 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000000000000 = {s : CardOrd => Str ; n : Number} ;
|
||||
|
||||
|
||||
-- Auxiliaries
|
||||
@@ -125,7 +127,9 @@ lin
|
||||
pot3plus n m =
|
||||
{s= \\co => (table {Sg => []; Pl => (n.s ! co)} ! n.n) ++ "mil" ++ (m.s !co);
|
||||
n= Pl} ;
|
||||
|
||||
|
||||
pot3as4 n = n ;
|
||||
pot4as5 n = n ;
|
||||
|
||||
param
|
||||
DForm = unit | teen | ten | tenplus | Aunit | OrdF ;
|
||||
|
||||
@@ -553,6 +553,6 @@ oper
|
||||
mk2V2 : V -> Prep -> V2 ;
|
||||
dirV2 : V -> V2 ;
|
||||
|
||||
|
||||
mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ;
|
||||
|
||||
} ;
|
||||
|
||||
@@ -5,7 +5,7 @@ concrete AdjectiveChi of Adjective = CatChi ** open ResChi, Prelude in {
|
||||
PositA a = a ** {hasAdA = False} ;
|
||||
|
||||
ComparA a np = a ** {
|
||||
s = table {_=> than_s ++ np.s ++ a.s!Attr};
|
||||
s = table {_=> than_s ++ linNP np ++ a.s!Attr};
|
||||
hasAdA = False
|
||||
|
||||
};
|
||||
@@ -26,11 +26,11 @@ concrete AdjectiveChi of Adjective = CatChi ** open ResChi, Prelude in {
|
||||
};
|
||||
|
||||
CAdvAP ad ap np = ap ** {
|
||||
s = table {adjPlace => ad.s ++ np.s ++ ad.p ++ ap.s!adjPlace}
|
||||
s = table {adjPlace => ad.s ++ linNP np ++ ad.p ++ ap.s!adjPlace}
|
||||
};
|
||||
|
||||
ComplA2 a np = a ** {
|
||||
s= table { adjPlace => appPrep a.c2 np.s ++ a.s!adjPlace};
|
||||
s= table { adjPlace => appPrep a.c2 (linNP np) ++ a.s!adjPlace};
|
||||
hasAdA = False
|
||||
};
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ concrete AdverbChi of Adverb = CatChi **
|
||||
lin
|
||||
PositAdvAdj a = {s = a.s!Attr ++ "地" ; advType = ATManner ; hasDe = False} ; ---- for all adjs?
|
||||
|
||||
PrepNP prep np = ss (appPrep prep np.s) ** {advType = prep.advType ; hasDe = prep.hasDe} ; --- should depend on np too ?
|
||||
PrepNP prep np = ss (appPrep prep (linNP np)) ** {advType = prep.advType ; hasDe = prep.hasDe} ; --- should depend on np too ?
|
||||
|
||||
ComparAdvAdj cadv a np = ss (a.s!Attr ++ cadv.s ++ cadv.p ++ np.s) ** {advType = ATManner ; hasDe = False} ;
|
||||
ComparAdvAdj cadv a np = ss (a.s!Attr ++ cadv.s ++ cadv.p ++ (linNP np)) ** {advType = ATManner ; hasDe = False} ;
|
||||
|
||||
ComparAdvAdjS cadv a s = ss (a.s!Attr ++ cadv.s ++ cadv.p ++ linS s) ** {advType = ATManner ; hasDe = False} ;
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
--# -path=.:../abstract:../common:../api:../prelude
|
||||
|
||||
concrete AllChi of AllChiAbs = LangChi, ExtraChi ;
|
||||
concrete AllChi of AllChiAbs = LangChi, ExtendChi ;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
--# -path=.:../abstract:../common:prelude
|
||||
|
||||
abstract AllChiAbs =
|
||||
abstract AllChiAbs =
|
||||
Lang,
|
||||
ExtraChiAbs ;
|
||||
Extend ;
|
||||
|
||||
@@ -43,7 +43,8 @@ concrete CatChi of Cat = CommonX - [Tense, Temp, Ant, Adv] ** open ResChi, Prelu
|
||||
-- Noun
|
||||
|
||||
CN = ResChi.Noun ;
|
||||
NP, Pron = ResChi.NP ;
|
||||
NP = ResChi.NP ;
|
||||
Pron = SS ;
|
||||
Det = Determiner ;
|
||||
Quant = Determiner ** {pl : Str} ;
|
||||
Predet = {s : Str} ; ----
|
||||
@@ -79,7 +80,7 @@ concrete CatChi of Cat = CommonX - [Tense, Temp, Ant, Adv] ** open ResChi, Prelu
|
||||
N = ResChi.Noun ;
|
||||
N2 = ResChi.Noun ** {c2 : Preposition} ;
|
||||
N3 = ResChi.Noun ** {c2,c3 : Preposition} ;
|
||||
PN = ResChi.NP ;
|
||||
GN, SN, LN, PN = SS ;
|
||||
|
||||
-- overridden
|
||||
|
||||
@@ -89,4 +90,7 @@ concrete CatChi of Cat = CommonX - [Tense, Temp, Ant, Adv] ** open ResChi, Prelu
|
||||
|
||||
linref
|
||||
S = linS ;
|
||||
Prep = linPrep ;
|
||||
VP = infVP ;
|
||||
NP = \np -> np.det ++ np.s ;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ concrete ConjunctionChi of Conjunction = CatChi ** open ResChi, Prelude, Coordin
|
||||
postJiu = ss.postJiu}
|
||||
} ;
|
||||
ConjAdv c as = conjunctDistrSS (c.s ! CSent) as ** {advType = as.advType ; hasDe = as.hasDe} ; ---- ??
|
||||
ConjNP c = conjunctDistrSS (c.s ! CPhr CNPhrase) ;
|
||||
ConjNP c nps = conjunctDistrSS (c.s ! CPhr CNPhrase) nps ** {det = []} ;
|
||||
ConjAP c as = conjunctDistrTable AdjPlace (c.s ! CPhr CAPhrase) as ** {monoSyl = notB as.monoSyl ; hasAdA = True} ; ---- add de iff as doesn't
|
||||
ConjRS c = conjunctDistrSS (c.s ! CSent) ;
|
||||
ConjCN c ns = conjunctDistrSS (c.s ! CPhr CNPhrase) ns ** {c = ns.c} ;
|
||||
@@ -28,8 +28,8 @@ concrete ConjunctionChi of Conjunction = CatChi ** open ResChi, Prelude, Coordin
|
||||
|
||||
BaseAdv x y = twoSS x y ** {advType = x.advType ; hasDe = y.hasDe} ; ---- ??
|
||||
ConsAdv x xs = consrSS duncomma x xs ** {advType = x.advType ; hasDe = xs.hasDe} ; ---- ??
|
||||
BaseNP = twoSS ;
|
||||
ConsNP = consrSS duncomma ;
|
||||
BaseNP np1 np2 = twoSS (mergeNP np1) (mergeNP np2) ;
|
||||
ConsNP np nps = consrSS duncomma (mergeNP np) nps ;
|
||||
BaseAP x y = twoTable AdjPlace x y ** {monoSyl = y.monoSyl} ;
|
||||
ConsAP x xs = consrTable AdjPlace duncomma x xs ** {monoSyl = xs.monoSyl} ;
|
||||
BaseRS = twoSS ;
|
||||
@@ -46,5 +46,8 @@ concrete ConjunctionChi of Conjunction = CatChi ** open ResChi, Prelude, Coordin
|
||||
[RS] = {s1,s2 : Str} ;
|
||||
[CN] = {s1,s2 : Str ; c : Str} ;
|
||||
|
||||
oper
|
||||
mergeNP : ResChi.NP -> SS = \np -> ss (linNP np) ;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--# -path=.:../abstract
|
||||
|
||||
concrete ConstructionChi of Construction = CatChi **
|
||||
concrete ConstructionChi of Construction = CatChi **
|
||||
open SyntaxChi, ParadigmsChi, (L = LexiconChi), (E = ExtraChi), (G = GrammarChi), (R = ResChi), Prelude in {
|
||||
flags coding=utf8 ;
|
||||
|
||||
@@ -24,9 +24,9 @@ lin
|
||||
|
||||
-- some more things
|
||||
weather_adjCl ap = mkCl (mkVP (lin AP ap)) ;
|
||||
|
||||
is_right_VP = mkVP (ParadigmsChi.mkA "对") ;
|
||||
is_wrong_VP = mkVP (ParadigmsChi.mkA "错") ;
|
||||
|
||||
is_right_VP = mkVP (ParadigmsChi.mkA "对") ;
|
||||
is_wrong_VP = mkVP (ParadigmsChi.mkA "错") ;
|
||||
|
||||
n_units_AP card cn a = mkAP (lin AdA (mkUtt (mkNP <lin Card card : Card> (lin CN cn)))) (lin A a) ; ----
|
||||
|
||||
@@ -47,8 +47,8 @@ lin
|
||||
monthYearAdv m y = lin Adv {s = y.s ++ "年" ++ m.s ; advType = timeAdvType ; hasDe = False} ;
|
||||
dayMonthYearAdv d m y = lin Adv {s = y.s ++ "年" ++ m.s ++ d.s ++ "日" ; advType = timeAdvType ; hasDe = False} ;
|
||||
|
||||
intYear i = lin NP i ;
|
||||
intMonthday i = lin NP i ;
|
||||
intYear i = lin NP (R.mkNP i.s) ;
|
||||
intMonthday i = lin NP (R.mkNP i.s) ;
|
||||
|
||||
lincat Language = N ;
|
||||
|
||||
@@ -74,9 +74,9 @@ lin friday_Weekday = mkN "星期五" ;
|
||||
lin saturday_Weekday = mkN "星期六" ;
|
||||
lin sunday_Weekday = mkN "星期日" ;
|
||||
|
||||
lin january_Month = mkN "一月" ;
|
||||
lin february_Month = mkN "二月" ;
|
||||
lin march_Month = mkN "三月" ;
|
||||
lin january_Month = mkN "一月" ;
|
||||
lin february_Month = mkN "二月" ;
|
||||
lin march_Month = mkN "三月" ;
|
||||
lin april_Month = mkN "四月" ;
|
||||
lin may_Month = mkN "五月" ;
|
||||
lin june_Month = mkN "六月" ;
|
||||
|
||||
@@ -111,6 +111,24 @@ lin
|
||||
s2 = inflVerb verb
|
||||
} ;
|
||||
|
||||
InflectionPN = \n -> {
|
||||
t = "v" ;
|
||||
s1 = heading1 "Proper Name" ;
|
||||
s2 = n.s
|
||||
} ;
|
||||
|
||||
InflectionGN = \n -> {
|
||||
t = "v" ;
|
||||
s1 = heading1 "Given Name" ;
|
||||
s2 = n.s
|
||||
} ;
|
||||
|
||||
InflectionSN = \n -> {
|
||||
t = "v" ;
|
||||
s1 = heading1 "Surname Name" ;
|
||||
s2 = n.s
|
||||
} ;
|
||||
|
||||
oper
|
||||
inflVerb : Verb -> Str = \verb ->
|
||||
let vtbl = useVerb verb
|
||||
|
||||
@@ -1,10 +1,80 @@
|
||||
--# -path=alltenses:../common:../abstract
|
||||
|
||||
concrete ExtendChi of Extend = CatChi **
|
||||
ExtendFunctor - [ProDrop,ComplDirectVS, ComplDirectVQ]
|
||||
with (Grammar=GrammarChi) ** open Prelude, ResChi in {
|
||||
ExtendFunctor - [
|
||||
VPS, ListVPS, VPI, ListVPI
|
||||
, MkVPS, BaseVPS, ConsVPS, ConjVPS
|
||||
, PredVPS, SQuestVPS, RelVPS --, QuestVPS -- TODO
|
||||
, MkVPI, BaseVPI, ConsVPI, ConjVPI, ComplVPIVV
|
||||
, VPS2, ListVPS2, VPI2, ListVPI2
|
||||
, MkVPS2, BaseVPS2, ConsVPS2, ConjVPS2, ComplVPS2, ReflVPS2
|
||||
, MkVPI2, BaseVPI2, ConsVPI2, ConjVPI2, ComplVPI2
|
||||
, ProDrop, ComplDirectVS, ComplDirectVQ
|
||||
, PassVPSlash, PassAgentVPSlash
|
||||
, GerundAdv, GerundNP, ByVP, ApposNP ]
|
||||
with (Grammar=GrammarChi) ** open
|
||||
Prelude
|
||||
, Coordination
|
||||
, ResChi
|
||||
, (S=StructuralChi)
|
||||
in {
|
||||
|
||||
lincat
|
||||
VPS, VPI = SS ;
|
||||
[VPS], [VPI] = ListX ;
|
||||
VPS2, VPI2 = SS ** {c2 : Preposition ; isPre : Bool} ; -- whether the missing arg is before verb
|
||||
[VPS2], [VPI2] = ListX ** {c2 : Preposition ; isPre : Bool} ;
|
||||
|
||||
lin
|
||||
PassVPSlash vps = insertAdv (mkNP passive_s) vps ;
|
||||
PassAgentVPSlash vps np = insertAdv (ss (appPrep S.by8agent_Prep (linNP np))) (insertAdv (mkNP passive_s) vps) ;
|
||||
|
||||
MkVPS t p vp = {s = t.s ++ p.s ++ (mkClause [] vp).s ! p.p ! t.t} ;
|
||||
ConjVPS c = conjunctDistrSS (c.s ! CSent) ;
|
||||
BaseVPS = twoSS ;
|
||||
ConsVPS = consrSS duncomma ;
|
||||
|
||||
-- : NP -> VPS -> S ; -- she [has walked and won't sleep]
|
||||
PredVPS np vps = {preJiu = (linNP np) ; postJiu = vps.s} ;
|
||||
|
||||
-- : NP -> VPS -> QS ; -- has she walked
|
||||
SQuestVPS np vps = {s = \\_ => linNP np ++ vps.s ++ question_s} ;
|
||||
|
||||
-- : IP -> VPS -> QS ; -- who has walked
|
||||
-- QuestVPS ip vps = -- TODO: probably need to change structure of VPS
|
||||
|
||||
-- : RP -> VPS -> RS ; -- which won't sleep
|
||||
RelVPS rp vps = {s = rp.s ! True ++ vps.s ++ "的"} ;
|
||||
|
||||
MkVPI vp = {s = (mkClause [] vp).s ! Pos ! APlain} ;
|
||||
ConjVPI c = conjunctDistrSS (c.s ! CSent) ;
|
||||
BaseVPI = twoSS ;
|
||||
ConsVPI = consrSS duncomma ;
|
||||
|
||||
MkVPS2 t p vps = {s = t.s ++ p.s ++ (mkClause [] <vps : ResChi.VP>).s ! p.p ! t.t} ** vps ;
|
||||
ConjVPS2 c vs = conjunctDistrSS (c.s ! CSent) vs ** vs ;
|
||||
BaseVPS2 v w = twoSS v w ** w ;
|
||||
ConsVPS2 v vs = consrSS duncomma v vs ** vs ;
|
||||
|
||||
MkVPI2 vps = {s = (mkClause [] <vps : ResChi.VP>).s ! Pos ! APlain} ** vps ;
|
||||
ConjVPI2 c vs = conjunctDistrSS (c.s ! CSent) vs ** vs ;
|
||||
BaseVPI2 v w = twoSS v w ** w ;
|
||||
ConsVPI2 v vs = consrSS duncomma v vs ** vs ;
|
||||
|
||||
ComplVPIVV vv vpi = predV vv [] ** {
|
||||
compl = vpi.s ;
|
||||
} ;
|
||||
|
||||
GerundAdv vp = mkAdv (infVP vp) ;
|
||||
GerundNP vp = ResChi.mkNP (infVP vp) ;
|
||||
|
||||
ByVP vp =
|
||||
let adv : Adv = GerundAdv vp
|
||||
in adv ** {s = adv.s ++ "来" ; advType = ATTime} ;
|
||||
|
||||
GenNP np = {s,pl = linNP np ++ possessive_s ; detType = DTPoss} ;
|
||||
GenRP nu cn = {s = \\_ => cn.s ++ relative_s} ;
|
||||
|
||||
ProDrop pron = pron ** {s = []} ;
|
||||
ComplDirectVS vs utt =
|
||||
AdvVP (UseV <lin V vs : V>)
|
||||
@@ -13,7 +83,11 @@ concrete ExtendChi of Extend = CatChi **
|
||||
AdvVP (UseV <lin V vq : V>)
|
||||
(mkAdv (":" ++ quoted utt.s)) ; -- DEFAULT complement added as Adv in quotes
|
||||
|
||||
lin
|
||||
ApposNP np1 np2 = {s = np1.s ++ np2.s; det = np1.det} ;
|
||||
|
||||
oper
|
||||
mkAdv : Str -> Adv ;
|
||||
mkAdv : Str -> CatChi.Adv ;
|
||||
mkAdv str = lin Adv {s = str ; advType = ATManner ; hasDe = False} ;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
@@ -11,21 +11,21 @@ concrete ExtraChi of ExtraChiAbs = CatChi **
|
||||
|
||||
lin
|
||||
PassVPSlash vps = insertAdv (mkNP passive_s) vps ;
|
||||
PassAgentVPSlash vps np = insertAdv (ss (appPrep S.by8agent_Prep np.s)) (insertAdv (mkNP passive_s) vps) ;
|
||||
PassAgentVPSlash vps np = insertAdv (ss (appPrep S.by8agent_Prep (linNP np))) (insertAdv (mkNP passive_s) vps) ;
|
||||
|
||||
MkVPS t p vp = {s = t.s ++ p.s ++ (mkClause [] vp).s ! p.p ! t.t} ;
|
||||
ConjVPS c = conjunctDistrSS (c.s ! CSent) ;
|
||||
BaseVPS = twoSS ;
|
||||
ConsVPS = consrSS duncomma ;
|
||||
|
||||
PredVPS np vps = {preJiu = np.s ; postJiu = vps.s} ;
|
||||
PredVPS np vps = {preJiu = (linNP np) ; postJiu = vps.s} ;
|
||||
|
||||
MkVPI vp = {s = (mkClause [] vp).s ! Pos ! APlain} ; --- ?? almost just a copy of VPS
|
||||
ConjVPI c = conjunctDistrSS (c.s ! CSent) ;
|
||||
BaseVPI = twoSS ;
|
||||
ConsVPI = consrSS duncomma ;
|
||||
|
||||
GenNP np = {s,pl = np.s ++ possessive_s ; detType = DTPoss} ;
|
||||
GenNP np = {s,pl = linNP np ++ possessive_s ; detType = DTPoss} ;
|
||||
|
||||
GenRP nu cn = {s = \\_ => cn.s ++ relative_s} ; ---- ??
|
||||
|
||||
|
||||
@@ -14,7 +14,8 @@ concrete GrammarChi of Grammar =
|
||||
TextChi,
|
||||
StructuralChi,
|
||||
IdiomChi,
|
||||
TenseChi
|
||||
TenseChi,
|
||||
NamesChi
|
||||
** {
|
||||
|
||||
flags startcat = Phr ; unlexer = text ; lexer = text ;
|
||||
|
||||
@@ -10,11 +10,11 @@ concrete IdiomChi of Idiom = CatChi ** open Prelude, ResChi in {
|
||||
-- GenericCl vp = mkClause "有人" vp ; (meaning: there is a person)
|
||||
|
||||
---- it is John who did it
|
||||
CleftNP np rs = mkClause rs.s copula np.s ; -- did it + de + is I
|
||||
CleftNP np rs = mkClause rs.s copula (linNP np) ; -- did it + de + is I
|
||||
|
||||
CleftAdv ad s = mkClause (linS s ++ possessive_s) copula ad.s ; -- she sleeps + de + is here
|
||||
|
||||
ExistNP np = mkClause [] (regVerb you_s) np.s ; ---- infl of you
|
||||
ExistNP np = mkClause [] (regVerb you_s) (linNP np) ; ---- infl of you
|
||||
|
||||
ExistIP ip = {s = \\_ => (mkClause [] (regVerb you_s) ip.s).s} ; ---- infl of you
|
||||
|
||||
@@ -30,7 +30,7 @@ concrete IdiomChi of Idiom = CatChi ** open Prelude, ResChi in {
|
||||
|
||||
SelfAdvVP vp = insertAdv (ss reflPron) vp ;
|
||||
SelfAdVVP vp = insertAdv (ss reflPron) vp ;
|
||||
SelfNP np = {s = np.s ++ reflPron} ;
|
||||
SelfNP np = np ** {s = linNP np ++ reflPron} ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
9
src/chinese/NamesChi.gf
Normal file
9
src/chinese/NamesChi.gf
Normal file
@@ -0,0 +1,9 @@
|
||||
concrete NamesChi of Names = CatChi ** {
|
||||
|
||||
lin GivenName, MaleSurname, FemaleSurname, PlSurname = \n -> n ** {det = []} ;
|
||||
lin FullName gn sn = {
|
||||
s = gn.s ++ sn.s ;
|
||||
det = []
|
||||
} ;
|
||||
|
||||
}
|
||||
@@ -1,28 +1,33 @@
|
||||
concrete NounChi of Noun = CatChi ** open ResChi, Prelude in {
|
||||
|
||||
lin
|
||||
DetCN det cn = case det.detType of {
|
||||
DTFull Sg => {s = det.s ++ cn.c ++ cn.s} ; -- this house
|
||||
DTFull Pl => {s = det.s ++ xie_s ++ cn.s} ; -- these houses
|
||||
DTNum => {s = det.s ++ cn.c ++ cn.s} ; -- (these) five houses
|
||||
DTPoss => {s = det.s ++ cn.s} -- our (five) houses
|
||||
} ;
|
||||
UsePN pn = pn ;
|
||||
UsePron p = p ;
|
||||
DetCN det cn = cn ** {
|
||||
det = case det.detType of {
|
||||
DTFull Sg => det.s ++ cn.c ; -- this house
|
||||
DTFull Pl => det.s ++ xie_s ; -- these houses
|
||||
DTNum => det.s ++ cn.c ; -- (these) five houses
|
||||
DTPoss => det.s -- our (five) houses
|
||||
}
|
||||
} ;
|
||||
|
||||
DetNP det = {s = case det.detType of {
|
||||
UsePN pn = pn ** {det = []} ;
|
||||
UsePron p = p ** {det = []} ;
|
||||
|
||||
DetNP det = {
|
||||
s = [] ;
|
||||
det = case det.detType of {
|
||||
DTFull Pl => det.s ++ xie_s ;
|
||||
DTPoss => det.s ;
|
||||
_ => det.s ++ ge_s
|
||||
} ;
|
||||
} ; ----
|
||||
} ; ----
|
||||
|
||||
PredetNP pred np = mkNP (pred.s ++ np.s) ; ---- possessive_s ++ np.s) ;
|
||||
PredetNP pred np = np ** {s = pred.s ++ np.s} ; ---- possessive_s ++ np.s) ;
|
||||
|
||||
PPartNP np v2 = mkNP ((predV v2 v2.part).verb.s ++ possessive_s ++ np.s) ; ---- ??
|
||||
PPartNP np v2 = np ** {s = (predV v2 v2.part).verb.s ++ possessive_s ++ np.s} ; ---- ??
|
||||
|
||||
AdvNP np adv = mkNP (adv.s ++ possessiveIf adv.hasDe ++ np.s) ;
|
||||
ExtAdvNP np adv = mkNP (adv.s ++ possessiveIf adv.hasDe ++ embedInCommas np.s) ; ---- commas?
|
||||
AdvNP np adv = np ** {s = adv.s ++ possessiveIf adv.hasDe ++ np.s} ;
|
||||
ExtAdvNP np adv = np ** {s = adv.s ++ possessiveIf adv.hasDe ++ embedInCommas np.s} ; ---- commas?
|
||||
|
||||
DetQuant quant num = {
|
||||
s = case num.numType of {
|
||||
@@ -70,15 +75,15 @@ concrete NounChi of Noun = CatChi ** open ResChi, Prelude in {
|
||||
DefArt = mkQuant [] [] DTPoss ; -- use that_Quant if you want the_s
|
||||
IndefArt = mkQuant yi_s [] DTNum ; -- (DTFull Sg) ; -- empty in the plural
|
||||
|
||||
MassNP cn = cn ;
|
||||
MassNP cn = mkNP cn.s ;
|
||||
|
||||
UseN n = n ;
|
||||
UseN2 n = n ;
|
||||
Use2N3 f = {s = f.s ; c = f.c ; c2 = f.c2} ;
|
||||
Use3N3 f = {s = f.s ; c = f.c ; c2 = f.c3} ;
|
||||
|
||||
ComplN2 f x = {s = appPrep f.c2 x.s ++ f.s ; c = f.c} ;
|
||||
ComplN3 f x = {s = appPrep f.c2 x.s ++ f.s ; c = f.c ; c2 = f.c3} ;
|
||||
ComplN2 f x = {s = appPrep f.c2 (linNP x) ++ f.s ; c = f.c} ;
|
||||
ComplN3 f x = {s = appPrep f.c2 (linNP x) ++ f.s ; c = f.c ; c2 = f.c3} ;
|
||||
|
||||
AdjCN ap cn = case ap.monoSyl of {
|
||||
True => {s = ap.s ! Attr ++ cn.s ; c = cn.c} ;
|
||||
@@ -88,13 +93,13 @@ concrete NounChi of Noun = CatChi ** open ResChi, Prelude in {
|
||||
RelCN cn rs = {s = rs.s ++ cn.s ; c = cn.c} ;
|
||||
AdvCN cn ad = {s = ad.s ++ possessiveIf ad.hasDe ++ cn.s ; c = cn.c} ;
|
||||
SentCN cn cs = {s = cs.s ++ cn.s ; c = cn.c} ;
|
||||
ApposCN cn np = {s = np.s ++ cn.s ; c = cn.c} ;
|
||||
ApposCN cn np = {s = linNP np ++ cn.s ; c = cn.c} ;
|
||||
|
||||
RelNP np rs = mkNP (rs.s ++ np.s) ;
|
||||
RelNP np rs = np ** {s = rs.s ++ np.s} ;
|
||||
|
||||
PossNP cn np = {s = np.s ++ possessive_s ++ cn.s ; c = cn.c} ;
|
||||
PartNP cn np = {s = np.s ++ possessive_s ++ cn.s ; c = cn.c} ;
|
||||
PossNP cn np = {s = linNP np ++ possessive_s ++ cn.s ; c = cn.c} ;
|
||||
PartNP cn np = {s = linNP np ++ possessive_s ++ cn.s ; c = cn.c} ;
|
||||
|
||||
CountNP det np = {s = det.s ++ ge_s ++ possessive_s ++ np.s} ; --- classifier from NP?
|
||||
CountNP det np = np ** {det = det.s ++ ge_s ++ possessive_s ++ np.det} ; --- classifier from NP?
|
||||
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ lincat Digit = {s,p : Str} ; -- s/p: without/with classifier (er/liang)
|
||||
lincat Sub10 = {s,p,t : Str} ; -- t: with "shi wan"
|
||||
lincat Sub100 = {end0,beg0 : Zero ; s,p : Bform => Str} ; -- end0: ends with zeros, e.g. 20 ; beg0: begins with zeros, e.g. 02
|
||||
lincat Sub1000 = {end0,beg0 : Zero ; s,p : Qform => Str} ; -- end0: ends with zeros, e.g. 210 ; beg0: begins with zeros, e.g. 021
|
||||
lincat Sub1000000 = {s,p : Str} ;
|
||||
lincat Sub1000000, Sub1000000000, Sub1000000000000 = {s,p : Str} ;
|
||||
lin num x0 = x0 ;
|
||||
|
||||
-- 一二三四五六七八九十一百千
|
||||
@@ -137,7 +137,9 @@ lin pot3 n =
|
||||
{s,p = n.s ! shiwan} ;
|
||||
lin pot3plus n m =
|
||||
{s,p = (n.s ! shiwan0) ++ (ling ! <n.end0,m.beg0>) ++ m.s ! bai0} ;
|
||||
lin pot3as4 n = n ;
|
||||
|
||||
lin pot4as5 n = n ;
|
||||
|
||||
-- numerals as sequences of digits
|
||||
|
||||
|
||||
@@ -184,7 +184,7 @@ oper
|
||||
emptyPrep : Preposition = mkPrep [] ;
|
||||
|
||||
mkpNP : Str -> CatChi.NP
|
||||
= \s -> lin NP {s = word s} ;
|
||||
= \s -> lin NP {s = word s ; det = []} ;
|
||||
mkAdV : Str -> AdV
|
||||
= \s -> lin AdV {s = word s} ;
|
||||
mkAdN : Str -> AdN
|
||||
@@ -215,6 +215,8 @@ oper
|
||||
= \s -> lin RP {s = table {True => [] ; False => word s}} ;
|
||||
|
||||
|
||||
mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ;
|
||||
|
||||
--. auxiliary
|
||||
|
||||
oper
|
||||
|
||||
@@ -11,7 +11,7 @@ concrete PhraseChi of Phrase = CatChi ** open Prelude, ResChi in {
|
||||
|
||||
UttIP ip = ip ;
|
||||
UttIAdv iadv = iadv ;
|
||||
UttNP np = np ;
|
||||
UttNP np = ss (linNP np) ;
|
||||
UttCN cn = cn ;
|
||||
UttAP ap = {s = ap.s!Attr} ;
|
||||
UttCard x = x ;
|
||||
@@ -23,6 +23,6 @@ concrete PhraseChi of Phrase = CatChi ** open Prelude, ResChi in {
|
||||
PConjConj conj = ss (conj.s ! CSent).s2 ;
|
||||
|
||||
NoVoc = {s = []} ;
|
||||
VocNP np = {s = np.s ++ chcomma} ; ---- ??
|
||||
VocNP np = {s = linNP np ++ chcomma} ; ---- ??
|
||||
|
||||
}
|
||||
|
||||
@@ -14,11 +14,11 @@ concrete QuestionChi of Question = CatChi **
|
||||
s = \\_,p,a => ip.s ++ vp.prePart ++ useVerb vp.verb ! p ! a ++ vp.compl
|
||||
} ;
|
||||
|
||||
QuestSlash ip cls = {s = \\_ => (mkClauseCompl cls.np (insertObj (ss (appPrep cls.c2 ip.s)) cls.vp) []).s} ;
|
||||
QuestSlash ip cls = {s = \\_ => (mkClauseCompl cls.np (insertObj (mkNP (appPrep cls.c2 ip.s)) cls.vp) []).s} ;
|
||||
|
||||
QuestIAdv iadv cl = {s = \\_ => (mkClauseCompl cl.np (insertAdv iadv cl.vp) []).s} ;
|
||||
|
||||
QuestIComp icomp np = {s = \\_,p,a => np.s ++ icomp.s} ; ---- order
|
||||
QuestIComp icomp np = {s = \\_,p,a => linNP np ++ icomp.s} ; ---- order
|
||||
|
||||
PrepIP p ip = ss (appPrep p ip.s) ;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ concrete RelativeChi of Relative = CatChi ** open ResChi, Prelude in {
|
||||
} ;
|
||||
} ; ---- ??
|
||||
RelSlash rp slash = {s = \\p,a => slash.s ! p ! a ++ appPrep slash.c2 (rp.s ! False)} ;
|
||||
FunRP p np rp = {s = \\a => appPrep p np.s ++ rp.s ! a} ; ---- ??
|
||||
FunRP p np rp = {s = \\a => appPrep p (linNP np) ++ rp.s ! a} ; ---- ??
|
||||
IdRP = {s = table {True => [] ; False => relative_s}} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -112,7 +112,8 @@ oper
|
||||
isAdj : Bool ; -- whether it is an adjectival predication and behaves differently in relative
|
||||
} ;
|
||||
|
||||
NP = {s : Str} ;
|
||||
NP = {det,s : Str} ; -- keep Det separate, because RelNP may put in a RS and that goes before the Det
|
||||
linNP : NP -> Str = \np -> np.det ++ np.s ;
|
||||
|
||||
-- for morphology
|
||||
|
||||
@@ -192,11 +193,11 @@ oper
|
||||
} ;
|
||||
|
||||
insertObj : NP -> VP -> VP = \np,vp -> vp ** {
|
||||
compl = np.s ++ vp.compl ;
|
||||
compl = linNP np ++ vp.compl ;
|
||||
} ;
|
||||
|
||||
insertObjPost : NP -> VP -> VP = \np,vp -> vp ** {
|
||||
compl = vp.compl ++ np.s ;
|
||||
compl = vp.compl ++ linNP np ;
|
||||
} ;
|
||||
|
||||
insertAdv : SS -> VP -> VP = \adv,vp -> vp ** {
|
||||
@@ -215,7 +216,7 @@ oper
|
||||
} ;
|
||||
|
||||
insertExtra : SS -> VP -> VP = \ext,vp ->
|
||||
insertObjPost ext vp ;
|
||||
insertObjPost (mkNP ext.s) vp ;
|
||||
|
||||
-- clauses: keep np and vp separate to enable insertion of IAdv
|
||||
|
||||
@@ -250,7 +251,7 @@ oper
|
||||
mkClauseCompl : Str -> VP -> Str -> Clause = \np,vp,compl -> {
|
||||
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 ;
|
||||
vp = insertObj (mkNP compl) vp ;
|
||||
postJiu = \\p,a => vp.prePart ++ useVerb vp.verb ! p ! a ++ vp.compl ++ compl ;
|
||||
} ;
|
||||
|
||||
@@ -278,7 +279,8 @@ oper
|
||||
} ;
|
||||
|
||||
pronNP : (s : Str) -> NP = \s -> {
|
||||
s = word s
|
||||
s = word s ;
|
||||
det = []
|
||||
} ;
|
||||
|
||||
Preposition = {prepPre : Str ; prepPost : Str ; advType : AdvType ; hasDe : Bool} ;
|
||||
@@ -290,6 +292,8 @@ oper
|
||||
hasDe = advTypeHasDe at ;
|
||||
} ;
|
||||
|
||||
linPrep : Preposition -> Str = \p -> p.prepPre ++ p.prepPost ;
|
||||
|
||||
advTypeHasDe : AdvType -> Bool = \at -> case at of {
|
||||
ATPoss => True ;
|
||||
_ => False
|
||||
@@ -314,7 +318,7 @@ oper
|
||||
|
||||
-- added by AR
|
||||
|
||||
mkNP : Str -> NP = ss ; -- not to be used in lexicon building
|
||||
mkNP : Str -> NP = \s -> {s = s ; det = []} ; -- not to be used in lexicon building
|
||||
|
||||
appPrep : Preposition -> Str -> Str = \prep,s ->
|
||||
prep.prepPre ++ s ++ prep.prepPost ;
|
||||
|
||||
@@ -5,7 +5,7 @@ concrete SentenceChi of Sentence = CatChi **
|
||||
|
||||
lin
|
||||
|
||||
PredVP np vp = mkClause np.s vp ;
|
||||
PredVP np vp = mkClause (linNP np) vp ;
|
||||
|
||||
PredSCVP sc vp = mkClause sc.s vp ;
|
||||
|
||||
@@ -17,10 +17,10 @@ concrete SentenceChi of Sentence = CatChi **
|
||||
} ;
|
||||
|
||||
SlashVP np vp =
|
||||
mkClauseCompl np.s vp []
|
||||
mkClauseCompl (linNP np) vp []
|
||||
** {c2 = vp.c2} ;
|
||||
|
||||
SlashVS np vs sslash = <mkClause np.s vs sslash.s : Clause> ** {c2 = sslash.c2} ;
|
||||
SlashVS np vs sslash = <mkClause (linNP np) vs sslash.s : Clause> ** {c2 = sslash.c2} ;
|
||||
|
||||
|
||||
-- yet another reason for discontinuity of clauses
|
||||
|
||||
@@ -142,8 +142,8 @@ either7or_DConj = {s = table { -- modified by chenpeng 11.19
|
||||
conjType = NotJiu ;
|
||||
} ;
|
||||
|
||||
everybody_NP = ssword "每个人" ; -- [mark] "每个人": 每(every)+个(classifier)+人(person)
|
||||
everything_NP = ssword "每件事" ; -- [mark] "每件事": 每(every)+件(classifier)+事(thing)
|
||||
everybody_NP = mkNP (ssword "每个人").s ; -- [mark] "每个人": 每(every)+个(classifier)+人(person)
|
||||
everything_NP = mkNP (ssword "每件事").s ; -- [mark] "每件事": 每(every)+件(classifier)+事(thing)
|
||||
everywhere_Adv = mkAdv "到处" ;
|
||||
here7from_Adv = mkAdv "从这里" ; -- from here
|
||||
here7to_Adv = mkAdv "到这里" ; -- to here
|
||||
@@ -161,13 +161,13 @@ if_then_Conj = {s = table { -- added by chenpeng 11.19
|
||||
} ;
|
||||
conjType = Jiu ;
|
||||
} ;
|
||||
nobody_NP = ssword "没人" ;
|
||||
nothing_NP = ssword "没有什么" ;
|
||||
nobody_NP = mkNP (ssword "没人").s ;
|
||||
nothing_NP = mkNP (ssword "没有什么").s ;
|
||||
on_Prep = mkPrep "在" "上" ;
|
||||
only_Predet = ssword "只有" ; -- only John
|
||||
so_AdA = ssword "如此" ;
|
||||
somebody_NP = ssword "某人" ;
|
||||
something_NP = ssword "某事" ; -- [mark] in sent, it depends on the context
|
||||
somebody_NP = mkNP (ssword "某人").s ;
|
||||
something_NP = mkNP (ssword "某事").s ; -- [mark] in sent, it depends on the context
|
||||
somewhere_Adv = mkAdv "某处" ;
|
||||
that_Subj = mkSubj [] chcomma ; -- that + S [mark] comma
|
||||
there7from_Adv = mkAdv "从那里" ; -- from there
|
||||
|
||||
@@ -11,12 +11,12 @@ concrete SymbolChi of Symbol = CatChi ** open Prelude, ResChi in {
|
||||
NumPN i = i ;
|
||||
CNIntNP cn i = {
|
||||
s = cn.s ++ i.s ;
|
||||
c = cn.c
|
||||
det = cn.c
|
||||
} ;
|
||||
CNSymbNP det cn xs = ss (det.s ++ cn.s ++ xs.s) ; ----
|
||||
CNSymbNP det cn xs = {det = det.s ; s = cn.s ++ xs.s} ; ----
|
||||
CNNumNP cn i = {
|
||||
s = cn.s ++ i.s ;
|
||||
c = cn.c
|
||||
det = cn.c
|
||||
} ;
|
||||
|
||||
SymbS sy = simpleS sy.s ;
|
||||
|
||||
@@ -7,14 +7,14 @@ concrete VerbChi of Verb = CatChi ** open ResChi, Prelude in {
|
||||
|
||||
SlashV2a v = predV v v.part ** {c2 = v.c2 ; isPre = v.hasPrep} ;
|
||||
|
||||
Slash2V3 v np = insertAdv (mkNP (ba_s ++ np.s)) (predV v v.part) ** {c2 = v.c3 ; isPre = v.hasPrep} ; -- slot for third argument
|
||||
Slash3V3 v np = insertObj (mkNP (appPrep v.c3 np.s)) (predV v v.part) ** {c2 = v.c2 ; isPre = True} ; -- slot for ba object
|
||||
Slash2V3 v np = insertAdv (mkNP (ba_s ++ linNP np)) (predV v v.part) ** {c2 = v.c3 ; isPre = v.hasPrep} ; -- slot for third argument
|
||||
Slash3V3 v np = insertObj (mkNP (appPrep v.c3 (linNP np))) (predV v v.part) ** {c2 = v.c2 ; isPre = True} ; -- slot for ba object
|
||||
|
||||
SlashV2A v ap = insertObj {s = ap.s ! Pred} (predV v v.part) ** {c2 = v.c2 ; isPre = v.hasPrep} ;
|
||||
SlashV2A v ap = insertObj (mkNP (ap.s ! Pred)) (predV v v.part) ** {c2 = v.c2 ; isPre = v.hasPrep} ;
|
||||
|
||||
SlashV2V v vp = insertObj (mkNP (infVP vp)) (predV v v.part) ** {c2 = v.c2 ; isPre = v.hasPrep} ;
|
||||
SlashV2S v s = insertObj (ss (say_s ++ linS s)) (predV v v.part) ** {c2 = v.c2 ; isPre = v.hasPrep} ;
|
||||
SlashV2Q v q = insertObj (ss (say_s ++ q.s ! False)) (predV v v.part) ** {c2 = v.c2 ; isPre = v.hasPrep} ;
|
||||
SlashV2S v s = insertObj (mkNP (say_s ++ linS s)) (predV v v.part) ** {c2 = v.c2 ; isPre = v.hasPrep} ;
|
||||
SlashV2Q v q = insertObj (mkNP (say_s ++ q.s ! False)) (predV v v.part) ** {c2 = v.c2 ; isPre = v.hasPrep} ;
|
||||
|
||||
ComplVV v vp = {
|
||||
verb = v ;
|
||||
@@ -23,14 +23,14 @@ concrete VerbChi of Verb = CatChi ** open ResChi, Prelude in {
|
||||
isAdj = False ;
|
||||
} ;
|
||||
|
||||
ComplVS v s = insertObj (ss (linS s)) (predV v []) ;
|
||||
ComplVQ v q = insertObj (ss (q.s ! False)) (predV v []) ;
|
||||
ComplVA v ap = insertObj {s = ap.s ! Pred} (predV v []) ;
|
||||
ComplVS v s = insertObj (mkNP (linS s)) (predV v []) ;
|
||||
ComplVQ v q = insertObj (mkNP (q.s ! False)) (predV v []) ;
|
||||
ComplVA v ap = insertObj (mkNP (ap.s ! Pred)) (predV v []) ;
|
||||
|
||||
ComplSlash vp np = case vp.isPre of {
|
||||
--- True => insertAdv (mkNP (ba_s ++ np.s)) vp ; --- ba or vp.c2 ?
|
||||
True => insertPP (mkNP (appPrep vp.c2 np.s)) vp ; --- ba or vp.c2 ?
|
||||
False => insertObj (mkNP (appPrep vp.c2 np.s)) vp
|
||||
True => insertPP (mkNP (appPrep vp.c2 (linNP np))) vp ; --- ba or vp.c2 ?
|
||||
False => insertObj (mkNP (appPrep vp.c2 (linNP np))) vp
|
||||
} ;
|
||||
|
||||
UseComp comp = comp ;
|
||||
@@ -44,13 +44,13 @@ concrete VerbChi of Verb = CatChi ** open ResChi, Prelude in {
|
||||
(insertObj (mkNP (infVP vp)) (predV v v.part)) ** {c2 = vp.c2 ; isPre = vp.isPre} ;
|
||||
|
||||
AdvVP vp adv = case adv.advType of {
|
||||
ATManner => insertObj (ss (deVAdv_s ++ adv.s)) vp ; -- he sleeps *well*
|
||||
ATManner => insertObj (mkNP (deVAdv_s ++ adv.s)) vp ; -- he sleeps *well*
|
||||
ATPlace True => insertAdvPost adv vp ; -- he today *in the house* sleeps
|
||||
ATPlace False => insertAdvPost (ss (zai_V.s ++ adv.s)) vp ; -- he today *here* sleeps
|
||||
ATTime | ATPoss => insertTopic adv vp -- *today* he here sleeps
|
||||
} ;
|
||||
ExtAdvVP vp adv = case adv.advType of { ---- ExtAdvVP also ?
|
||||
ATManner => insertObj (ss (deVAdv_s ++ adv.s)) vp ; -- he sleeps *well*
|
||||
ATManner => insertObj (mkNP (deVAdv_s ++ adv.s)) vp ; -- he sleeps *well*
|
||||
ATPlace True => insertAdvPost adv vp ; -- he today *in the house* sleeps
|
||||
ATPlace False => insertAdvPost (ss (zai_V.s ++ adv.s)) vp ; -- he today *here* sleeps
|
||||
ATTime | ATPoss => insertTopic adv vp -- *today* he here sleeps
|
||||
@@ -73,17 +73,17 @@ concrete VerbChi of Verb = CatChi ** open ResChi, Prelude in {
|
||||
|
||||
CompNP np = insertObj np (predV copula []) ; ----
|
||||
|
||||
CompCN cn = insertObj cn (predV copula []) ; ----
|
||||
CompCN cn = insertObj (mkNP cn.s) (predV copula []) ; ----
|
||||
|
||||
CompAdv adv = case adv.advType of {
|
||||
ATPlace True => insertObj adv (predV noVerb []) ;
|
||||
_ => insertObj adv (predV zai_V []) ---- for all others ??
|
||||
ATPlace True => insertObj (mkNP adv.s) (predV noVerb []) ;
|
||||
_ => insertObj (mkNP adv.s) (predV zai_V []) ---- for all others ??
|
||||
} ;
|
||||
|
||||
VPSlashPrep vp prep = vp ** {c2 = prep ; isPre = True} ;
|
||||
|
||||
AdvVPSlash vp adv = case adv.advType of {
|
||||
ATManner => insertObj (ss (deVAdv_s ++ adv.s)) vp ; -- he sleeps well
|
||||
ATManner => insertObj (mkNP (deVAdv_s ++ adv.s)) vp ; -- he sleeps well
|
||||
ATPlace True => insertAdv adv vp ; -- he sleeps on the table
|
||||
_ => insertAdv (ss (zai_V.s ++ adv.s)) vp -- he sleeps in the house / today
|
||||
} ** {c2 = vp.c2 ; isPre = vp.isPre} ;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
concrete CommonX of Common = open (R = ParamX) in {
|
||||
concrete CommonX of Common = open (R = ParamX), Prelude in {
|
||||
|
||||
lincat
|
||||
Text = {s : Str} ;
|
||||
@@ -20,4 +20,6 @@ concrete CommonX of Common = open (R = ParamX) in {
|
||||
Ant = {s : Str ; a : R.Anteriority} ;
|
||||
Pol = {s : Str ; p : R.Polarity} ;
|
||||
|
||||
MU = {s : Str ; isPre : Bool} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -114,6 +114,7 @@ lin
|
||||
weFem_Pron = we_Pron ; -- DEFAULT we (masc)
|
||||
youPlFem_Pron = youPl_Pron ; -- DEFAULT you plural (masc)
|
||||
theyFem_Pron = they_Pron ; -- DEFAULT they (masc)
|
||||
theyNeutr_Pron = they_Pron ; -- DEFAULT they (masc)
|
||||
youPolFem_Pron = youPol_Pron ; -- DEFAULT you polite (masc)
|
||||
youPolPl_Pron = youPl_Pron ; -- DEFAULT you plural (masc)
|
||||
youPolPlFem_Pron = youPl_Pron ; -- DEFAULT you plural (masc)
|
||||
@@ -135,6 +136,10 @@ lin
|
||||
lincat
|
||||
X = {s : Str} ;
|
||||
|
||||
lin
|
||||
UseComp_estar = UseComp ;
|
||||
UseComp_ser = UseComp ;
|
||||
|
||||
lin
|
||||
CardCNCard = variants {} ;
|
||||
|
||||
|
||||
33
src/croatian/AdjectiveHrv.gf
Normal file
33
src/croatian/AdjectiveHrv.gf
Normal file
@@ -0,0 +1,33 @@
|
||||
concrete AdjectiveHrv of Adjective = CatHrv ** open ResHrv, Prelude in {
|
||||
|
||||
lin
|
||||
|
||||
PositA a = adjFormsAdjective a.posit ** {isPost = False} ;
|
||||
|
||||
AdAP ada ap = ap ** {s = \\g,n,c => ada.s ++ ap.s ! g ! n ! c} ;
|
||||
|
||||
AdjOrd a = adjFormsAdjective a ** {isPost = False} ;
|
||||
|
||||
ComparA a np =
|
||||
let ap = adjFormsAdjective a.compar
|
||||
in
|
||||
ap ** {
|
||||
s = \\g,n,c => ap.s ! g ! n ! c ++ od_Str ++ np.s ! Gen ;
|
||||
isPost = True ;
|
||||
} ;
|
||||
|
||||
ComplA2 a np =
|
||||
let ap = adjFormsAdjective a
|
||||
in
|
||||
ap ** {
|
||||
s = \\g,n,c => ap.s ! g ! n ! c ++ a.c.s ++ np.s ! a.c.c ;
|
||||
isPost = True ;
|
||||
} ;
|
||||
|
||||
UseA2 a = adjFormsAdjective a ** {isPost = False} ;
|
||||
|
||||
UseComparA a = adjFormsAdjective a.compar ** {isPost = False} ;
|
||||
|
||||
AdvAP ap adv = ap ** {s = \\g,n,c => ap.s ! g ! n ! c ++ adv.s ; isPost = True} ;
|
||||
|
||||
}
|
||||
9
src/croatian/AdverbHrv.gf
Normal file
9
src/croatian/AdverbHrv.gf
Normal file
@@ -0,0 +1,9 @@
|
||||
concrete AdverbHrv of Adverb = CatHrv **
|
||||
open ResHrv, Prelude in {
|
||||
|
||||
lin
|
||||
PrepNP prep np = {
|
||||
s = prep.s ++ np.prep ! prep.c
|
||||
} ;
|
||||
AdnCAdv a = a ;
|
||||
}
|
||||
8
src/croatian/AllHrv.gf
Normal file
8
src/croatian/AllHrv.gf
Normal file
@@ -0,0 +1,8 @@
|
||||
--# -path=.:../abstract:../common:../api
|
||||
|
||||
concrete AllHrv of AllHrvAbs =
|
||||
LangHrv,
|
||||
ExtendHrv,
|
||||
MissingHrv
|
||||
;
|
||||
|
||||
7
src/croatian/AllHrvAbs.gf
Normal file
7
src/croatian/AllHrvAbs.gf
Normal file
@@ -0,0 +1,7 @@
|
||||
--# -path=.:../abstract:../common:prelude
|
||||
|
||||
abstract AllHrvAbs =
|
||||
Lang,
|
||||
Extend
|
||||
;
|
||||
|
||||
72
src/croatian/CatHrv.gf
Normal file
72
src/croatian/CatHrv.gf
Normal file
@@ -0,0 +1,72 @@
|
||||
concrete CatHrv of Cat =
|
||||
--- CommonX **
|
||||
|
||||
open ResHrv, Prelude in {
|
||||
|
||||
lincat
|
||||
Text = {s : Str} ;
|
||||
Phr = {s : Str} ;
|
||||
Utt = {s : Str} ;
|
||||
|
||||
S = {s : Str} ;
|
||||
Cl = {subj,clit,compl : Str ; verb : VerbForms ; a : Agr} ;
|
||||
Comp = {s : Agr => Str} ;
|
||||
|
||||
QS = {s : Str} ; ---- TODO: indirect questions
|
||||
QCl = {subj,clit,compl : Str ; verb : VerbForms ; a : Agr} ; -- = Cl ---- check if enough
|
||||
IAdv = {s : Str} ;
|
||||
|
||||
RS = {s : Agr => Str} ;
|
||||
RCl = {subj,clit,compl : Agr => Str ; verb : VerbForms} ; ---- RAgr with composite RP
|
||||
RP = AdjForms ;
|
||||
|
||||
VP = {verb : VerbForms ; clit,compl : Agr => Str} ; ---- more fields probably needed
|
||||
VPSlash = {verb : VerbForms ; clit,compl : Agr => Str ; c : ComplementCase} ; ----
|
||||
V = {s : VerbForms} ;
|
||||
V2 = {s : VerbForms ; c : ComplementCase} ;
|
||||
VS,VQ = {s : VerbForms} ;
|
||||
|
||||
A = {posit, compar, superl : AdjForms} ;
|
||||
AP = ResHrv.Adjective ** {isPost : Bool} ; -- {s : Gender => Number => Case => Str}
|
||||
A2 = ResHrv.AdjForms ** {c : ComplementCase} ;
|
||||
|
||||
AdA = {s : Str} ;
|
||||
|
||||
N = ResHrv.NounForms ** {g : Gender} ;
|
||||
CN = ResHrv.Noun ; -- {s : Number => Case => Str ; g : Gender}
|
||||
NP = {s,clit,prep : Case => Str ; a : Agr ; hasClit : Bool} ; -- clit,prep differ for pronouns
|
||||
PN = {s : Case => Str ; g : Gender} ;
|
||||
Det = Determiner ; -- {s : Gender => Case => Str ; size : NumSize} ; -- can contain a numeral, therefore NumSize
|
||||
Quant = {s : Gender => Number => Case => Str} ; -- same as AP
|
||||
Num = Determiner ;
|
||||
Card = Determiner ; -- {s : Gender => Case => Str ; size : NumSize} ;
|
||||
Ord = AdjForms ;
|
||||
Pron = PronForms ** {poss : AdjForms} ;
|
||||
|
||||
Adv = {s : Str} ;
|
||||
Prep = ResHrv.ComplementCase ; -- {s : Str ; c : Case ; hasPrep : Bool} ;
|
||||
Conj = {s1,s2 : Str} ; ---- may need a number
|
||||
|
||||
Pol = {s : Str ; p : Bool} ;
|
||||
Temp = {s : Str ; t : CTense} ;
|
||||
Tense = {s : Str ; t : CTense} ;
|
||||
Ant = {s : Str ; t : CTense} ;
|
||||
|
||||
PConj = {s : Str} ;
|
||||
Voc = {s : Str} ;
|
||||
|
||||
AdN = {s : Str} ;
|
||||
AdV = {s : Str} ;
|
||||
CAdv = {s : Str} ;
|
||||
SC = {s : Str} ;
|
||||
|
||||
linref
|
||||
N = \s -> s.snom ;
|
||||
A = \s -> s.posit.msnom ;
|
||||
V = \v -> v.s ! VInf ;
|
||||
|
||||
|
||||
lincat Numeral = {s : AdjForms ; size : NumSize} ;
|
||||
lincat Digits = {s : Str ; size : NumSize} ;
|
||||
|
||||
}
|
||||
56
src/croatian/ConjunctionHrv.gf
Normal file
56
src/croatian/ConjunctionHrv.gf
Normal file
@@ -0,0 +1,56 @@
|
||||
concrete ConjunctionHrv of Conjunction = CatHrv **
|
||||
open ResHrv, Coordination, Prelude in {
|
||||
|
||||
lincat
|
||||
[Adv] = {s1,s2 : Str} ;
|
||||
[AP] = {s1,s2 : Gender => Number => Case => Str ; isPost : Bool} ;
|
||||
[NP] = {s1,s2,prep1,prep2 : Case => Str ; a : Agr} ;
|
||||
[S] = {s1,s2 : Str} ;
|
||||
[RS] = {s1,s2 : Agr => Str} ;
|
||||
|
||||
lin
|
||||
BaseAdv = twoSS ;
|
||||
ConsAdv = consrSS comma ;
|
||||
|
||||
BaseAP x y = twoTable3 Gender Number Case x y
|
||||
** {isPost = orB x.isPost y.isPost} ; ---- should be so in Pol too
|
||||
ConsAP x xs = consrTable3 Gender Number Case comma x xs
|
||||
** {isPost = orB x.isPost xs.isPost} ;
|
||||
|
||||
BaseNP x y = {
|
||||
s1 = x.s ;
|
||||
s2 = y.s ;
|
||||
prep1 = x.prep ;
|
||||
prep2 = y.prep ;
|
||||
a = y.a
|
||||
} ; -- clitics disappear ---- Agr TODO
|
||||
ConsNP x xs = {
|
||||
s1 = \\c => x.s ! c ++ comma ++ xs.s1 ! c ;
|
||||
s2 = xs.s2 ;
|
||||
prep1 = \\c => x.prep ! c ++ comma ++ xs.prep1 ! c ;
|
||||
prep2 = xs.prep2 ;
|
||||
a = xs.a ----
|
||||
} ;
|
||||
|
||||
BaseS = twoSS ;
|
||||
ConsS = consrSS comma ;
|
||||
|
||||
BaseRS = twoTable Agr ;
|
||||
ConsRS = consrTable Agr comma ;
|
||||
|
||||
ConjAdv = conjunctDistrSS ;
|
||||
|
||||
ConjAP conj xs = conjunctDistrTable3 Gender Number Case conj xs
|
||||
** {isPost = xs.isPost} ;
|
||||
|
||||
ConjNP conj xs = {
|
||||
s,clit = \\c => conj.s1 ++ xs.s1 ! c ++ conj.s2 ++ xs.s2 ! c ;
|
||||
prep = \\c => conj.s1 ++ xs.prep1 ! c ++ conj.s2 ++ xs.prep2 ! c ;
|
||||
a = xs.a ; ---- dep. on conj as well
|
||||
hasClit = False ;
|
||||
} ;
|
||||
|
||||
ConjS = conjunctDistrSS ;
|
||||
ConjRS = conjunctDistrTable Agr ;
|
||||
|
||||
}
|
||||
43
src/croatian/ExtendHrv.gf
Normal file
43
src/croatian/ExtendHrv.gf
Normal file
@@ -0,0 +1,43 @@
|
||||
concrete ExtendHrv of Extend = CatHrv **
|
||||
ExtendFunctor - [
|
||||
--- ReflPossPron
|
||||
CardCNCard
|
||||
---- constant not found (yet)
|
||||
,youPolFem_Pron
|
||||
,UttVPShort
|
||||
,UttAccIP
|
||||
,UttDatIP
|
||||
,SubjRelNP
|
||||
,StrandRelSlash
|
||||
,StrandQuestSlash
|
||||
,SlashBareV2S
|
||||
,PredIAdvVP
|
||||
,PredAPVP
|
||||
,ExistsNP
|
||||
,ExistS
|
||||
,ExistPluralCN
|
||||
,ExistNPQS
|
||||
,ExistMassCN
|
||||
,ExistIPQS
|
||||
,ExistCN
|
||||
,EmptyRelSlash
|
||||
,DetNPMasc
|
||||
,DetNPFem
|
||||
,ComplBareVS
|
||||
,CompIQuant
|
||||
,CompBareCN
|
||||
]
|
||||
with (Grammar = GrammarHrv)
|
||||
**
|
||||
open
|
||||
ResHrv
|
||||
in {
|
||||
|
||||
---lin ReflPossPron = justDemPronFormsAdjective reflPossessivePron ;
|
||||
|
||||
lin CardCNCard card cn = {
|
||||
s = \\g,c => card.s ! g ! c ++ numSizeForm cn.s card.size c ;
|
||||
size = NS_20_
|
||||
} ;
|
||||
|
||||
}
|
||||
19
src/croatian/GrammarHrv.gf
Normal file
19
src/croatian/GrammarHrv.gf
Normal file
@@ -0,0 +1,19 @@
|
||||
--# -path=.:../abstract:../common:prelude
|
||||
|
||||
concrete GrammarHrv of Grammar =
|
||||
NounHrv,
|
||||
VerbHrv,
|
||||
AdjectiveHrv,
|
||||
AdverbHrv,
|
||||
NumeralHrv,
|
||||
SentenceHrv,
|
||||
QuestionHrv,
|
||||
RelativeHrv,
|
||||
ConjunctionHrv,
|
||||
PhraseHrv,
|
||||
TextHrv,
|
||||
StructuralHrv,
|
||||
IdiomHrv,
|
||||
TenseHrv
|
||||
** {
|
||||
}
|
||||
13
src/croatian/IdiomHrv.gf
Normal file
13
src/croatian/IdiomHrv.gf
Normal file
@@ -0,0 +1,13 @@
|
||||
concrete IdiomHrv of Idiom = CatHrv ** open Prelude, ResHrv in {
|
||||
|
||||
lin
|
||||
ExistNP np = { ---- TODO verify this
|
||||
subj = np.s ! Nom ;
|
||||
verb = copula_VerbForms ;
|
||||
clit, compl = [] ;
|
||||
a = np.a
|
||||
} ;
|
||||
|
||||
ExistNPAdv np adv = ExistNP np ** {compl = adv.s} ;
|
||||
|
||||
}
|
||||
10
src/croatian/LangHrv.gf
Normal file
10
src/croatian/LangHrv.gf
Normal file
@@ -0,0 +1,10 @@
|
||||
--# -path=.:../abstract:../common:../api
|
||||
|
||||
concrete LangHrv of Lang =
|
||||
GrammarHrv,
|
||||
LexiconHrv
|
||||
-- ,ConstructionHrv
|
||||
-- ,DocumentationHrv --# notpresent
|
||||
** {
|
||||
|
||||
}
|
||||
19
src/croatian/LexiconHrv.gf
Normal file
19
src/croatian/LexiconHrv.gf
Normal file
@@ -0,0 +1,19 @@
|
||||
concrete LexiconHrv of Lexicon =
|
||||
CatHrv
|
||||
**
|
||||
open
|
||||
ResHrv, ParadigmsHrv
|
||||
in {
|
||||
|
||||
|
||||
lin
|
||||
cat_N = mkN "mačka" ;
|
||||
black_A = mkA "crni" ;
|
||||
love_V2 = mkV2 (mkV "voljeti" "volim" "volio") ;
|
||||
see_V2 = mkV2 (mkV "vidjeti" "vidim" "vidio") ;
|
||||
walk_V = mkV "hodati" ;
|
||||
|
||||
man_N = mkN "čovjek" ;
|
||||
woman_N = mkN "žena" ;
|
||||
}
|
||||
|
||||
99
src/croatian/MissingHrv.gf
Normal file
99
src/croatian/MissingHrv.gf
Normal file
@@ -0,0 +1,99 @@
|
||||
resource MissingHrv = open GrammarHrv, SymbolHrv, Prelude, PredefCnc in {
|
||||
|
||||
-- temporary definitions to enable the compilation of RGL API
|
||||
oper AAnter : Ant = notYet "AAnter" ;
|
||||
oper AdAdv : AdA -> Adv -> Adv = notYet "AdAdv" ;
|
||||
oper AdVVP : AdV -> VP -> VP = notYet "AdVVP" ;
|
||||
oper AdvIAdv : IAdv -> Adv -> IAdv = notYet "AdvIAdv" ;
|
||||
oper AdvIP : IP -> Adv -> IP = notYet "AdvIP" ;
|
||||
oper AdvS : Adv -> S -> S = notYet "AdvS" ;
|
||||
oper AdvSlash : ClSlash -> Adv -> ClSlash = notYet "AdvSlash" ;
|
||||
oper CAdvAP : CAdv -> AP -> NP -> AP = notYet "CAdvAP" ;
|
||||
oper CleftAdv : Adv -> S -> Cl = notYet "CleftAdv" ;
|
||||
oper CleftNP : NP -> RS -> Cl = notYet "CleftNP" ;
|
||||
oper CompCN : CN -> Comp = notYet "CompCN" ;
|
||||
oper CompIAdv : IAdv -> IComp = notYet "CompIAdv" ;
|
||||
oper CompIP : IP -> IComp = notYet "CompIP" ;
|
||||
oper ComparAdvAdj : CAdv -> A -> NP -> Adv = notYet "ComparAdvAdj" ;
|
||||
oper ComparAdvAdjS : CAdv -> A -> S -> Adv = notYet "ComparAdvAdjS" ;
|
||||
oper ComplN2 : N2 -> NP -> CN = notYet "ComplN2" ;
|
||||
oper ComplN3 : N3 -> NP -> N2 = notYet "ComplN3" ;
|
||||
oper ComplVA : VA -> AP -> VP = notYet "ComplVA" ;
|
||||
oper ComplVQ : VQ -> QS -> VP = notYet "ComplVQ" ;
|
||||
oper ComplVS : VS -> S -> VP = notYet "ComplVS" ;
|
||||
oper ComplVV : VV -> VP -> VP = notYet "ComplVV" ;
|
||||
oper DetQuantOrd : Quant -> Num -> Ord -> Det = notYet "DetQuantOrd" ;
|
||||
oper EmbedQS : QS -> SC = notYet "EmbedQS" ;
|
||||
oper EmbedS : S -> SC = notYet "EmbedS" ;
|
||||
oper EmbedVP : VP -> SC = notYet "EmbedVP" ;
|
||||
oper ExistIP : IP -> QCl = notYet "ExistIP" ;
|
||||
oper FunRP : Prep -> NP -> RP -> RP = notYet "FunRP" ;
|
||||
oper GenericCl : VP -> Cl = notYet "GenericCl" ;
|
||||
oper IdetCN : IDet -> CN -> IP = notYet "IdetCN" ;
|
||||
oper IdetIP : IDet -> IP = notYet "IdetIP" ;
|
||||
oper IdetQuant : IQuant -> Num -> IDet = notYet "IdetQuant" ;
|
||||
oper ImpPl1 : VP -> Utt = notYet "ImpPl1" ;
|
||||
oper ImpVP : VP -> Imp = notYet "ImpVP" ;
|
||||
oper ImpersCl : VP -> Cl = notYet "ImpersCl" ;
|
||||
oper OrdDigits : Digits -> Ord = notYet "OrdDigits" ;
|
||||
oper OrdNumeral : Numeral -> Ord = notYet "OrdNumeral" ;
|
||||
oper PPartNP : NP -> V2 -> NP = notYet "PPartNP" ;
|
||||
oper PassV2 : V2 -> VP = notYet "PassV2" ;
|
||||
oper PositAdvAdj : A -> Adv = notYet "PositAdvAdj" ;
|
||||
oper PredSCVP : SC -> VP -> Cl = notYet "PredSCVP" ;
|
||||
oper PredetNP : Predet -> NP -> NP = notYet "PredetNP" ;
|
||||
oper PrepIP : Prep -> IP -> IAdv = notYet "PrepIP" ;
|
||||
oper ProgrVP : VP -> VP = notYet "ProgrVP" ;
|
||||
oper QuestIAdv : IAdv -> Cl -> QCl = notYet "QuestIAdv" ;
|
||||
oper QuestIComp : IComp -> NP -> QCl = notYet "QuestIComp" ;
|
||||
oper QuestSlash : IP -> ClSlash -> QCl = notYet "QuestSlash" ;
|
||||
oper QuestVP : IP -> VP -> QCl = notYet "QuestVP" ;
|
||||
oper ReflA2 : A2 -> AP = notYet "ReflA2" ;
|
||||
oper ReflVP : VPSlash -> VP = notYet "ReflVP" ;
|
||||
oper RelCl : Cl -> RCl = notYet "RelCl" ;
|
||||
oper RelNP : NP -> RS -> NP = notYet "RelNP" ;
|
||||
oper RelSlash : RP -> ClSlash -> RCl = notYet "RelSlash" ;
|
||||
oper SentAP : AP -> SC -> AP = notYet "SentAP" ;
|
||||
oper SentCN : CN -> SC -> CN = notYet "SentCN" ;
|
||||
oper Slash2V3 : V3 -> NP -> VPSlash = notYet "Slash2V3" ;
|
||||
oper Slash3V3 : V3 -> NP -> VPSlash = notYet "Slash3V3" ;
|
||||
oper SlashPrep : Cl -> Prep -> ClSlash = notYet "SlashPrep" ;
|
||||
oper SlashV2A : V2A -> AP -> VPSlash = notYet "SlashV2A" ;
|
||||
oper SlashV2Q : V2Q -> QS -> VPSlash = notYet "SlashV2Q" ;
|
||||
oper SlashV2S : V2S -> S -> VPSlash = notYet "SlashV2S" ;
|
||||
oper SlashV2V : V2V -> VP -> VPSlash = notYet "SlashV2V" ;
|
||||
oper SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash = notYet "SlashV2VNP" ;
|
||||
oper SlashVP : NP -> VPSlash -> ClSlash = notYet "SlashVP" ;
|
||||
oper SlashVS : NP -> VS -> SSlash -> ClSlash = notYet "SlashVS" ;
|
||||
oper SlashVV : VV -> VPSlash -> VPSlash = notYet "SlashVV" ;
|
||||
oper SubjS : Subj -> S -> Adv = notYet "SubjS" ;
|
||||
oper TCond : Tense = notYet "TCond" ;
|
||||
oper TFut : Tense = notYet "TFut" ;
|
||||
oper Use2N3 : N3 -> N2 = notYet "Use2N3" ;
|
||||
oper UseN2 : N2 -> CN = notYet "UseN2" ;
|
||||
oper UseSlash : Temp -> Pol -> ClSlash -> SSlash = notYet "UseSlash" ;
|
||||
oper UttCard : Card -> Utt = notYet "UttCard" ;
|
||||
oper UttIAdv : IAdv -> Utt = notYet "UttIAdv" ;
|
||||
oper UttIP : IP -> Utt = notYet "UttIP" ;
|
||||
oper UttImpPl : Pol -> Imp -> Utt = notYet "UttImpPl" ;
|
||||
oper UttImpPol : Pol -> Imp -> Utt = notYet "UttImpPol" ;
|
||||
oper UttImpSg : Pol -> Imp -> Utt = notYet "UttImpSg" ;
|
||||
oper UttQS : QS -> Utt = notYet "UttQS" ;
|
||||
oper UttVP : VP -> Utt = notYet "UttVP" ;
|
||||
oper by8agent_Prep : Prep = notYet "by8agent_Prep" ;
|
||||
oper whatSg_IP : IP = notYet "whatSg_IP" ;
|
||||
oper which_IQuant : IQuant = notYet "which_IQuant" ;
|
||||
oper whoSg_IP : IP = notYet "whoSg_IP" ;
|
||||
oper youPol_Pron : Pron = notYet "youPol_Pron" ;
|
||||
|
||||
oper BaseSymb : Symb -> Symb -> [Symb] = notYet "BaseSymb" ;
|
||||
oper CNIntNP : CN -> PredefCnc.Int -> NP = notYet "CNIntNP" ;
|
||||
oper CNNumNP : CN -> Card -> NP = notYet "CNumNP" ;
|
||||
oper CNSymbNP : Det -> CN -> [Symb] -> NP = notYet "CNSymbNP" ;
|
||||
oper ConsSymb : Symb -> [Symb] -> [Symb] = notYet "ConsSymb" ;
|
||||
oper FloatPN : PredefCnc.Float -> PN = notYet "FloatPN" ;
|
||||
oper NumPN : Card -> PN = notYet "NumPN" ;
|
||||
oper SymbOrd : Symb -> Ord = notYet "SymbOrd" ;
|
||||
oper SymbS : Symb -> S = notYet "SymbS" ;
|
||||
|
||||
}
|
||||
101
src/croatian/NounHrv.gf
Normal file
101
src/croatian/NounHrv.gf
Normal file
@@ -0,0 +1,101 @@
|
||||
concrete NounHrv of Noun =
|
||||
CatHrv
|
||||
**
|
||||
|
||||
open ResHrv, Prelude in {
|
||||
|
||||
lin
|
||||
DetCN det cn = {
|
||||
s,prep,clit = \\c => det.s ! cn.g ! c ++ numSizeForm cn.s det.size c ;
|
||||
a = numSizeAgr cn.g det.size P3 ;
|
||||
hasClit = False ;
|
||||
} ;
|
||||
|
||||
DetNP det = {
|
||||
s,prep,clit = \\c => det.s ! Neutr ! c ;
|
||||
a = numSizeAgr Neutr det.size P3 ;
|
||||
hasClit = False ;
|
||||
} ;
|
||||
|
||||
MassNP cn = {
|
||||
s,prep,clit = \\c => cn.s ! Sg ! c ;
|
||||
a = Ag cn.g Sg P3 ;
|
||||
hasClit = False ;
|
||||
} ;
|
||||
|
||||
DetQuant quant num = {
|
||||
s = \\g,c => num.s ! g ! c ++ quant.s ! g ! numSizeNumber num.size ! c ;
|
||||
size = num.size
|
||||
} ;
|
||||
|
||||
DefArt = {s = \\_,_,_ => []} ;
|
||||
IndefArt = {s = \\_,_,_ => []} ;
|
||||
NumPl = {s = \\_,_ => [] ; size = NS_2_4} ; ---- size
|
||||
NumSg = {s = \\_,_ => [] ; size = NS_1} ;
|
||||
|
||||
UsePron pron = {
|
||||
s, prep = table { ---- TODO check prep
|
||||
Nom | Voc => pron.nom ;
|
||||
Gen | Acc => pron.gen ;
|
||||
Dat | Loc => pron.dat ;
|
||||
Ins => pron.ins
|
||||
} ;
|
||||
clit = table { ---- TODO check prep
|
||||
Nom | Voc => pron.nom ;
|
||||
Gen | Acc => pron.cgen ;
|
||||
Dat | Loc => pron.cdat ;
|
||||
Ins => pron.ins
|
||||
} ;
|
||||
a = pron.a ;
|
||||
hasClit = True ;
|
||||
} ;
|
||||
|
||||
PossPron pron = adjFormsAdjective pron.poss ;
|
||||
|
||||
UsePN pn = {
|
||||
s,clit,prep = \\c => pn.s ! c ;
|
||||
a = Ag pn.g Sg P3 ;
|
||||
hasClit = False ;
|
||||
} ;
|
||||
|
||||
AdjCN ap cn = {
|
||||
s = \\n,c => preOrPost (notB ap.isPost) (ap.s ! cn.g ! n ! c) (cn.s ! n ! c) ;
|
||||
g = cn.g
|
||||
} ;
|
||||
|
||||
RelCN cn rs = {
|
||||
s = \\n,c => cn.s ! n ! c ++ rs.s ! Ag cn.g n P3 ;
|
||||
g = cn.g
|
||||
} ;
|
||||
|
||||
AdvCN cn adv = {
|
||||
s = \\n,c => cn.s ! n ! c ++ adv.s ;
|
||||
g = cn.g
|
||||
} ;
|
||||
|
||||
AdvNP np adv = {
|
||||
s,clit = \\c => np.s ! c ++ adv.s ;
|
||||
prep = \\c => np.prep ! c ++ adv.s ;
|
||||
a = np.a ;
|
||||
hasClit = False ;
|
||||
} ;
|
||||
|
||||
UseN n = nounFormsNoun n n.g ;
|
||||
|
||||
ApposCN cn np = {
|
||||
s = \\n,c => cn.s ! n ! c ++ np.s ! c ; ---- TODO check apposition order
|
||||
g = cn.g
|
||||
} ;
|
||||
|
||||
NumCard c = c ;
|
||||
NumDigits ds = ds ** {s = \\_,_ => ds.s} ;
|
||||
NumNumeral nu = {
|
||||
s = \\g,c => (adjFormsAdjective nu.s).s ! g ! Sg ! c ; ---- TODO Sg?
|
||||
size = nu.size
|
||||
} ;
|
||||
|
||||
AdNum adn card = card ** {s = \\g,c => adn.s ++ card.s ! g ! c} ;
|
||||
OrdSuperl a = a.superl ;
|
||||
|
||||
|
||||
}
|
||||
139
src/croatian/NumeralHrv.gf
Normal file
139
src/croatian/NumeralHrv.gf
Normal file
@@ -0,0 +1,139 @@
|
||||
concrete NumeralHrv of Numeral =
|
||||
|
||||
CatHrv [Numeral, Digits] **
|
||||
|
||||
open
|
||||
ResHrv,
|
||||
Prelude
|
||||
in {
|
||||
|
||||
-- AR 2022-09-27
|
||||
---- TODO ordinal forms
|
||||
|
||||
oper LinNumeral = {s : AdjForms ; size : NumSize} ;
|
||||
oper LinDigit = {unit : AdjForms ; teen, ten, hundred : Str ; size : NumSize} ;
|
||||
|
||||
lincat Digit = LinDigit ;
|
||||
lincat Sub10 = LinDigit ;
|
||||
|
||||
lincat Sub100 = LinNumeral ;
|
||||
lincat Sub1000 = LinNumeral ;
|
||||
lincat Sub1000000 = LinNumeral ;
|
||||
|
||||
oper mkDigit : AdjForms -> Str -> Str -> Str -> NumSize -> LinDigit =
|
||||
\dva, dvanaest, dvadeset, dvjesto, size -> {
|
||||
unit = dva ;
|
||||
teen = dvanaest ;
|
||||
ten = dvadeset ;
|
||||
hundred = dvjesto ;
|
||||
size = size
|
||||
} ;
|
||||
|
||||
oper mkBigDigit : (unit, teen, ten, hundred : Str) -> LinDigit =
|
||||
\unit,ten,teen,hundred -> mkDigit (invarAdjForms unit) ten teen hundred NS_5_20 ;
|
||||
|
||||
oper bigNumeral : Str -> LinNumeral = \s -> {
|
||||
s = invarAdjForms s ;
|
||||
size = NS_20_
|
||||
} ;
|
||||
|
||||
lin num x = x ;
|
||||
|
||||
lin n2 =
|
||||
let
|
||||
dva = invarAdjForms "dva" ** { --- BCMS: cases rarely used
|
||||
fsnom, fsacc = "dvije" ;
|
||||
msgen = "dvaju" ;
|
||||
fsgen = "dviju" ;
|
||||
msdat = "dvama" ;
|
||||
fsdat = "dvjema"
|
||||
}
|
||||
in mkDigit dva "dvanaest" "dvadeset" "dvjesto" NS_2_4 ;
|
||||
|
||||
lin n3 =
|
||||
let
|
||||
tri = invarAdjForms "tri" ** { --- BCMS: cases rarely used
|
||||
msgen, fsgen = "triju" ;
|
||||
msdat, fsdat, msloc, mksins = "trima"
|
||||
}
|
||||
in
|
||||
mkDigit tri "trinaest" "trideset" "tristo" NS_2_4 ;
|
||||
|
||||
lin n4 =
|
||||
let
|
||||
cetiri = invarAdjForms "četiri" ** { --- BCMS: cases rarely used
|
||||
msgen, fsgen = "četiriju" ;
|
||||
msdat, fsdat, msloc, mksins = "četirima"
|
||||
}
|
||||
in
|
||||
mkDigit cetiri "četrnaest" "četrdeset" "četiristo" NS_2_4 ;
|
||||
|
||||
lin n5 = mkBigDigit "pet" "petnaest" "pedeset" "petsto" ;
|
||||
lin n6 = mkBigDigit "šest" "šesnaest" "šezdeset" "šeststo" ;
|
||||
lin n7 = mkBigDigit "sedam" "sedamnaest" "sedamdeset" "sedamsto" ;
|
||||
lin n8 = mkBigDigit "osam" "osamnaest" "osamdeset" "osamsto" ;
|
||||
lin n9 = mkBigDigit "devet" "devetnaest" "devedeset" "devetsto" ;
|
||||
|
||||
lin pot01 = mkDigit (velikA "jedan") "jedanaest" "deset" "sto" NS_1 ;
|
||||
lin pot0 d = d ;
|
||||
|
||||
|
||||
lin pot110 = bigNumeral "deset" ;
|
||||
lin pot111 = bigNumeral "jedanaest" ;
|
||||
lin pot1to19 d = bigNumeral d.teen ;
|
||||
|
||||
lin pot0as1 n = {s = n.unit ; size = n.size} ;
|
||||
lin pot1 d = bigNumeral d.ten ;
|
||||
lin pot1plus d e = {
|
||||
s = invarAdjForms (d.ten ++ e.unit.msnom) ; ---- TODO inflection of e
|
||||
size = e.size
|
||||
} ;
|
||||
|
||||
lin pot1as2 n = n ;
|
||||
lin pot2 d = bigNumeral d.hundred ;
|
||||
lin pot2plus d e = {
|
||||
s = invarAdjForms (d.hundred ++ e.s.msnom) ; ---- TODO inflection of e
|
||||
size = e.size
|
||||
} ;
|
||||
|
||||
lin pot2as3 n = n ;
|
||||
|
||||
|
||||
lin pot3 n = bigNumeral (mkThousand n.s.fsnom n.size) ;
|
||||
|
||||
lin pot3plus n m = {
|
||||
s = invarAdjForms (mkThousand n.s.fsnom n.size ++ m.s.msnom) ; ---- TODO inflect m
|
||||
size = m.size
|
||||
} ;
|
||||
|
||||
----oper tfSize : NumSize -> NumSize = \sz ->
|
||||
---- table {Num1 => Num5 ; other => other} ! sz ;
|
||||
|
||||
oper mkThousand : Str -> NumSize -> Str = \attr,size ->
|
||||
case size of {
|
||||
NS_1 => "tisuću" ; -- BMS: hiljadu etc
|
||||
NS_2_4 => attr ++ "tisuće" ;
|
||||
_ => attr ++ "tisuća"
|
||||
} ;
|
||||
|
||||
|
||||
-- -- Numerals as sequences of digits have a separate, simpler grammar
|
||||
lincat Dig = {s : Str ; size : NumSize} ;
|
||||
|
||||
lin
|
||||
IDig d = d ;
|
||||
|
||||
IIDig d dd = {s = d.s ++ Predef.BIND ++ dd.s ; size = dd.size} ;
|
||||
|
||||
D_0 = { s = "0" ; size = NS_1} ; ---- ??
|
||||
D_1 = { s = "1" ; size = NS_1} ;
|
||||
D_2 = { s = "2" ; size = NS_2_4} ;
|
||||
D_3 = { s = "3" ; size = NS_2_4} ;
|
||||
D_4 = { s = "4" ; size = NS_2_4} ;
|
||||
D_5 = { s = "5" ; size = NS_5_20} ;
|
||||
D_6 = { s = "6" ; size = NS_5_20} ;
|
||||
D_7 = { s = "7" ; size = NS_5_20} ;
|
||||
D_8 = { s = "8" ; size = NS_5_20} ;
|
||||
D_9 = { s = "9" ; size = NS_5_20} ;
|
||||
|
||||
}
|
||||
246
src/croatian/ParadigmsHrv.gf
Normal file
246
src/croatian/ParadigmsHrv.gf
Normal file
@@ -0,0 +1,246 @@
|
||||
resource ParadigmsHrv = open CatHrv, ResHrv, (R=ResHrv), Prelude in {
|
||||
|
||||
----------------
|
||||
-- Parameters
|
||||
|
||||
oper
|
||||
singular : Number
|
||||
= Sg ;
|
||||
plural : Number
|
||||
= Pl ;
|
||||
|
||||
mascAnimate : Gender
|
||||
= Masc Anim ;
|
||||
mascInanimate : Gender
|
||||
= Masc Inanim ;
|
||||
masculine : Gender
|
||||
= Masc Inanim ;
|
||||
feminine : Gender
|
||||
= Fem ;
|
||||
neuter : Gender
|
||||
= Neutr ;
|
||||
|
||||
nominative : Case
|
||||
= Nom ;
|
||||
genitive : Case
|
||||
= Gen ;
|
||||
dative : Case
|
||||
= Dat ;
|
||||
accusative : Case
|
||||
= Acc ;
|
||||
vocative : Case
|
||||
= R.Voc ;
|
||||
locative : Case
|
||||
= Loc ;
|
||||
instrumental : Case
|
||||
= Ins ;
|
||||
|
||||
------------------------------
|
||||
-- Nouns
|
||||
|
||||
oper
|
||||
|
||||
mkN = overload {
|
||||
mkN : (sgnom : Str) -> N -- guessing gender
|
||||
= \sgnom -> lin N (smartLexNoun sgnom) ;
|
||||
mkN : (sgnom : Str) -> Gender -> N
|
||||
= \sgnom, g -> lin N (mkgLexNoun sgnom g) ;
|
||||
mkN : NForms -> Gender -> N -- the worst case
|
||||
= \nfs,g -> lin N (nfs ** {g = g}) ;
|
||||
} ;
|
||||
|
||||
-- The following standard declensions can be used with good accuracy.
|
||||
-- However, they have some defaults that may have to be overwritten.
|
||||
-- This can be done easily by overriding those formes with record extension (**).
|
||||
|
||||
NForms = {snom,sgen,sdat,sacc,svoc,sins,pnom,pgen,pdat,pacc : Str} ;
|
||||
|
||||
izvorNForms : Str -> NForms
|
||||
= izvorN ;
|
||||
nokatNForms : Str -> NForms
|
||||
= nokatN ;
|
||||
gradaninNForms : Str -> NForms
|
||||
= gradaninN ;
|
||||
vojnikNForms : Str -> NForms
|
||||
= vojnikN ;
|
||||
bubregNForms : Str -> NForms
|
||||
= bubregN ;
|
||||
trbuhNForms : Str -> NForms
|
||||
= trbuhN ;
|
||||
cvorakNForms : Str -> NForms
|
||||
= cvorakN ;
|
||||
panjNForms : Str -> NForms
|
||||
= panjN ;
|
||||
suzanjNForms : Str -> NForms
|
||||
= suzanjN ;
|
||||
pristNForms : Str -> NForms
|
||||
= pristN ;
|
||||
stricNForms : Str -> NForms
|
||||
= stricN ;
|
||||
klinacNForms : Str -> NForms
|
||||
= klinacN ;
|
||||
posjetilacNForms : Str -> NForms
|
||||
= posjetilacN ;
|
||||
pepeoNForms : Str -> NForms
|
||||
= pepeoN ;
|
||||
ugaoNForms : Str -> NForms
|
||||
= ugaoN ;
|
||||
bifeNForms : Str -> NForms
|
||||
= bifeN ;
|
||||
ziriNForms : Str -> NForms
|
||||
= ziriN ;
|
||||
taksiNForms : Str -> NForms
|
||||
= taksiN ;
|
||||
koljenoNForms : Str -> NForms
|
||||
= koljenoN ;
|
||||
jedroNForms : Str -> NForms
|
||||
= jedroN ;
|
||||
poljeNForms : Str -> NForms
|
||||
= poljeN ;
|
||||
zenaNForms : Str -> NForms
|
||||
= zenaN ;
|
||||
|
||||
PNForms : Type = {snom, sgen, sdat, sacc, svoc, sins : Str} ;
|
||||
|
||||
mkPN = overload {
|
||||
mkPN : Str -> PN
|
||||
= \s ->
|
||||
let
|
||||
nf = smartLexNoun s ;
|
||||
n = nounFormsNoun nf nf.g
|
||||
in lin PN {
|
||||
s = \\c => n.s ! Sg ! c ; ---- TODO check this
|
||||
g = nf.g
|
||||
} ;
|
||||
mkPN : PNForms -> Gender -> PN
|
||||
= \fs, g -> lin PN {
|
||||
s = table {
|
||||
Nom => fs.snom ;
|
||||
Gen => fs.sgen ;
|
||||
Dat | Loc => fs.sdat ;
|
||||
Acc => fs.sacc ;
|
||||
Voc => fs.svoc ;
|
||||
Ins => fs.sins
|
||||
} ;
|
||||
g = g
|
||||
} ;
|
||||
} ;
|
||||
|
||||
---------------------
|
||||
-- Adjectives
|
||||
|
||||
-- Only positive forms so far ----
|
||||
|
||||
mkA = overload {
|
||||
mkA : Str -> A
|
||||
= \s ->
|
||||
let
|
||||
velik = velikA s ;
|
||||
velikiji = regComparAForms velik ;
|
||||
in lin A {
|
||||
posit = velik ;
|
||||
compar = velikiji ;
|
||||
superl = superlAForms velikiji
|
||||
} ;
|
||||
mkA : (pos, comp : Str) -> A
|
||||
= \pos, comp -> lin A {
|
||||
posit = velikA pos ;
|
||||
compar = velikA comp ;
|
||||
superl = superlAForms (velikA comp)
|
||||
} ;
|
||||
mkA : (posit : AForms) -> (compar : Str) -> A
|
||||
= \posit,compar -> lin A {
|
||||
posit = posit ;
|
||||
compar = velikA compar ;
|
||||
superl = superlAForms (velikA compar)
|
||||
} ;
|
||||
mkA : (posit, compar : AForms) -> A
|
||||
= \posit,compar -> lin A {
|
||||
posit = posit ;
|
||||
compar = compar ;
|
||||
superl = superlAForms compar
|
||||
} ;
|
||||
mkA : (posit : AForms) -> A
|
||||
= \posit ->
|
||||
let
|
||||
compar = regComparAForms posit
|
||||
in lin A {
|
||||
posit = posit ;
|
||||
compar = compar ;
|
||||
superl = superlAForms compar
|
||||
} ;
|
||||
} ;
|
||||
|
||||
invarA : Str -> A
|
||||
= \s -> lin A {posit,compar,superl = invarAForms s} ; ---- TODO compar, superl?
|
||||
|
||||
AForms : Type
|
||||
= R.AdjForms ;
|
||||
|
||||
-- the complete definition of AForms is
|
||||
-- {msnom, fsnom, nsnom, msgen, fsgen, msdat,
|
||||
-- fsdat, fsacc, msloc, msins, fsins, mpnom, pgen : Str} ;
|
||||
|
||||
velikAForms : Str -> AForms
|
||||
= velikA ;
|
||||
|
||||
invarAForms : Str -> AForms
|
||||
= \s -> invarAdjForms s ;
|
||||
|
||||
|
||||
-------------------------
|
||||
-- Verbs
|
||||
|
||||
mkV = overload {
|
||||
mkV : (raditi : Str) -> V
|
||||
= \s -> lin V {s = smartVerbForms s} ;
|
||||
mkV : (raditi, radem, radio : Str) -> V
|
||||
= \raditi, radem, radio ->
|
||||
lin V {s = aeiVerbForms raditi radem radio} ;
|
||||
mkV : VerbForms -> V
|
||||
= \vf -> lin V {s = vf} ;
|
||||
} ;
|
||||
|
||||
|
||||
mkV2 = overload {
|
||||
mkV2 : V -> V2
|
||||
= \v -> lin V2 {s = v.s ;
|
||||
c = {s = [] ; c = accusative ; hasPrep = False}} ;
|
||||
mkV2 : V -> Case -> V2
|
||||
= \v,c -> lin V2 {s = v.s ;
|
||||
c = {s = [] ; c = c ; hasPrep = False}} ;
|
||||
mkV2 : V -> Prep -> V2
|
||||
= \v,c -> lin V2 {s = v.s ; c = c} ;
|
||||
} ;
|
||||
|
||||
------------------------
|
||||
-- Adverbs, prepositions, conjunctions, ...
|
||||
|
||||
mkAdv : Str -> Adv
|
||||
= \s -> lin Adv {s = s} ;
|
||||
|
||||
mkPrep = overload {
|
||||
mkPrep : Str -> Prep -- genitive prepositions
|
||||
= \s -> lin Prep {s = s ; c = genitive ; hasPrep = True} ;
|
||||
mkPrep : Case -> Prep -- oblique cases, empty string
|
||||
= \c -> lin Prep {s = [] ; c = c ; hasPrep = False} ;
|
||||
mkPrep : Str -> Case -> Prep
|
||||
= \s,c -> lin Prep {s = s ; c = c ; hasPrep = True} ;
|
||||
} ;
|
||||
|
||||
mkConj : Str -> Conj
|
||||
= \s -> lin Conj {s1 = [] ; s2 = s} ;
|
||||
|
||||
mkAdN : Str -> AdN
|
||||
= \s -> lin AdN {s = s} ;
|
||||
|
||||
mkOrd : Str -> Ord
|
||||
= \s -> lin Ord (velikA s) ;
|
||||
|
||||
ifPluralNP : NP -> Bool
|
||||
= \np -> case np.a of {
|
||||
Ag _ Pl _ => True ;
|
||||
_ => False
|
||||
} ;
|
||||
|
||||
}
|
||||
19
src/croatian/PhraseHrv.gf
Normal file
19
src/croatian/PhraseHrv.gf
Normal file
@@ -0,0 +1,19 @@
|
||||
concrete PhraseHrv of Phrase = CatHrv ** open Prelude, ResHrv in {
|
||||
|
||||
lin
|
||||
UttS s = s ;
|
||||
UttAdv adv = adv ;
|
||||
UttCN cn = {s = cn.s ! Sg ! Nom} ;
|
||||
UttAP ap = {s = ap.s ! Masc Anim ! Sg ! Nom} ;
|
||||
UttNP np = {s = np.s ! Nom} ;
|
||||
|
||||
PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ;
|
||||
|
||||
|
||||
NoPConj = {s = []} ;
|
||||
PConjConj conj = {s = conj.s2} ;
|
||||
|
||||
NoVoc = {s = []} ;
|
||||
VocNP np = {s = np.s ! Nom} ;
|
||||
|
||||
}
|
||||
7
src/croatian/QuestionHrv.gf
Normal file
7
src/croatian/QuestionHrv.gf
Normal file
@@ -0,0 +1,7 @@
|
||||
concrete QuestionHrv of Question = CatHrv **
|
||||
open ResHrv, Prelude in {
|
||||
|
||||
lin
|
||||
QuestCl cl = cl ; ----
|
||||
|
||||
}
|
||||
18
src/croatian/RelativeHrv.gf
Normal file
18
src/croatian/RelativeHrv.gf
Normal file
@@ -0,0 +1,18 @@
|
||||
concrete RelativeHrv of Relative = CatHrv ** open
|
||||
ParadigmsHrv,
|
||||
ResHrv,
|
||||
Prelude in {
|
||||
|
||||
lin
|
||||
RelVP rp vp = vp ** {
|
||||
subj =
|
||||
let rel = (adjFormsAdjective rp).s
|
||||
in \\a => case a of {
|
||||
Ag g n _ => rel ! g ! n ! Nom
|
||||
}
|
||||
} ;
|
||||
|
||||
IdRP = (mkA "koji").posit ;
|
||||
|
||||
|
||||
}
|
||||
659
src/croatian/ResHrv.gf
Normal file
659
src/croatian/ResHrv.gf
Normal file
@@ -0,0 +1,659 @@
|
||||
resource ResHrv = open Prelude in {
|
||||
|
||||
-- AR September 2022
|
||||
-- sources:
|
||||
-- Wiki = https://en.wikipedia.org/wiki/Serbo-Croatian_grammar
|
||||
-- BCMS = Bosnian, Croatian, Montenegrin and Serbian:
|
||||
-- An Essential Grammar (Routledge Essential Grammars) 1st Edition, by Željko Vrabec
|
||||
|
||||
-- parameters
|
||||
|
||||
param
|
||||
Number = Sg | Pl ;
|
||||
|
||||
Animacy = Anim | Inanim ;
|
||||
Gender = Masc Animacy | Fem | Neutr ;
|
||||
|
||||
Case = Nom | Gen | Dat | Acc | Voc | Loc | Ins ; -- traditional order
|
||||
|
||||
Person = P1 | P2 | P3 ;
|
||||
|
||||
VForm =
|
||||
VInf
|
||||
| VPres Number Person
|
||||
| VPastPart Gender Number
|
||||
;
|
||||
---- TODO aorist, imperfect
|
||||
|
||||
Agr = Ag Gender Number Person ;
|
||||
|
||||
CTense = CTPres | CTPast ; ----- TODO complete the tense system to match BCS verb morphology
|
||||
|
||||
-- phonology
|
||||
|
||||
oper
|
||||
softConsonant : pattern Str = #("c"|"č"|"ć"|"đ"|"j"|"lj"|"nj"|"š"|"ž"|"št") ;
|
||||
--- wiki "and sometimes r"; BCMS slightly different
|
||||
|
||||
ifSoft : Str -> (soft,hard : Str) -> Str = \word, ssoft, shard ->
|
||||
case word of {
|
||||
_ + #softConsonant => ssoft ;
|
||||
_ => shard
|
||||
} ;
|
||||
|
||||
animate = Masc Anim ;
|
||||
inanimate = Masc Inanim ;
|
||||
feminine = Fem ;
|
||||
neuter = Neutr ;
|
||||
|
||||
palatalize : Str -> Str = \s -> case s of {
|
||||
x + "ki" => x + "ci" ;
|
||||
x + "ke" => x + "če" ;
|
||||
x + "gi" => x + "zi" ;
|
||||
x + "ge" => x + "že" ;
|
||||
x + "hi" => x + "si" ;
|
||||
x + "he" => x + "še" ;
|
||||
x + "ce" => x + "če" ;
|
||||
_ => s
|
||||
} ;
|
||||
|
||||
voicing : Str -> Str = \s -> case s of {
|
||||
x + "b" => x + "p" ;
|
||||
x + "d" => x + "t" ;
|
||||
x + "đ" => x + "ć" ;
|
||||
x + "z" => x + "s" ;
|
||||
x + "dž" => x + "č" ;
|
||||
x + "ž" => x + "š" ;
|
||||
_ => s
|
||||
} ;
|
||||
|
||||
---------------
|
||||
-- Nouns
|
||||
---------------
|
||||
|
||||
-- novel idea (for RGL): lexical items stored as records rather than tables
|
||||
-- advantages:
|
||||
-- - easier to make exceptions to paradigms (by ** {})
|
||||
-- - easier to keep the number of forms minimal
|
||||
-- - easier to see what is happening than with lots of anonymous arguments to mkN, mkA, mkV
|
||||
|
||||
-- so this is the lincat of N
|
||||
|
||||
NounForms : Type = {snom,sgen,sdat,sacc,svoc,sins,pnom,pgen,pdat,pacc : Str} ;
|
||||
|
||||
-- But traditional tables make agreement easier to handle in syntax
|
||||
-- so this is the lincat of CN
|
||||
|
||||
Noun : Type = {s : Number => Case => Str ; g : Gender} ;
|
||||
|
||||
-- for lexical nouns N, we also need the gender but keep the minimal set of forms
|
||||
|
||||
LexNoun : Type = NounForms ** {g : Gender} ;
|
||||
|
||||
-- this is used in UseN
|
||||
|
||||
nounFormsNoun : NounForms -> Gender -> Noun
|
||||
= \forms, g -> {
|
||||
s = table {
|
||||
Sg => table {
|
||||
Nom => forms.snom ;
|
||||
Gen => forms.sgen ;
|
||||
Dat => forms.sdat ;
|
||||
Acc => case g of {
|
||||
Masc Anim | Fem => forms.sacc ;
|
||||
_ => forms.snom
|
||||
} ;
|
||||
Voc => forms.svoc ;
|
||||
Loc => forms.sdat ;
|
||||
Ins => forms.sins
|
||||
} ;
|
||||
Pl => table {
|
||||
Nom => forms.pnom ;
|
||||
Gen => forms.pgen ;
|
||||
Dat => forms.pdat ;
|
||||
Acc => forms.pacc ;
|
||||
Voc => forms.pnom ;
|
||||
Loc => forms.pdat ;
|
||||
Ins => forms.pdat
|
||||
}
|
||||
} ;
|
||||
g = g
|
||||
} ;
|
||||
|
||||
-- a declension type produces these forms from a string
|
||||
|
||||
DeclensionType : Type = Str -> NounForms ;
|
||||
|
||||
-- smart paradigms
|
||||
|
||||
smartLexNoun : Str -> LexNoun = \s -> case s of {
|
||||
_ + "a" => zenaN s ** {g = feminine} ;
|
||||
_ + "i" => ziriN s ** {g = inanimate} ; ---- TODO feminine i
|
||||
_ + "e" => poljeN s ** {g = neuter} ; ---- TODO sunce, uze, zvonce, rame
|
||||
_ + "ao" => ugaoN s ** {g = inanimate} ;
|
||||
_ + "eo" => pepeoN s ** {g = inanimate} ;
|
||||
_ + "o" => koljenoN s ** {g = neuter} ; ---- TODO jedro
|
||||
_ + "lac" => posjetilacN s ** {g = inanimate} ;
|
||||
_ + "anj" => suzanjN s ** {g = inanimate} ;
|
||||
_ + "nj" => panjN s ** {g = inanimate} ;
|
||||
_ + "št" => pristN s ** {g = inanimate} ;
|
||||
_ + "ac" => klinacN s ** {g = neuter} ;
|
||||
_ + "c" => stricN s ** {g = inanimate} ;
|
||||
_ + "in" => gradaninN s ** {g = neuter} ;
|
||||
_ + "ak" => cvorakN s ** {g = inanimate} ;
|
||||
_ + "a" + ? => nokatN s ** {g = inanimate} ;
|
||||
_ + "g" => bubregN s ** {g = inanimate} ;
|
||||
_ + "h" => trbuhN s ** {g = inanimate} ;
|
||||
_ + "k" => vojnikN s ** {g = inanimate} ;
|
||||
_ => izvorN s ** {g = inanimate}
|
||||
} ;
|
||||
|
||||
mkgLexNoun : Str -> Gender -> LexNoun = \s,g -> case <s,g> of {
|
||||
<_ + "i", Masc _> => ziriN s ** {g = g} ;
|
||||
<_ + "e", Masc _> => bifeN s ** {g = g} ;
|
||||
<_ + "o", Masc _> => bifeN s ** {g = g} ;
|
||||
<_, g> => smartLexNoun s ** {g = g}
|
||||
} ;
|
||||
|
||||
|
||||
-- the traditional declensions, following Wiki
|
||||
-- they are also exported in ParadigmsHrv with names izvorN etc
|
||||
|
||||
izvorN : DeclensionType = \izvor ->
|
||||
{
|
||||
snom = izvor ;
|
||||
sgen = izvor + "a" ;
|
||||
sdat = izvor + "u" ;
|
||||
sacc = izvor + "a" ;
|
||||
svoc = ifSoft izvor
|
||||
(izvor + "u")
|
||||
(palatalize (izvor + "e")) ;
|
||||
sins = ifSoft izvor
|
||||
(izvor + "em")
|
||||
(izvor + "om") ;
|
||||
|
||||
pnom = palatalize (izvor + "i") ;
|
||||
pgen = izvor + "a" ;
|
||||
pdat =
|
||||
ifSoft izvor
|
||||
(palatalize (izvor + "e") + "vima")
|
||||
(palatalize (izvor + "i") + "ma") ;
|
||||
pacc = izvor + "e" ;
|
||||
} ;
|
||||
|
||||
nokatN : DeclensionType = \nokat ->
|
||||
let
|
||||
nokt = Predef.tk 2 nokat + last nokat
|
||||
in izvorN nokt ** {
|
||||
snom = nokat ;
|
||||
sacc = nokt + "a" ;
|
||||
pgen = nokat + "a" ;
|
||||
} ;
|
||||
|
||||
gradaninN : DeclensionType = \gradanin ->
|
||||
let
|
||||
gradan = Predef.tk 2 gradanin ;
|
||||
gradanN = izvorN gradan
|
||||
in numbersNounForms (izvorN gradanin) gradanN ;
|
||||
|
||||
numbersNounForms : (sg, pl : NounForms) -> NounForms =
|
||||
\sg, pl -> sg ** {
|
||||
pnom = pl.pnom ;
|
||||
pgen = pl.pgen ;
|
||||
pdat = pl.pdat ;
|
||||
pacc = pl.pacc ;
|
||||
} ;
|
||||
|
||||
vojnikN : DeclensionType = izvorN ;
|
||||
bubregN : DeclensionType = izvorN ;
|
||||
trbuhN : DeclensionType = izvorN ;
|
||||
cvorakN : DeclensionType = nokatN ;
|
||||
|
||||
panjN : DeclensionType = \panj ->
|
||||
numbersNounForms (izvorN panj) (izvorN (palatalize (panj + "e") + "v")) ;
|
||||
|
||||
suzanjN : DeclensionType = \suzanj ->
|
||||
let
|
||||
suznj = Predef.tk 3 suzanj + Predef.dp 2 suzanj
|
||||
in
|
||||
numbersNounForms
|
||||
(izvorN suzanj)
|
||||
(izvorN suznj ** {
|
||||
pgen = "sužanja" ;
|
||||
pdat = "sužnjima"
|
||||
}) ;
|
||||
|
||||
pristN : DeclensionType = panjN ;
|
||||
|
||||
stricN : DeclensionType = \stric ->
|
||||
panjN stric ** {
|
||||
svoc = palatalize (stric + "e")
|
||||
} ;
|
||||
|
||||
klinacN : DeclensionType = \klinac ->
|
||||
let
|
||||
klinc = Predef.tk 2 klinac + last klinac
|
||||
in nokatN klinac ** {
|
||||
svoc = palatalize (klinc + "e") ;
|
||||
pdat = klinc + "ima" ;
|
||||
} ;
|
||||
|
||||
posjetilacN : DeclensionType = \posjetilac ->
|
||||
let
|
||||
posjetioc = Predef.tk 3 posjetilac + "oc"
|
||||
in izvorN posjetioc ** {
|
||||
snom = posjetilac ;
|
||||
svoc = palatalize (posjetioc + "e") ;
|
||||
sins = palatalize (posjetioc + "e") + "m" ;
|
||||
pgen = posjetilac + "a" ;
|
||||
pdat = palatalize (posjetioc + "i") + "ma" ;
|
||||
} ;
|
||||
|
||||
pepeoN : DeclensionType = \pepeo ->
|
||||
let
|
||||
pepel = init pepeo + "l"
|
||||
in izvorN pepel ** {snom = pepeo} ;
|
||||
|
||||
ugaoN : DeclensionType = \ugao ->
|
||||
let
|
||||
ugal = init ugao + "l" ;
|
||||
ugl = Predef.tk 2 ugal + last ugal
|
||||
in numbersNounForms
|
||||
(nokatN ugal ** {snom = ugao})
|
||||
(izvorN (ugl + "ov")) ;
|
||||
|
||||
bifeN : DeclensionType = \bife ->
|
||||
izvorN bife ** {svoc = bife + "u"} ;
|
||||
|
||||
ziriN : DeclensionType = \ziri ->
|
||||
bifeN (ziri + "j") ** {
|
||||
snom = ziri ;
|
||||
pdat = ziri + "jima" ;
|
||||
} ;
|
||||
|
||||
taksiN : DeclensionType = ziriN ;
|
||||
|
||||
---- Danilo, Hrvoje, raščupànko skipped
|
||||
|
||||
koljenoN : DeclensionType = \koljeno ->
|
||||
let
|
||||
koljen = init koljeno
|
||||
in izvorN koljen ** {
|
||||
snom, sacc, svoc = koljeno ;
|
||||
pnom, pacc, pvoc = koljen + "a" ;
|
||||
} ;
|
||||
|
||||
jedroN : DeclensionType = \jedro ->
|
||||
let
|
||||
jed = Predef.tk 2 jedro ;
|
||||
r = last (init jedro) ;
|
||||
in koljenoN jedro ** {
|
||||
pgen = jed + "a" + r + "a" ;
|
||||
} ;
|
||||
|
||||
---- drvo - drveta skipped, can also decline as koljeno
|
||||
---- oči, čudo skipped
|
||||
|
||||
poljeN : DeclensionType = \polje ->
|
||||
koljenoN polje ** {
|
||||
pdat = init polje + "ima" ;
|
||||
} ;
|
||||
|
||||
---- sunce, uže, zvonce, rame, podne, doba
|
||||
|
||||
---- no tables given in the sources for feminine nouns, so guessing from ending tables
|
||||
|
||||
zenaN : DeclensionType = \zena ->
|
||||
let
|
||||
zen = init zena
|
||||
in {
|
||||
snom = zena ;
|
||||
sgen = zen + "e" ;
|
||||
sdat = zen + "i" ;
|
||||
sacc = zen + "u" ;
|
||||
svoc = zen + "o" ; ---- o/a in Wiki ; o in https://sh.wiktionary.org/wiki/%C5%BEena
|
||||
sins = zen + "om" ;
|
||||
pnom, pacc, pvoc = zen + "e" ;
|
||||
pdat = zen + "ama" ;
|
||||
pgen = zen + "a" ;
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
---------------------------
|
||||
-- Adjectives
|
||||
|
||||
-- to be used for AP: 56 forms for each degree
|
||||
Adjective : Type = {s : Gender => Number => Case => Str} ;
|
||||
|
||||
-- to be used for A, in three degrees: 12 forms in each
|
||||
---- TODO other degrees than positive
|
||||
|
||||
AdjForms : Type = {
|
||||
msnom, fsnom, nsnom : Str ;
|
||||
msgen, fsgen : Str ; -- nsgen = msgen
|
||||
msdat : Str ; -- msloc,nsdat,nsloc = msdat
|
||||
fsdat : Str ; -- fsloc = fsdat
|
||||
fsacc : Str ; --
|
||||
msins : Str ; -- nsins, pdat, ploc, pins = msins
|
||||
fsins : Str ; -- no o/e variation like in msdat
|
||||
mpnom : Str ; -- mpvoc = mpnom
|
||||
mpgen : Str ; --
|
||||
} ;
|
||||
|
||||
invarAdjForms : Str -> AdjForms = \s -> {
|
||||
msnom, fsnom, nsnom, msgen, fsgen, msdat,
|
||||
fsdat, fsacc, msins, fsins, mpnom, mpgen = s ;
|
||||
} ;
|
||||
|
||||
-- used in PositA but will also work in Compar and Superl by calling their record fields
|
||||
|
||||
adjFormsAdjective : AdjForms -> Adjective = \afs -> {
|
||||
s = \\g,n,c => case <n,c,g> of {
|
||||
|
||||
<Sg, Nom|Voc, Masc _>
|
||||
| <Sg, Acc, Masc Inanim> => afs.msnom ;
|
||||
<Sg, Nom|Voc, Fem>
|
||||
| <Pl, Nom|Acc|Voc, Neutr> => afs.fsnom ;
|
||||
<Sg, Nom|Acc|Voc, Neutr> => afs.nsnom ;
|
||||
<Sg, Gen, Masc _ | Neutr>
|
||||
| <Sg, Acc, Masc Anim> => afs.msgen ;
|
||||
<Sg, Gen, Fem>
|
||||
| <Pl, Nom|Acc|Voc, Fem>
|
||||
| <Pl, Acc, Masc _> => afs.fsgen ;
|
||||
<Sg, Dat|Loc, Masc _|Neutr> => afs.msdat ;
|
||||
<Sg, Dat|Loc, Fem> => afs.fsdat ;
|
||||
<Sg, Acc, Fem> => afs.fsacc ;
|
||||
<Sg, Ins, Masc _|Neutr>
|
||||
| <Pl,Dat|Loc|Ins, _> => afs.msins ;
|
||||
<Sg, Ins, Fem> => afs.fsins ;
|
||||
<Pl, Nom|Voc, Masc _> => afs.mpnom ;
|
||||
<Pl, Gen,_> => afs.mpgen
|
||||
}
|
||||
} ;
|
||||
|
||||
velikA : Str -> AdjForms = \velik ->
|
||||
let
|
||||
velk : Str = case velik of {
|
||||
vel + "stan" => vel + "sn" ;
|
||||
vel + "ao" => vel + "l" ;
|
||||
vel + "ak" => voicing vel + "k" ;
|
||||
vel + "a" + k@? => vel + k ;
|
||||
vel + "i" => vel ;
|
||||
_ => velik
|
||||
} ;
|
||||
oe : Str = ifSoft velik "e" "o"
|
||||
in {
|
||||
msnom = velik ;
|
||||
fsnom = velk + "a" ;
|
||||
nsnom = velk + oe ;
|
||||
msgen = velk + oe + "g" ;
|
||||
fsgen = velk + "e" ;
|
||||
msdat = velk + oe + "m" ;
|
||||
fsdat = velk + "oj" ;
|
||||
fsacc = velk + "u" ;
|
||||
msins = velk + "im" ;
|
||||
fsins = velk + "om" ;
|
||||
mpnom = velk + "i" ;
|
||||
mpgen = velk + "ih" ;
|
||||
} ;
|
||||
|
||||
regComparAForms : AdjForms -> AdjForms
|
||||
= \aposit -> case init aposit.fsnom of {
|
||||
grub@(_ + "b"|"p"|"v"|"h") => velikA (grub + "lji") ;
|
||||
star => velikA (star + "iji")
|
||||
} ;
|
||||
|
||||
superlAForms : AdjForms -> AdjForms
|
||||
= \acompar -> velikA ("naj" + acompar.msnom) ;
|
||||
|
||||
od_Str = "od" ;
|
||||
|
||||
---------------------
|
||||
-- Verbs
|
||||
-- Wiki
|
||||
|
||||
VerbForms : Type = VForm => Str ;
|
||||
|
||||
ComplementCase : Type = {s : Str ; c : Case ; hasPrep : Bool} ;
|
||||
|
||||
verbAgr : VerbForms -> Agr -> CTense -> Str ---- TODO tenses
|
||||
= \vf,a,b -> case <a,b> of {
|
||||
<Ag _ n p, CTPres> => vf ! VPres n p ;
|
||||
<Ag g n _, CTPast> => vf ! VPastPart g n
|
||||
} ;
|
||||
|
||||
smartVerbForms : Str -> VerbForms = \s -> case s of {
|
||||
cit + "ati" => aeiVerbForms s (cit + "am") (cit + "ao") ;
|
||||
vid + "jeti" => aeiVerbForms s (vid + "im") (vid + "io") ;
|
||||
radi + "ti" => aeiVerbForms s (init radi + "em") (radi + "o") ;
|
||||
radi + ? => aeiVerbForms s (init radi + "em") (radi + "o") ; ----
|
||||
_ => Predef.error ("expect infinitive form \"-ti\", found" ++ s)
|
||||
} ;
|
||||
|
||||
-- an traditional paradigm type, with a slight abstraction
|
||||
---- TODO other traditional paradigms
|
||||
|
||||
aeiVerbForms : Str -> Str -> Str -> VerbForms = \citati, citam, citao ->
|
||||
let
|
||||
cita = init citam ;
|
||||
u = case last cita of {
|
||||
"a" => "aju" ;
|
||||
"e" => "u" ;
|
||||
"i" => "e" ;
|
||||
_ => "e" ---- should not happen
|
||||
} ;
|
||||
cital = init citao + "l" ;
|
||||
in table {
|
||||
VInf => citati ;
|
||||
VPres Sg P1 => cita + "m" ;
|
||||
VPres Sg P2 => cita + "š" ;
|
||||
VPres Sg P3 => cita ;
|
||||
VPres Pl P1 => cita + "mo" ;
|
||||
VPres Pl P2 => cita + "te" ;
|
||||
VPres pl P3 => init cita + u ;
|
||||
VPastPart (Masc _) Sg => citao ;
|
||||
VPastPart Fem Sg => cital + "a" ;
|
||||
VPastPart Neutr Sg => cital + "o" ;
|
||||
VPastPart (Masc _) Pl => cital + "i" ;
|
||||
VPastPart Fem Pl => cital + "e" ;
|
||||
VPastPart Neutr Pl => cital + "a"
|
||||
} ;
|
||||
|
||||
|
||||
-- copula
|
||||
|
||||
jesam_Copula : {short, long, negative : Number => Person => Str} =
|
||||
let
|
||||
sam : Number => Person => Str = table {
|
||||
Sg => table {
|
||||
P1 => "sam" ;
|
||||
P2 => "si" ;
|
||||
P3 => "je"
|
||||
} ;
|
||||
Pl => table {
|
||||
P1 => "smo" ;
|
||||
P2 => "ste" ;
|
||||
P3 => "su"
|
||||
}
|
||||
}
|
||||
in {
|
||||
short = sam ;
|
||||
long = \\n,p => case <n,p> of {
|
||||
<Sg,P3> => "jeste" ; --- wiki: jest(e)
|
||||
_ => sam ! n ! p
|
||||
} ;
|
||||
negative = \\n,p => "ni" + sam ! n ! p
|
||||
} ;
|
||||
|
||||
-- Wiki: some grammars (chiefly Serbian ones) treat jesam as a defective verb
|
||||
-- having only present tense. Others treat these forms as two realizations
|
||||
-- of the same irregular verb biti, jesam being imperfective and budem perfective.
|
||||
|
||||
copula_VerbForms : VerbForms = table {
|
||||
VPres n p => jesam_Copula.short ! n ! p ;
|
||||
v => biti_VerbForms ! v
|
||||
} ;
|
||||
|
||||
biti_VerbForms : VerbForms = aeiVerbForms "biti" "budem" "bio" ;
|
||||
|
||||
imati_VerbForms : VerbForms = aeiVerbForms "imati" "imam" "imao" ;
|
||||
|
||||
|
||||
---------------------------
|
||||
-- Pronouns
|
||||
|
||||
PronForms : Type = {
|
||||
nom,
|
||||
gen, cgen, -- bare, clitic (also as Acc)
|
||||
dat, cdat, -- also as Loc
|
||||
ins : Str ;
|
||||
a : Agr
|
||||
} ;
|
||||
|
||||
personalPron : Agr -> PronForms = \a ->
|
||||
{a = a ; cnom = []} **
|
||||
case a of {
|
||||
Ag _ Sg P1 => {
|
||||
nom = "ja" ;
|
||||
gen = "mene" ;
|
||||
cgen = "ma" ;
|
||||
dat = "meni" ;
|
||||
cdat = "mi" ;
|
||||
ins = "mnom"
|
||||
} ;
|
||||
Ag _ Sg P2 => {
|
||||
nom = "ti" ;
|
||||
gen = "tebe" ;
|
||||
cgen = "te" ;
|
||||
dat = "tebi" ;
|
||||
cdat = "ti" ;
|
||||
ins = "tobom"
|
||||
} ;
|
||||
Ag Fem Sg P3 => {
|
||||
nom = "ona" ;
|
||||
gen = "nje" ;
|
||||
cgen = "je" ;
|
||||
dat = "njoj" ;
|
||||
cdat = "joj" ;
|
||||
ins = "njom"
|
||||
} ;
|
||||
Ag g Sg P3 => {
|
||||
nom = case g of {
|
||||
Masc _ => "on" ;
|
||||
_ => "ono"
|
||||
} ;
|
||||
gen = "njega" ;
|
||||
cgen = "ga" ;
|
||||
dat = "njemu" ;
|
||||
cdat = "mu" ;
|
||||
ins = "njim"
|
||||
} ;
|
||||
|
||||
Ag _ Pl P1 => {
|
||||
nom = "mi" ;
|
||||
gen, cgen = "nas" ;
|
||||
dat, ins = "nama" ;
|
||||
cdat = "nam"
|
||||
} ;
|
||||
Ag _ Pl P2 => {
|
||||
nom = "vi" ;
|
||||
gen, cgen = "vas" ;
|
||||
dat, ins = "vama" ;
|
||||
cdat = "vam"
|
||||
} ;
|
||||
Ag g Pl P3 => {
|
||||
nom = case g of {
|
||||
Masc _ => "oni" ;
|
||||
Fem => "one" ;
|
||||
Neutr => "ona"
|
||||
} ;
|
||||
gen = "njih" ;
|
||||
cgen = "ih" ;
|
||||
dat, ins = "njima" ;
|
||||
cdat = "im"
|
||||
}
|
||||
} ;
|
||||
|
||||
possessivePron : Agr -> AdjForms = \a -> case a of {
|
||||
Ag _ Sg P1 => velikA "moj" ;
|
||||
Ag _ Sg P2 => velikA "tvoj" ;
|
||||
Ag (Masc _) Sg P3 => velikA "njegov" ;
|
||||
Ag (Fem|Neutr) Sg P3 => velikA "njezin" ; -- BCMS: Hrv: otherwise njen
|
||||
Ag _ Pl P1 => velikA "naš" ;
|
||||
Ag _ Pl P2 => velikA "vaš" ;
|
||||
Ag _ Pl P3 => velikA "njihov"
|
||||
} ;
|
||||
|
||||
{-
|
||||
reflPossessivePron : DemPronForms = otcovA "svoj" ** {
|
||||
msnom = "svoj" ; msgen = "svojho" ; msdat = "svojmu" ;
|
||||
msins = "svojím" ;
|
||||
ampnom = "svoji" ;
|
||||
nsnom, fpnom = "svoje" ;
|
||||
pgen = "svojich" ;
|
||||
pdat = "svojim" ;
|
||||
pins = "svojimi" ;
|
||||
} ;
|
||||
-}
|
||||
|
||||
mkPron : Agr -> PronForms ** {poss : AdjForms} = \a ->
|
||||
personalPron a ** {poss = possessivePron a} ;
|
||||
|
||||
|
||||
param NumSize = NS_1 | NS_2_4 | NS_5_20 | NS_20_ ;
|
||||
|
||||
oper
|
||||
Determiner : Type = {
|
||||
s : Gender => Case => Str ;
|
||||
size : NumSize
|
||||
} ;
|
||||
|
||||
{-
|
||||
-- interrogatives TODO
|
||||
|
||||
ktoForms : Case => Str = table {
|
||||
Nom => "kto" ;
|
||||
Gen | Acc => "koho" ;
|
||||
Dat => "komu" ;
|
||||
Loc => "kom" ;
|
||||
Ins => "kým"
|
||||
} ;
|
||||
|
||||
coForms : Case => Str = table {
|
||||
Nom|Acc => "čo" ;
|
||||
Gen => "čoho" ;
|
||||
Dat => "čomu" ;
|
||||
Loc => "čom" ;
|
||||
Ins => "čím"
|
||||
} ;
|
||||
-}
|
||||
|
||||
|
||||
--------------------------------
|
||||
-- combining nouns with numerals
|
||||
|
||||
oper
|
||||
numSizeForm : (Number => Case => Str) -> NumSize -> Case -> Str
|
||||
= \cns,n,c -> case n of {
|
||||
NS_1 => cns ! Sg ! c ;
|
||||
NS_2_4 => cns ! Pl ! c ;
|
||||
_ => case c of {
|
||||
Nom | Acc => cns ! Pl ! Gen ;
|
||||
_ => cns ! Pl ! c
|
||||
}
|
||||
} ;
|
||||
|
||||
numSizeAgr : Gender -> NumSize -> Person -> Agr
|
||||
= \g,ns,p -> case ns of {
|
||||
NS_1 => Ag g Sg p ;
|
||||
NS_2_4 => Ag g Pl p ;
|
||||
_ => Ag Neutr Sg p ---- TODO verify
|
||||
} ;
|
||||
|
||||
numSizeNumber : NumSize -> Number = \ns -> case ns of {
|
||||
NS_1 => Sg ;
|
||||
_ => Pl ---- TO CHECK
|
||||
} ;
|
||||
|
||||
}
|
||||
32
src/croatian/SentenceHrv.gf
Normal file
32
src/croatian/SentenceHrv.gf
Normal file
@@ -0,0 +1,32 @@
|
||||
concrete SentenceHrv of Sentence = CatHrv **
|
||||
open Prelude, ResHrv in {
|
||||
|
||||
lin
|
||||
PredVP np vp = {
|
||||
subj = case np.hasClit of {
|
||||
True => np.clit ! Nom ; -- pro-drop
|
||||
False => np.s ! Nom
|
||||
} ;
|
||||
verb = vp.verb ;
|
||||
clit = vp.clit ! np.a ;
|
||||
compl = vp.compl ! np.a ;
|
||||
a = np.a ;
|
||||
} ;
|
||||
|
||||
UseCl temp pol cl = {
|
||||
s = temp.s ++ cl.subj ++ cl.clit ++ pol.s ++ verbAgr cl.verb cl.a CTPres ++ cl.compl ;
|
||||
} ; ---- TODO tense, negation
|
||||
|
||||
--- TODO is inversion the standard? ; add indirect questions
|
||||
UseQCl temp pol cl = {
|
||||
s = temp.s ++ cl.clit ++ pol.s ++ verbAgr cl.verb cl.a CTPres ++ cl.subj ++ cl.compl ;
|
||||
} ; ---- TODO tenses
|
||||
|
||||
UseRCl temp pol rcl = {
|
||||
s = \\a => temp.s ++
|
||||
rcl.subj ! a ++ rcl.clit ! a ++
|
||||
pol.s ++ verbAgr rcl.verb a CTPres ++
|
||||
rcl.compl ! a ;
|
||||
} ; ---- TODO tenses
|
||||
|
||||
}
|
||||
34
src/croatian/StructuralHrv.gf
Normal file
34
src/croatian/StructuralHrv.gf
Normal file
@@ -0,0 +1,34 @@
|
||||
concrete StructuralHrv of Structural = CatHrv **
|
||||
open ParadigmsHrv, ResHrv, Prelude in {
|
||||
|
||||
lin
|
||||
and_Conj = mkConj "i" ;
|
||||
---- by8agent_Prep = mkPrep "" Ins ;
|
||||
---- few_Det = invarNumeral "málo" ; -- see notes
|
||||
for_Prep = mkPrep "pre" accusative ;
|
||||
from_Prep = mkPrep "iz" Gen ;
|
||||
have_V2 = mkV2 (mkV imati_VerbForms) ;
|
||||
in_Prep = mkPrep "u" Loc ;
|
||||
---- many_Det = regNumeral "mnoho" "mnohých" "mnohým" "mnohými" ; ---- alternative: invarNumeral "veľa" ;
|
||||
or_Conj = mkConj "alebo" ;
|
||||
---- somePl_Det = invarDeterminer "niekoľko" Num5 ;
|
||||
---- somePl_Det = {s = \\g,c => (demPronFormsAdjective (mkDemPronForms "niekoľko") "").s ! g ! Pl ! c ; size = Num5} ;
|
||||
---- something_NP = {s,clit,prep = \\c => "nie" + coForms ! c ; a = Ag Neutr Sg P3 ; hasClit = False} ; -- CEG 5.6.3
|
||||
possess_Prep = mkPrep "" Gen ;
|
||||
that_Quant = adjFormsAdjective (velikA "oni" ** {msnom = "onaj"}) ; ---- TODO: taj, ta, to
|
||||
this_Quant = adjFormsAdjective (velikA "ovi" ** {msnom = "ovaj"}) ;
|
||||
to_Prep = mkPrep "u" Acc ;
|
||||
with_Prep = mkPrep (pre {"s"|"z"|"š"|"ž"|"mnom" => "sa" ; _ => "s"}) Ins ;
|
||||
|
||||
i_Pron = mkPron (Ag (Masc Anim) Sg P1) ; --- to add Fem pronouns in Extend
|
||||
youSg_Pron = mkPron (Ag (Masc Anim) Sg P2) ;
|
||||
he_Pron = mkPron (Ag (Masc Anim) Sg P3) ;
|
||||
she_Pron = mkPron (Ag Fem Sg P3) ;
|
||||
it_Pron = mkPron (Ag Neutr Sg P3) ;
|
||||
we_Pron = mkPron (Ag (Masc Anim) Pl P1) ;
|
||||
youPl_Pron = mkPron (Ag (Masc Anim) Pl P2) ;
|
||||
they_Pron = mkPron (Ag (Masc Anim) Pl P3) ;
|
||||
|
||||
somewhere_Adv = mkAdv "negdje" ;
|
||||
|
||||
}
|
||||
15
src/croatian/SymbolHrv.gf
Normal file
15
src/croatian/SymbolHrv.gf
Normal file
@@ -0,0 +1,15 @@
|
||||
--# -path=.:../abstract:../common:../prelude
|
||||
|
||||
concrete SymbolHrv of Symbol = CatHrv ** open Prelude, ResHrv in {
|
||||
|
||||
lincat
|
||||
Symb = {s : Str} ;
|
||||
lin
|
||||
MkSymb s = s ;
|
||||
SymbPN s = lin PN {s = \\_ => s.s ; g = Neutr} ;
|
||||
|
||||
IntPN s = lin PN {s = \\_ => s.s ; g = Neutr} ;
|
||||
|
||||
SymbNum s = lin Card {s = \\_,_ => s.s ; size = NS_20_} ; --- size
|
||||
|
||||
}
|
||||
660
src/croatian/TableExtResHrv.gf
Normal file
660
src/croatian/TableExtResHrv.gf
Normal file
@@ -0,0 +1,660 @@
|
||||
resource TableExtResHrv = open Prelude in {
|
||||
|
||||
-- AR September 2022
|
||||
-- sources:
|
||||
-- Wiki = https://en.wikipedia.org/wiki/Serbo-Croatian_grammar
|
||||
-- BCMS = Bosnian, Croatian, Montenegrin and Serbian:
|
||||
-- An Essential Grammar (Routledge Essential Grammars) 1st Edition, by Željko Vrabec
|
||||
|
||||
-- parameters
|
||||
|
||||
param
|
||||
Number = Sg | Pl ;
|
||||
|
||||
Animacy = Anim | Inanim ;
|
||||
Gender = Masc Animacy | Fem | Neutr ;
|
||||
|
||||
Case = Nom | Gen | Dat | Acc | Voc | Loc | Ins ; -- traditional order
|
||||
|
||||
Person = P1 | P2 | P3 ;
|
||||
|
||||
VForm =
|
||||
VInf
|
||||
| VPres Number Person
|
||||
| VPastPart Gender Number
|
||||
;
|
||||
---- TODO aorist, imperfect
|
||||
|
||||
Agr = Ag Gender Number Person ;
|
||||
|
||||
CTense = CTPres | CTPast ; ----- TODO complete the tense system to match BCS verb morphology
|
||||
|
||||
-- phonology
|
||||
|
||||
oper
|
||||
softConsonant : pattern Str = #("c"|"č"|"ć"|"đ"|"j"|"lj"|"nj"|"š"|"ž"|"št") ;
|
||||
--- wiki "and sometimes r"; BCMS slightly different
|
||||
|
||||
ifSoft : Str -> (soft,hard : Str) -> Str = \word, ssoft, shard ->
|
||||
case word of {
|
||||
_ + #softConsonant => ssoft ;
|
||||
_ => shard
|
||||
} ;
|
||||
|
||||
animate = Masc Anim ;
|
||||
inanimate = Masc Inanim ;
|
||||
feminine = Fem ;
|
||||
neuter = Neutr ;
|
||||
|
||||
palatalize : Str -> Str = \s -> case s of {
|
||||
x + "ki" => x + "ci" ;
|
||||
x + "ke" => x + "če" ;
|
||||
x + "gi" => x + "zi" ;
|
||||
x + "ge" => x + "že" ;
|
||||
x + "hi" => x + "si" ;
|
||||
x + "he" => x + "še" ;
|
||||
x + "ce" => x + "če" ;
|
||||
_ => s
|
||||
} ;
|
||||
|
||||
voicing : Str -> Str = \s -> case s of {
|
||||
x + "b" => x + "p" ;
|
||||
x + "d" => x + "t" ;
|
||||
x + "đ" => x + "ć" ;
|
||||
x + "z" => x + "s" ;
|
||||
x + "dž" => x + "č" ;
|
||||
x + "ž" => x + "š" ;
|
||||
_ => s
|
||||
} ;
|
||||
|
||||
---------------
|
||||
-- Nouns
|
||||
---------------
|
||||
|
||||
-- novel idea (for RGL): lexical items stored as records rather than tables
|
||||
-- advantages:
|
||||
-- - easier to make exceptions to paradigms (by ** {})
|
||||
-- - easier to keep the number of forms minimal
|
||||
-- - easier to see what is happening than with lots of anonymous arguments to mkN, mkA, mkV
|
||||
-- Starting from GF 2022-10-04: this can now be done with table extension, which gives
|
||||
-- type safety and more powerful pattern matching
|
||||
|
||||
param
|
||||
NForm = snom | sgen | sdat | sacc | svoc | sins | pnom | pgen | pdat | pacc ;
|
||||
|
||||
oper
|
||||
NounForms : Type = NForm => Str ;
|
||||
|
||||
-- But traditional tables make agreement easier to handle in syntax
|
||||
-- so this is the lincat of CN
|
||||
|
||||
Noun : Type = {s : Number => Case => Str ; g : Gender} ;
|
||||
|
||||
-- for lexical nouns N, we also need the gender but keep the minimal set of forms
|
||||
|
||||
LexNoun : Type = {s : NounForms ; g : Gender} ;
|
||||
|
||||
-- this is used in UseN
|
||||
|
||||
nounFormsNoun : NounForms -> Gender -> Noun
|
||||
= \forms, g -> {
|
||||
s = table {
|
||||
Sg => table {
|
||||
Nom => forms ! snom ;
|
||||
Gen => forms ! sgen ;
|
||||
Dat => forms ! sdat ;
|
||||
Acc => case g of {
|
||||
Masc Anim | Fem => forms ! sacc ;
|
||||
_ => forms ! snom
|
||||
} ;
|
||||
Voc => forms ! svoc ;
|
||||
Loc => forms ! sdat ;
|
||||
Ins => forms ! sins
|
||||
} ;
|
||||
Pl => table {
|
||||
Nom => forms ! pnom ;
|
||||
Gen => forms ! pgen ;
|
||||
Dat => forms ! pdat ;
|
||||
Acc => forms ! pacc ;
|
||||
Voc => forms ! pnom ;
|
||||
Loc => forms ! pdat ;
|
||||
Ins => forms ! pdat
|
||||
}
|
||||
} ;
|
||||
g = g
|
||||
} ;
|
||||
|
||||
-- a declension type produces these forms from a string
|
||||
|
||||
DeclensionType : Type = Str -> NounForms ;
|
||||
|
||||
-- smart paradigms
|
||||
|
||||
smartLexNoun : Str -> LexNoun = \s -> case s of {
|
||||
_ + "a" => {s = zenaN s ; g = feminine} ;
|
||||
_ + "i" => {s = ziriN s ; g = inanimate} ; ---- TODO feminine i
|
||||
_ + "e" => {s = poljeN s ; g = neuter} ; ---- TODO sunce, uze, zvonce, rame
|
||||
_ + "ao" => {s = ugaoN s ; g = inanimate} ;
|
||||
_ + "eo" => {s = pepeoN s ; g = inanimate} ;
|
||||
_ + "o" => {s = koljenoN s ; g = neuter} ; ---- TODO jedro
|
||||
_ + "lac" => {s = posjetilacN s ; g = inanimate} ;
|
||||
_ + "anj" => {s = suzanjN s ; g = inanimate} ;
|
||||
_ + "nj" => {s = panjN s ; g = inanimate} ;
|
||||
_ + "št" => {s = pristN s ; g = inanimate} ;
|
||||
_ + "ac" => {s = klinacN s ; g = neuter} ;
|
||||
_ + "c" => {s = stricN s ; g = inanimate} ;
|
||||
_ + "in" => {s = gradaninN s ; g = neuter} ;
|
||||
_ + "ak" => {s = cvorakN s ; g = inanimate} ;
|
||||
_ + "a" + ? => {s = nokatN s ; g = inanimate} ;
|
||||
_ + "g" => {s = bubregN s ; g = inanimate} ;
|
||||
_ + "h" => {s = trbuhN s ; g = inanimate} ;
|
||||
_ + "k" => {s = vojnikN s ; g = inanimate} ;
|
||||
_ => {s = izvorN s ; g = inanimate}
|
||||
} ;
|
||||
|
||||
mkgLexNoun : Str -> Gender -> LexNoun = \s,g -> case <s,g> of {
|
||||
<_ + "i", Masc _> => {s = ziriN s ; g = g} ;
|
||||
<_ + "e", Masc _> => {s = bifeN s ; g = g} ;
|
||||
<_ + "o", Masc _> => {s = bifeN s ; g = g} ;
|
||||
<_, g> => smartLexNoun s ** {g = g}
|
||||
} ;
|
||||
|
||||
|
||||
-- the traditional declensions, following Wiki
|
||||
-- they are also exported in ParadigmsHrv with names izvorN etc
|
||||
|
||||
izvorN : DeclensionType = \izvor ->
|
||||
table {
|
||||
snom => izvor ;
|
||||
sgen => izvor + "a" ;
|
||||
sdat => izvor + "u" ;
|
||||
sacc => izvor + "a" ;
|
||||
svoc => ifSoft izvor
|
||||
(izvor + "u")
|
||||
(palatalize (izvor + "e")) ;
|
||||
sins => ifSoft izvor
|
||||
(izvor + "em")
|
||||
(izvor + "om") ;
|
||||
|
||||
pnom => palatalize (izvor + "i") ;
|
||||
pgen => izvor + "a" ;
|
||||
pdat => ifSoft izvor
|
||||
(palatalize (izvor + "e") + "vima")
|
||||
(palatalize (izvor + "i") + "ma") ;
|
||||
pacc => izvor + "e"
|
||||
} ;
|
||||
|
||||
nokatN : DeclensionType = \nokat ->
|
||||
let
|
||||
nokt = Predef.tk 2 nokat + last nokat
|
||||
in izvorN nokt ** {
|
||||
snom => nokat ;
|
||||
sacc => nokt + "a" ;
|
||||
pgen => nokat + "a"
|
||||
} ;
|
||||
|
||||
gradaninN : DeclensionType = \gradanin ->
|
||||
let
|
||||
gradan = Predef.tk 2 gradanin ;
|
||||
gradanN = izvorN gradan
|
||||
in numbersNounForms (izvorN gradanin) gradanN ;
|
||||
|
||||
numbersNounForms : (sg, pl : NounForms) -> NounForms =
|
||||
\sg, pl -> sg ** {
|
||||
pnom => pl ! pnom ;
|
||||
pgen => pl ! pgen ;
|
||||
pdat => pl ! pdat ;
|
||||
pacc => pl ! pacc
|
||||
} ;
|
||||
|
||||
vojnikN : DeclensionType = izvorN ;
|
||||
bubregN : DeclensionType = izvorN ;
|
||||
trbuhN : DeclensionType = izvorN ;
|
||||
cvorakN : DeclensionType = nokatN ;
|
||||
|
||||
panjN : DeclensionType = \panj ->
|
||||
numbersNounForms (izvorN panj) (izvorN (palatalize (panj + "e") + "v")) ;
|
||||
|
||||
suzanjN : DeclensionType = \suzanj ->
|
||||
let
|
||||
suznj = Predef.tk 3 suzanj + Predef.dp 2 suzanj
|
||||
in
|
||||
numbersNounForms
|
||||
(izvorN suzanj)
|
||||
(izvorN suznj ** {
|
||||
pgen => "sužanja" ;
|
||||
pdat => "sužnjima"
|
||||
}) ;
|
||||
|
||||
pristN : DeclensionType = panjN ;
|
||||
|
||||
stricN : DeclensionType = \stric ->
|
||||
panjN stric ** {
|
||||
svoc => palatalize (stric + "e")
|
||||
} ;
|
||||
|
||||
klinacN : DeclensionType = \klinac ->
|
||||
let
|
||||
klinc = Predef.tk 2 klinac + last klinac
|
||||
in nokatN klinac ** {
|
||||
svoc => palatalize (klinc + "e") ;
|
||||
pdat => klinc + "ima"
|
||||
} ;
|
||||
|
||||
posjetilacN : DeclensionType = \posjetilac ->
|
||||
let
|
||||
posjetioc = Predef.tk 3 posjetilac + "oc"
|
||||
in izvorN posjetioc ** {
|
||||
snom => posjetilac ;
|
||||
svoc => palatalize (posjetioc + "e") ;
|
||||
sins => palatalize (posjetioc + "e") + "m" ;
|
||||
pgen => posjetilac + "a" ;
|
||||
pdat => palatalize (posjetioc + "i") + "ma"
|
||||
} ;
|
||||
|
||||
pepeoN : DeclensionType = \pepeo ->
|
||||
let
|
||||
pepel = init pepeo + "l"
|
||||
in izvorN pepel ** {snom => pepeo} ;
|
||||
|
||||
ugaoN : DeclensionType = \ugao ->
|
||||
let
|
||||
ugal = init ugao + "l" ;
|
||||
ugl = Predef.tk 2 ugal + last ugal
|
||||
in numbersNounForms
|
||||
(nokatN ugal ** {snom => ugao})
|
||||
(izvorN (ugl + "ov")) ;
|
||||
|
||||
bifeN : DeclensionType = \bife ->
|
||||
izvorN bife ** {svoc => bife + "u"} ;
|
||||
|
||||
ziriN : DeclensionType = \ziri ->
|
||||
bifeN (ziri + "j") ** {
|
||||
snom => ziri ;
|
||||
pdat => ziri + "jima"
|
||||
} ;
|
||||
|
||||
taksiN : DeclensionType = ziriN ;
|
||||
|
||||
---- Danilo, Hrvoje, raščupànko skipped
|
||||
|
||||
koljenoN : DeclensionType = \koljeno ->
|
||||
let
|
||||
koljen = init koljeno
|
||||
in izvorN koljen ** {
|
||||
snom | sacc | svoc => koljeno ;
|
||||
pnom | pacc => koljen + "a"
|
||||
} ;
|
||||
|
||||
jedroN : DeclensionType = \jedro ->
|
||||
let
|
||||
jed = Predef.tk 2 jedro ;
|
||||
r = last (init jedro) ;
|
||||
in koljenoN jedro ** {
|
||||
pgen => jed + "a" + r + "a"
|
||||
} ;
|
||||
|
||||
---- drvo - drveta skipped, can also decline as koljeno
|
||||
---- oči, čudo skipped
|
||||
|
||||
poljeN : DeclensionType = \polje ->
|
||||
koljenoN polje ** {
|
||||
pdat => init polje + "ima"
|
||||
} ;
|
||||
|
||||
---- sunce, uže, zvonce, rame, podne, doba
|
||||
|
||||
---- no tables given in the sources for feminine nouns, so guessing from ending tables
|
||||
|
||||
zenaN : DeclensionType = \zena ->
|
||||
let
|
||||
zen = init zena
|
||||
in table {
|
||||
snom => zena ;
|
||||
sgen => zen + "e" ;
|
||||
sdat => zen + "i" ;
|
||||
sacc => zen + "u" ;
|
||||
svoc => zen + "o" ; ---- o/a in Wiki ; o in https://sh.wiktionary.org/wiki/%C5%BEena
|
||||
sins => zen + "om" ;
|
||||
pnom | pacc => zen + "e" ;
|
||||
pdat => zen + "ama" ;
|
||||
pgen => zen + "a"
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
---------------------------
|
||||
-- Adjectives
|
||||
|
||||
-- to be used for AP: 56 forms for each degree
|
||||
Adjective : Type = {s : Gender => Number => Case => Str} ;
|
||||
|
||||
-- to be used for A, in three degrees: 12 forms in each
|
||||
---- TODO other degrees than positive
|
||||
|
||||
param AForm =
|
||||
msnom | fsnom | nsnom |
|
||||
msgen | fsgen | -- nsgen = msgen
|
||||
msdat | -- msloc,nsdat,nsloc = msdat
|
||||
fsdat | -- fsloc = fsdat
|
||||
fsacc | --
|
||||
msins | -- nsins, pdat, ploc, pins = msins
|
||||
fsins | -- no o/e variation like in msdat
|
||||
mpnom | -- mpvoc = mpnom
|
||||
mpgen -- fpgen, npgen = mpgen
|
||||
;
|
||||
|
||||
oper
|
||||
AdjForms : Type = AForm => Str ;
|
||||
|
||||
invarAdjForms : Str -> AdjForms = \s -> \\a => s ;
|
||||
|
||||
-- used in PositA but will also work in Compar and Superl by calling their record fields
|
||||
|
||||
adjFormsAdjective : AdjForms -> Adjective = \afs -> {
|
||||
s = \\g,n,c => case <n,c,g> of {
|
||||
|
||||
<Sg, Nom|Voc, Masc _>
|
||||
| <Sg, Acc, Masc Inanim> => afs ! msnom ;
|
||||
<Sg, Nom|Voc, Fem>
|
||||
| <Pl, Nom|Acc|Voc, Neutr> => afs ! fsnom ;
|
||||
<Sg, Nom|Acc|Voc, Neutr> => afs ! nsnom ;
|
||||
<Sg, Gen, Masc _ | Neutr>
|
||||
| <Sg, Acc, Masc Anim> => afs ! msgen ;
|
||||
<Sg, Gen, Fem>
|
||||
| <Pl, Nom|Acc|Voc, Fem>
|
||||
| <Pl, Acc, Masc _> => afs ! fsgen ;
|
||||
<Sg, Dat|Loc, Masc _|Neutr> => afs ! msdat ;
|
||||
<Sg, Dat|Loc, Fem> => afs ! fsdat ;
|
||||
<Sg, Acc, Fem> => afs ! fsacc ;
|
||||
<Sg, Ins, Masc _|Neutr>
|
||||
| <Pl,Dat|Loc|Ins, _> => afs ! msins ;
|
||||
<Sg, Ins, Fem> => afs ! fsins ;
|
||||
<Pl, Nom|Voc, Masc _> => afs ! mpnom ;
|
||||
<Pl, Gen,_> => afs ! mpgen
|
||||
}
|
||||
} ;
|
||||
|
||||
velikA : Str -> AdjForms = \velik ->
|
||||
let
|
||||
velk : Str = case velik of {
|
||||
vel + "stan" => vel + "sn" ;
|
||||
vel + "ao" => vel + "l" ;
|
||||
vel + "ak" => voicing vel + "k" ;
|
||||
vel + "a" + k@? => vel + k ;
|
||||
vel + "i" => vel ;
|
||||
_ => velik
|
||||
} ;
|
||||
oe : Str = ifSoft velik "e" "o"
|
||||
in table {
|
||||
msnom => velik ;
|
||||
fsnom => velk + "a" ;
|
||||
nsnom => velk + oe ;
|
||||
msgen => velk + oe + "g" ;
|
||||
fsgen => velk + "e" ;
|
||||
msdat => velk + oe + "m" ;
|
||||
fsdat => velk + "oj" ;
|
||||
fsacc => velk + "u" ;
|
||||
msins => velk + "im" ;
|
||||
fsins => velk + "om" ;
|
||||
mpnom => velk + "i" ;
|
||||
mpgen => velk + "ih"
|
||||
} ;
|
||||
|
||||
regComparAForms : AdjForms -> AdjForms
|
||||
= \aposit -> case init (aposit ! fsnom) of {
|
||||
grub@(_ + "b"|"p"|"v"|"h") => velikA (grub + "lji") ;
|
||||
star => velikA (star + "iji")
|
||||
} ;
|
||||
|
||||
superlAForms : AdjForms -> AdjForms
|
||||
= \acompar -> velikA ("naj" + acompar ! msnom) ;
|
||||
|
||||
od_Str = "od" ;
|
||||
|
||||
---------------------
|
||||
-- Verbs
|
||||
-- Wiki
|
||||
|
||||
VerbForms : Type = VForm => Str ;
|
||||
|
||||
ComplementCase : Type = {s : Str ; c : Case ; hasPrep : Bool} ;
|
||||
|
||||
verbAgr : VerbForms -> Agr -> CTense -> Str ---- TODO tenses
|
||||
= \vf,a,b -> case <a,b> of {
|
||||
<Ag _ n p, CTPres> => vf ! VPres n p ;
|
||||
<Ag g n _, CTPast> => vf ! VPastPart g n
|
||||
} ;
|
||||
|
||||
smartVerbForms : Str -> VerbForms = \s -> case s of {
|
||||
cit + "ati" => aeiVerbForms s (cit + "am") (cit + "ao") ;
|
||||
vid + "jeti" => aeiVerbForms s (vid + "im") (vid + "io") ;
|
||||
radi + "ti" => aeiVerbForms s (init radi + "em") (radi + "o") ;
|
||||
_ => Predef.error ("expect infinitive form \"-ti\", found" ++ s)
|
||||
} ;
|
||||
|
||||
-- an traditional paradigm type, with a slight abstraction
|
||||
---- TODO other traditional paradigms
|
||||
|
||||
aeiVerbForms : Str -> Str -> Str -> VerbForms = \citati, citam, citao ->
|
||||
let
|
||||
cita = init citam ;
|
||||
u = case last cita of {
|
||||
"a" => "aju" ;
|
||||
"e" => "u" ;
|
||||
"i" => "e"
|
||||
} ;
|
||||
cital = init citao + "l" ;
|
||||
in table {
|
||||
VInf => citati ;
|
||||
VPres Sg P1 => cita + "m" ;
|
||||
VPres Sg P2 => cita + "š" ;
|
||||
VPres Sg P3 => cita ;
|
||||
VPres Pl P1 => cita + "mo" ;
|
||||
VPres Pl P2 => cita + "te" ;
|
||||
VPres pl P3 => init cita + u ;
|
||||
VPastPart (Masc _) Sg => citao ;
|
||||
VPastPart Fem Sg => cital + "a" ;
|
||||
VPastPart Neutr Sg => cital + "o" ;
|
||||
VPastPart (Masc _) Pl => cital + "i" ;
|
||||
VPastPart Fem Pl => cital + "e" ;
|
||||
VPastPart Neutr Pl => cital + "a"
|
||||
} ;
|
||||
|
||||
|
||||
-- copula
|
||||
|
||||
jesam_Copula : {short, long, negative : Number => Person => Str} =
|
||||
let
|
||||
sam : Number => Person => Str = table {
|
||||
Sg => table {
|
||||
P1 => "sam" ;
|
||||
P2 => "si" ;
|
||||
P3 => "je"
|
||||
} ;
|
||||
Pl => table {
|
||||
P1 => "smo" ;
|
||||
P2 => "ste" ;
|
||||
P3 => "su"
|
||||
}
|
||||
}
|
||||
in {
|
||||
short = sam ;
|
||||
long = \\n,p => case <n,p> of {
|
||||
<Sg,P3> => "jeste" ; --- wiki: jest(e)
|
||||
_ => sam ! n ! p
|
||||
} ;
|
||||
negative = \\n,p => "ni" + sam ! n ! p
|
||||
} ;
|
||||
|
||||
-- Wiki: some grammars (chiefly Serbian ones) treat jesam as a defective verb
|
||||
-- having only present tense. Others treat these forms as two realizations
|
||||
-- of the same irregular verb biti, jesam being imperfective and budem perfective.
|
||||
|
||||
copula_VerbForms : VerbForms = table {
|
||||
VPres n p => jesam_Copula.short ! n ! p ;
|
||||
v => biti_VerbForms ! v
|
||||
} ;
|
||||
|
||||
biti_VerbForms : VerbForms = aeiVerbForms "biti" "budem" "bio" ;
|
||||
|
||||
imati_VerbForms : VerbForms = aeiVerbForms "imati" "imam" "imao" ;
|
||||
|
||||
|
||||
---------------------------
|
||||
-- Pronouns
|
||||
|
||||
PronForms : Type = {
|
||||
nom,
|
||||
gen, cgen, -- bare, clitic (also as Acc)
|
||||
dat, cdat, -- also as Loc
|
||||
ins : Str ;
|
||||
a : Agr
|
||||
} ;
|
||||
|
||||
personalPron : Agr -> PronForms = \a ->
|
||||
{a = a ; cnom = []} **
|
||||
case a of {
|
||||
Ag _ Sg P1 => {
|
||||
nom = "ja" ;
|
||||
gen = "mene" ;
|
||||
cgen = "ma" ;
|
||||
dat = "meni" ;
|
||||
cdat = "mi" ;
|
||||
ins = "mnom"
|
||||
} ;
|
||||
Ag _ Sg P2 => {
|
||||
nom = "ti" ;
|
||||
gen = "tebe" ;
|
||||
cgen = "te" ;
|
||||
dat = "tebi" ;
|
||||
cdat = "ti" ;
|
||||
ins = "tobom"
|
||||
} ;
|
||||
Ag Fem Sg P3 => {
|
||||
nom = "ona" ;
|
||||
gen = "nje" ;
|
||||
cgen = "je" ;
|
||||
dat = "njoj" ;
|
||||
cdat = "joj" ;
|
||||
ins = "njom"
|
||||
} ;
|
||||
Ag g Sg P3 => {
|
||||
nom = case g of {
|
||||
Masc _ => "on" ;
|
||||
_ => "ono"
|
||||
} ;
|
||||
gen = "njega" ;
|
||||
cgen = "ga" ;
|
||||
dat = "njemu" ;
|
||||
cdat = "mu" ;
|
||||
ins = "njim"
|
||||
} ;
|
||||
|
||||
Ag _ Pl P1 => {
|
||||
nom = "mi" ;
|
||||
gen, cgen = "nas" ;
|
||||
dat, ins = "nama" ;
|
||||
cdat = "nam"
|
||||
} ;
|
||||
Ag _ Pl P2 => {
|
||||
nom = "vi" ;
|
||||
gen, cgen = "vas" ;
|
||||
dat, ins = "vama" ;
|
||||
cdat = "vam"
|
||||
} ;
|
||||
Ag g Pl P3 => {
|
||||
nom = case g of {
|
||||
Masc _ => "oni" ;
|
||||
Fem => "one" ;
|
||||
Neutr => "ona"
|
||||
} ;
|
||||
gen = "njih" ;
|
||||
cgen = "ih" ;
|
||||
dat, ins = "njima" ;
|
||||
cdat = "im"
|
||||
}
|
||||
} ;
|
||||
|
||||
possessivePron : Agr -> AdjForms = \a -> case a of {
|
||||
Ag _ Sg P1 => velikA "moj" ;
|
||||
Ag _ Sg P2 => velikA "tvoj" ;
|
||||
Ag (Masc _) Sg P3 => velikA "njegov" ;
|
||||
Ag (Fem|Neutr) Sg P3 => velikA "njezin" ; -- BCMS: Hrv: otherwise njen
|
||||
Ag _ Pl P1 => velikA "naš" ;
|
||||
Ag _ Pl P2 => velikA "vaš" ;
|
||||
Ag _ Pl P3 => velikA "njihov"
|
||||
} ;
|
||||
|
||||
{-
|
||||
reflPossessivePron : DemPronForms = otcovA "svoj" ** {
|
||||
msnom = "svoj" ; msgen = "svojho" ; msdat = "svojmu" ;
|
||||
msins = "svojím" ;
|
||||
ampnom = "svoji" ;
|
||||
nsnom, fpnom = "svoje" ;
|
||||
pgen = "svojich" ;
|
||||
pdat = "svojim" ;
|
||||
pins = "svojimi" ;
|
||||
} ;
|
||||
-}
|
||||
|
||||
mkPron : Agr -> PronForms ** {poss : AdjForms} = \a ->
|
||||
personalPron a ** {poss = possessivePron a} ;
|
||||
|
||||
|
||||
param NumSize = NS_1 | NS_2_4 | NS_5_20 | NS_20_ ;
|
||||
|
||||
oper
|
||||
Determiner : Type = {
|
||||
s : Gender => Case => Str ;
|
||||
size : NumSize
|
||||
} ;
|
||||
|
||||
{-
|
||||
-- interrogatives TODO
|
||||
|
||||
ktoForms : Case => Str = table {
|
||||
Nom => "kto" ;
|
||||
Gen | Acc => "koho" ;
|
||||
Dat => "komu" ;
|
||||
Loc => "kom" ;
|
||||
Ins => "kým"
|
||||
} ;
|
||||
|
||||
coForms : Case => Str = table {
|
||||
Nom|Acc => "čo" ;
|
||||
Gen => "čoho" ;
|
||||
Dat => "čomu" ;
|
||||
Loc => "čom" ;
|
||||
Ins => "čím"
|
||||
} ;
|
||||
-}
|
||||
|
||||
|
||||
--------------------------------
|
||||
-- combining nouns with numerals
|
||||
|
||||
oper
|
||||
numSizeForm : (Number => Case => Str) -> NumSize -> Case -> Str
|
||||
= \cns,n,c -> case n of {
|
||||
NS_1 => cns ! Sg ! c ;
|
||||
NS_2_4 => cns ! Pl ! c ;
|
||||
_ => case c of {
|
||||
Nom | Acc => cns ! Pl ! Gen ;
|
||||
_ => cns ! Pl ! c
|
||||
}
|
||||
} ;
|
||||
|
||||
numSizeAgr : Gender -> NumSize -> Person -> Agr
|
||||
= \g,ns,p -> case ns of {
|
||||
NS_1 => Ag g Sg p ;
|
||||
NS_2_4 => Ag g Pl p ;
|
||||
_ => Ag Neutr Sg p ---- TODO verify
|
||||
} ;
|
||||
|
||||
numSizeNumber : NumSize -> Number = \ns -> case ns of {
|
||||
NS_1 => Sg ;
|
||||
_ => Pl ---- TO CHECK
|
||||
} ;
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user