summaryrefslogtreecommitdiff
path: root/next-lib/src/interlingua/MorphoIna.gf
blob: 3ad94282ab5fcd68ac129c2abfe853ede606b747 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
--# -path=.:../../prelude

--1 A Simple Interlingua Resource Morphology
--
-- Aarne Ranta 2003--2005
-- JP Bernardy 2007
--
-- This resource morphology contains definitions needed in the resource
-- syntax. To build a lexicon, it is better to use $ParadigmsIna$, which
-- gives a higher-level access to this module.

resource MorphoIna = ResIna ** open Prelude, (Predef=Predef) in {

  flags optimize=all ;

--2 Nouns
--
-- For conciseness and abstraction, we define a worst-case macro for
-- noun inflection. It is used for defining special case that
-- only need one string as argument.

oper
    CommonNoun  : Type = {s : Number => Str};  -- nouns are inflected in number

    nounGen : Str -> Str -> CommonNoun = \mec,mecs -> 
      {s = table {Sg => mec;
		  Pl => mecs
	 };
      };

    nounReg : Str -> CommonNoun = \cas -> 
      let s = case last cas of {
	    "a" | "e" | "i" | "o" | "u" => "s" ;
	  "c" => "hes";
	  _ => "es" 
	    }
      in nounGen cas (cas + s) ;

--2 Determiners

    mkDeterminer : Number -> Str -> {s : Case => Str ; n : Number} = \n,s ->
      {s = \\c=>casePrep "" c ++ s ; n = n} ;

    mkIDeterminer : Number -> Str -> {s : Str ; n : Number} = \n,s ->
      {s = s ; n = n} ;

--2 Adjectives
--
-- To form the adjectival and the adverbial forms, 3 strings are needed
-- in the worst case. (bon, melior, optime)

  Adjective = {s : AForm => Str} ;

-- However, most adjectives can be inflected using the final character.

  regAdjective : Str -> Adjective = \clar -> 
    mkAdjective clar ("plus" ++ clar) ("le" ++ "plus" ++ clar) ; 

--3 Verbs

  -- defined in resina

} ;