mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-05-27 17:08:54 -06:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0e5b224f5c | |||
| 7a1d1412fb | |||
| 19e35edf09 | |||
| 43979ed054 | |||
| 786340192f | |||
| ecdc0a85f6 | |||
| 0bd3506e1b | |||
| fc2b2a0954 | |||
| eccbdcfb97 | |||
| d2568cf869 | |||
| bcb16ae376 | |||
|
|
deb9d40b7e | ||
|
|
25f422f5ca | ||
|
|
f0abf5deff |
12
.gitignore
vendored
12
.gitignore
vendored
@@ -5,3 +5,15 @@ dist/
|
||||
*.pgf
|
||||
*.tmp
|
||||
*~
|
||||
.direnv
|
||||
_grphp_*.dot
|
||||
_grphp_*.png
|
||||
_grpht_*.dot
|
||||
_grpht_*.png
|
||||
_gftmp
|
||||
t.dot
|
||||
t.dot.png
|
||||
u.dot.png
|
||||
t.dot.*.png
|
||||
u.dot.*.png
|
||||
u.dot
|
||||
|
||||
62
flake.lock
generated
Normal file
62
flake.lock
generated
Normal file
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1775036866,
|
||||
"narHash": "sha256-ZojAnPuCdy657PbTq5V0Y+AHKhZAIwSIT2cb8UgAz/U=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "6201e203d09599479a3b3450ed24fa81537ebc4e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1750386251,
|
||||
"narHash": "sha256-1ovgdmuDYVo5OUC5NzdF+V4zx2uT8RtsgZahxidBTyw=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "076e8c6678d8c54204abcb4b1b14c366835a58bb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs",
|
||||
"sydpkgs": "sydpkgs"
|
||||
}
|
||||
},
|
||||
"sydpkgs": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1771299872,
|
||||
"narHash": "sha256-+OPW1SKKHT7aqhyjs2O20gd1MXa7LyD+9/lwMUCVL7Y=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "53bf019e26478666ab7f458f78e569b8b106cc1f",
|
||||
"revCount": 36,
|
||||
"type": "git",
|
||||
"url": "https://git.deertopia.net/msyds/sydpkgs"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "https://git.deertopia.net/msyds/sydpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
55
flake.nix
Normal file
55
flake.nix
Normal file
@@ -0,0 +1,55 @@
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
# gf.url = "github:anka-213/cclaw-nix-stuff/nix-flakes";
|
||||
sydpkgs.url = "git+https://git.deertopia.net/msyds/sydpkgs";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, sydpkgs, ... }@inputs:
|
||||
let
|
||||
supportedSystems = [
|
||||
"aarch64-darwin"
|
||||
"aarch64-linux"
|
||||
"x86_64-darwin"
|
||||
"x86_64-linux"
|
||||
];
|
||||
|
||||
each-system = f: nixpkgs.lib.genAttrs supportedSystems (system: f rec {
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [
|
||||
# (final: prev: { inherit (gf.packages.${system}) gf-core; })
|
||||
sydpkgs.overlays.default
|
||||
];
|
||||
};
|
||||
inherit (pkgs) lib;
|
||||
inherit system;
|
||||
});
|
||||
in {
|
||||
# Exposed as a REPL convenience.
|
||||
_pkgs = each-system ({ pkgs, ... }: pkgs);
|
||||
|
||||
packages = each-system ({ pkgs, ... }: {
|
||||
default = pkgs.callPackage ./package.nix {};
|
||||
});
|
||||
|
||||
devShells = each-system ({ pkgs, system, ... }:
|
||||
let
|
||||
gf-lsp = import
|
||||
(pkgs.fetchzip {
|
||||
url = "https://github.com/anka-213/gf-lsp/archive/refs/tags/1.0.6.0.tar.gz";
|
||||
hash = "sha256-UAI2qUslzLOWYjTirZJ0y4DZbkPZnVXTY0XtFO8+Rks=";
|
||||
}) {inherit system;};
|
||||
in {
|
||||
default = pkgs.mkShell {
|
||||
inputsFrom = [ self.packages.${system}.default ];
|
||||
packages = [
|
||||
gf-lsp.gf-lsp
|
||||
pkgs.gftest
|
||||
pkgs.graphviz
|
||||
pkgs.imagemagick
|
||||
];
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
23
package.nix
Normal file
23
package.nix
Normal file
@@ -0,0 +1,23 @@
|
||||
{ stdenv
|
||||
, ghc
|
||||
, gf-core
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "gf-rgl";
|
||||
src = ./.;
|
||||
buildInputs = [ ghc gf-core ];
|
||||
# Keep references to source, so go to definition works
|
||||
# postUnpack = ''
|
||||
# rm -r source/src
|
||||
# ln -s $src/src source/src
|
||||
# '';
|
||||
LC_ALL = "C.UTF-8";
|
||||
buildPhase = ''
|
||||
runghc Setup.hs build
|
||||
'';
|
||||
installPhase = ''
|
||||
mkdir -p $out/share/gf/lib
|
||||
runghc Setup.hs copy --dest=$out/share/gf/lib
|
||||
'';
|
||||
}
|
||||
@@ -52,6 +52,12 @@ apiModules = ["Try","Symbolic","Syntax","Constructors","Combinators"]
|
||||
|
||||
clone :: [String] -> String -> String -> String -> String -> (String, String) -> IO ()
|
||||
clone options fromdir todir from to (absname,absfx) = do
|
||||
printf "clone options=%s\n\
|
||||
\ fromdir=%s\n\
|
||||
\ todir=%s\n\
|
||||
\ from=%s\n\
|
||||
\ to=%s\n" (show options) (show fromdir)
|
||||
(show todir) (show from) (show to)
|
||||
s <- readFile (fromdir ++ "/" ++ absname ++ from ++ absfx ++ ".gf")
|
||||
writeAndReportFile (todir ++ "/" ++ absname ++ to ++ absfx ++ ".gf") (commentIf options (replaceLang from to s))
|
||||
|
||||
|
||||
@@ -45,5 +45,7 @@ lincat VPSlash = {present : Aspect => Number => Person => Str;
|
||||
lincat Cl = {present : Aspect => Str;
|
||||
aorist : Str;
|
||||
participle : {aorist : Aspect => Str; perfect : Aspect => Str}} ;
|
||||
lincat IP = {s : Str} ;
|
||||
lincat Subj = {s : Str} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -1086,6 +1086,23 @@ dualV : V -> V -> V = \impf,perf -> lin V
|
||||
isRefl = impf.isRefl
|
||||
} ;
|
||||
|
||||
compoundV = overload {
|
||||
compoundV : V -> Str -> V = \v,s -> lin V {
|
||||
present = \\a,n,p => v.present ! a ! n ! p ++ s ;
|
||||
aorist = \\n,p => v.aorist ! n ! p ++ s ;
|
||||
imperfect = \\a,n,p => v.imperfect ! a ! n ! p ++ s ;
|
||||
imperative = \\a,n => v.imperative ! a ! n ++ s ;
|
||||
participle = { aorist = \\a,gn => v.participle.aorist ! a ! gn ++ s ;
|
||||
imperfect = \\gn => v.participle.imperfect ! gn ++ s ;
|
||||
perfect = \\a => v.participle.perfect ! a ++ s ;
|
||||
adjectival = \\a => v.participle.adjectival ! a ++ s ;
|
||||
adverbial = v.participle.adverbial
|
||||
} ;
|
||||
noun_from_verb = v.noun_from_verb ++ s ;
|
||||
isRefl = v.isRefl
|
||||
}
|
||||
} ;
|
||||
|
||||
mkV2 = overload {
|
||||
mkV2 : V -> V2 = \v -> lin V2 v ** {c2=noPrep} ;
|
||||
mkV2 : V -> Prep -> V2 = \v,p -> lin V2 v ** {c2=p} ;
|
||||
@@ -1142,4 +1159,19 @@ mkVoc : Str -> Voc = \s -> lin Voc {s=s} ;
|
||||
mkPrep : Str -> Prep = \s -> lin Prep {s=s} ;
|
||||
noPrep : Prep = lin Prep {s=""} ;
|
||||
|
||||
mkIP : Str -> IP = \s -> lin IP {s=s} ;
|
||||
mkIAdv : Str -> IAdv = \s -> lin IAdv {s=s} ;
|
||||
mkIQuant : Str -> IQuant = \s -> lin IQuant {s=s} ;
|
||||
mkIDet : Str -> IDet = \s -> lin IDet {s=s} ;
|
||||
mkMU : Str -> MU = \s -> lin MU {s=s; isPre = False} ;
|
||||
mkSubj : Str -> Subj = \s -> lin Subj {s=s} ;
|
||||
mkQuant : Str -> Quant = \s -> lin Quant {s=s; sp=Indef} ;
|
||||
mkDet : Str -> Det = \s -> lin Det {s=s; n=Sg; sp=Indef} ;
|
||||
mkConj : Str -> Conj = \s -> lin Conj {s=s} ;
|
||||
mkPConj : Str -> PConj = \s -> lin PConj {s=s} ;
|
||||
mkPredet : Str -> Predet = \s -> lin Predet {s=s} ;
|
||||
mkCAdv : Str -> CAdv = \s -> lin CAdv {s=s; p=""} ;
|
||||
mkCard : Str -> Card = \s -> lin Card {s=s} ;
|
||||
mkACard : Str -> ACard = \s -> lin ACard {s=s} ;
|
||||
|
||||
}
|
||||
|
||||
64
src/toki-pona/AdjectiveTok.gf
Normal file
64
src/toki-pona/AdjectiveTok.gf
Normal file
@@ -0,0 +1,64 @@
|
||||
concrete AdjectiveTok of Adjective = CatTok ** open ResTok, Prelude in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
lin
|
||||
|
||||
-- : AP -> Adv -> AP ; -- warm by nature
|
||||
AdvAP ap adv = ap ** {
|
||||
s = ap.s ++ adv.s ;
|
||||
} ;
|
||||
|
||||
-- : A -> AP ;
|
||||
PositA a = a ;
|
||||
|
||||
-- : A -> NP -> AP ;
|
||||
ComparA a np = a ; -- Not straightforward for Toki Pona.
|
||||
|
||||
-- : A2 -> NP -> AP ; -- married to her
|
||||
-- ComplA2 a2 np = a2 ** { } ;
|
||||
|
||||
-- : A2 -> AP ; -- married to itself
|
||||
-- ReflA2 a2 = a2 ** { } ;
|
||||
|
||||
-- : A2 -> AP ; -- married
|
||||
UseA2 = PositA ;
|
||||
|
||||
-- : A -> AP ; -- warmer
|
||||
-- UseComparA a = a ** {
|
||||
-- s = \\af => "???" ++ a.s ! af ;
|
||||
-- compar = []
|
||||
-- } ;
|
||||
|
||||
|
||||
-- : CAdv -> AP -> NP -> AP ; -- as cool as John
|
||||
-- CAdvAP adv ap np = ap ** { } ;
|
||||
|
||||
-- The superlative use is covered in $Ord$.
|
||||
|
||||
-- : Ord -> AP ; -- warmest
|
||||
-- AdjOrd ord = ord ** {
|
||||
-- compar = []
|
||||
-- } ;
|
||||
-- AdjOrd : Ord -> AP =
|
||||
AdjOrd ord = ord ;
|
||||
|
||||
-- Sentence and question complements defined for all adjectival
|
||||
-- phrases, although the semantics is only clear for some adjectives.
|
||||
|
||||
-- : AP -> SC -> AP ; -- good that she is here
|
||||
-- SentAP ap sc = ap ** {
|
||||
-- s = \\af => ap.s ! af ++ sc.s
|
||||
-- } ;
|
||||
|
||||
-- An adjectival phrase can be modified by an *adadjective*, such as "very".
|
||||
|
||||
-- : AdA -> AP -> AP ;
|
||||
-- AdAP ada ap = ap ** { } ;
|
||||
|
||||
|
||||
-- It can also be postmodified by an adverb, typically a prepositional phrase.
|
||||
|
||||
|
||||
|
||||
}
|
||||
38
src/toki-pona/AdverbTok.gf
Normal file
38
src/toki-pona/AdverbTok.gf
Normal file
@@ -0,0 +1,38 @@
|
||||
concrete AdverbTok of Adverb = CatTok ** open ResTok, ParadigmsTok, Prelude in {
|
||||
lin
|
||||
|
||||
-- : A -> Adv ;
|
||||
PositAdvAdj adj = {s=adj.s;} ;
|
||||
|
||||
-- : CAdv -> A -> NP -> Adv ; -- more warmly than John
|
||||
-- ComparAdvAdj cadv a np =
|
||||
|
||||
-- : CAdv -> A -> S -> Adv ; -- more warmly than he runs
|
||||
-- ComparAdvAdjS cadv a s =
|
||||
|
||||
-- : Prep -> NP -> Adv ;
|
||||
PrepNP prep np = {
|
||||
s = prep.s ++ np.s ;
|
||||
} ;
|
||||
|
||||
-- Adverbs can be modified by 'adadjectives', just like adjectives.
|
||||
|
||||
-- : AdA -> Adv -> Adv ; -- very quickly
|
||||
-- AdAdv ada adv = adv **
|
||||
|
||||
-- Like adverbs, adadjectives can be produced by adjectives.
|
||||
|
||||
-- : A -> AdA ; -- extremely
|
||||
-- PositAdAAdj a =
|
||||
|
||||
-- Subordinate clauses can function as adverbs.
|
||||
|
||||
-- : Subj -> S -> Adv ;
|
||||
-- SubjS subj s = {s = subj.s ++ s.s} ;
|
||||
|
||||
-- Comparison adverbs also work as numeral adverbs.
|
||||
|
||||
-- : CAdv -> AdN ; -- less (than five)
|
||||
-- AdnCAdv cadv = ;
|
||||
|
||||
}
|
||||
6
src/toki-pona/AllTok.gf
Normal file
6
src/toki-pona/AllTok.gf
Normal file
@@ -0,0 +1,6 @@
|
||||
--# -path=.:../abstract:../common:../prelude
|
||||
|
||||
concrete AllTok of AllTokAbs =
|
||||
LangTok,
|
||||
ExtendTok
|
||||
;
|
||||
5
src/toki-pona/AllTokAbs.gf
Normal file
5
src/toki-pona/AllTokAbs.gf
Normal file
@@ -0,0 +1,5 @@
|
||||
--# -path=.:../abstract:../common:prelude
|
||||
|
||||
abstract AllTokAbs =
|
||||
Lang,
|
||||
Extend ;
|
||||
120
src/toki-pona/CatTok.gf
Normal file
120
src/toki-pona/CatTok.gf
Normal file
@@ -0,0 +1,120 @@
|
||||
--# -path=.:../abstract:../common:../prelude
|
||||
concrete CatTok of Cat = CommonX ** open ResTok, Coordination, Prelude in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
lincat
|
||||
|
||||
--2 Sentences and clauses
|
||||
-- Constructed in SentenceTok, and also in IdiomTok
|
||||
S = SS ;
|
||||
QS = SS ;
|
||||
RS = SS ;
|
||||
-- relative sentence. Tense and polarity fixed,
|
||||
-- but agreement may depend on the CN/NP it modifies.
|
||||
|
||||
Cl = ResTok.LinCl ;
|
||||
ClSlash = SS ;
|
||||
SSlash = SS ; -- sentence missing NP; e.g. "she has looked at"
|
||||
Imp = SS ; -- imperative e.g. "look at this"
|
||||
|
||||
--2 Questions and interrogatives
|
||||
|
||||
-- Constructed in QuestionTok.
|
||||
QCl = SS ;
|
||||
IComp = SS ; -- interrogative complement of copula e.g. "where"
|
||||
IDet = SS ; -- interrogative determiner e.g. "how many"
|
||||
IQuant = SS ; -- interrogative quantifier e.g. "which"
|
||||
IP = SS ; -- interrogative pronoun e.g. "who"
|
||||
|
||||
--2 Subord clauses and pronouns
|
||||
|
||||
RCl = SS ;
|
||||
RP = SS ;
|
||||
|
||||
--2 Verb phrases
|
||||
|
||||
-- Constructed in VerbTok.
|
||||
VP,VPSlash = ResTok.LinVP ;
|
||||
Comp = SS ;
|
||||
|
||||
--2 Adjectival phrases
|
||||
|
||||
-- Constructed in AdjectiveTok.
|
||||
AP = SS ;
|
||||
|
||||
--2 Nouns and noun phrases
|
||||
|
||||
-- Constructed in NounTok.
|
||||
-- Many atomic noun phrases e.g. "everybody"
|
||||
-- are constructed in StructuralTok.
|
||||
|
||||
CN = ResTok.LinCN ;
|
||||
NP = ResTok.LinNP ;
|
||||
-- NB. Pronouns need enough info to become NP or Quant.
|
||||
Pron = ResTok.LinPron ;
|
||||
Det = ResTok.LinDet ; -- s : Str , n : Number
|
||||
Predet = SS ;
|
||||
Quant = ResTok.LinQuant ; -- s : Number => Str
|
||||
Num = ResTok.LinDet ;
|
||||
Card = ResTok.LinDet ;
|
||||
ACard = SS ;
|
||||
Ord = SS ;
|
||||
DAP = SS ;
|
||||
|
||||
|
||||
--2 Numerals
|
||||
|
||||
-- Constructed in NumeralTok.
|
||||
|
||||
Numeral = ResTok.LinNumeral ;
|
||||
Digits = ResTok.LinNumeral ;
|
||||
Decimal = SS ;
|
||||
|
||||
--2 Structural words
|
||||
|
||||
-- Constructed in StructuralTok.
|
||||
Conj = Coordination.ConjunctionDistr ;
|
||||
Subj = SS ;
|
||||
Prep = SS ;
|
||||
|
||||
|
||||
|
||||
--2 Words of open classes
|
||||
|
||||
-- These are constructed in LexiconTok and in
|
||||
-- additional lexicon modules.
|
||||
|
||||
-- TODO: eventually different lincats
|
||||
VS, -- sentence-complement verb e.g. "claim"
|
||||
VQ, -- question-complement verb e.g. "wonder"
|
||||
VA, -- adjective-complement verb e.g. "look"
|
||||
V = ResTok.LinV ;
|
||||
|
||||
VV -- verb-phrase-complement verb e.g. "want"
|
||||
= ResTok.Preverb ;
|
||||
|
||||
V2A, -- verb with NP and AP complement e.g. "paint"
|
||||
V2V, -- verb with NP and V complement e.g. "cause"
|
||||
V2S, -- verb with NP and S complement e.g. "tell"
|
||||
V2Q, -- verb with NP and Q complement e.g. "ask"
|
||||
V2 = SS ;
|
||||
V3 = SS ;
|
||||
|
||||
A = SS ;
|
||||
A2 = SS ;
|
||||
|
||||
N = ResTok.LinN ;
|
||||
N2 = ResTok.LinN ;
|
||||
N3 = ResTok.LinN ;
|
||||
PN = ResTok.LinPN ;
|
||||
|
||||
-- From the Names module, not in the official API as of 2023-08
|
||||
GN = SS ; -- Given name, e.g. "George"
|
||||
SN = SS ; -- Second name, e.g. "Washington"
|
||||
LN = SS ; -- Location name, e.g. "Sweden"
|
||||
|
||||
-- linref
|
||||
-- Cl = linCl ;
|
||||
|
||||
}
|
||||
147
src/toki-pona/ConjunctionTok.gf
Normal file
147
src/toki-pona/ConjunctionTok.gf
Normal file
@@ -0,0 +1,147 @@
|
||||
concrete ConjunctionTok of Conjunction =
|
||||
CatTok ** open ResTok, Coordination, Prelude in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
{- Conjunction for category X needs four things:
|
||||
lincat [X]
|
||||
lin BaseX
|
||||
lin ConsX
|
||||
lin ConjX
|
||||
|
||||
For example, if X is defined as
|
||||
|
||||
lincat X = {s : Number => Str ; g : Gender} ;
|
||||
|
||||
then [X] will split its s field into two, and retain its other fields as is:
|
||||
|
||||
lincat [X] = {s1,s2 : Number => Str ; g : Gender} ;
|
||||
|
||||
Let us look at a simple case: Adv is of type {s : Str}
|
||||
Then [Adv] is {s1,s2 : Str}.
|
||||
BaseAdv, ConsAdv and ConjAdv can all use functions defined in prelude/Coordination:
|
||||
|
||||
BaseAdv = twoSS ;
|
||||
ConsAdv = consrSS comma ;
|
||||
ConjAdv = conjunctSS ;
|
||||
|
||||
--}
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Adverb and other simple {s : Str} types.
|
||||
lincat
|
||||
[Adv],[AdV],[IAdv] = {s1,s2 : Str} ;
|
||||
|
||||
lin
|
||||
BaseAdv, BaseAdV, BaseIAdv = twoSS ;
|
||||
ConsAdv, ConsAdV, ConsIAdv = consrSS comma ;
|
||||
ConjAdv, ConjAdV, ConjIAdv = conjunctDistrSS ;
|
||||
|
||||
{-
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- S is sometimes already {s : Str}, sometimes open for mood or word order.
|
||||
-- Simply take the lincat of S, and split the s field into s1 and s2.
|
||||
-- Then make sure that all of the other fields are retained.
|
||||
|
||||
lincat
|
||||
[S] = {s1, s2 : …} ;
|
||||
|
||||
lin
|
||||
-- : S -> S -> ListS ; -- John walks, Mary runs
|
||||
BaseS x y =
|
||||
|
||||
-- : S -> ListS -> ListS ; -- John walks, Mary runs, Bill swims
|
||||
ConsS x xs =
|
||||
|
||||
-- : Conj -> ListS -> S ; -- he walks and she runs
|
||||
ConjS conj xs =
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- RS is variable on … and has inherent …
|
||||
-- RS can modify CNs, which are open for …, and have inherent …
|
||||
|
||||
lincat
|
||||
[RS] = {s1,s2 : … => Str} ;
|
||||
|
||||
lin
|
||||
|
||||
-- : RS -> RS -> ListRS ; -- who walks, whom I know
|
||||
BaseRS x y =
|
||||
|
||||
-- : RS -> ListRS -> ListRS ; -- who wals, whom I know, who is here
|
||||
ConsRS x xs =
|
||||
|
||||
-- : Conj -> ListRS -> RS ; -- who walks and whose mother runs
|
||||
ConjRS conj xs =
|
||||
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- NP is variable on … and has inherent …
|
||||
|
||||
lincat
|
||||
[NP] = {s1, s2 : …} ;
|
||||
|
||||
lin
|
||||
-- : NP -> NP -> ListNP ; -- John, Mary
|
||||
BaseNP x y =
|
||||
|
||||
-- : NP -> ListNP -> ListNP ; -- John, Mary, Bill
|
||||
ConsNP x xs =
|
||||
|
||||
-- : Conj -> ListNP -> NP ; -- she or we
|
||||
ConjNP conj xs =
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- AP is variable on … and has an inherent …
|
||||
|
||||
lincat
|
||||
[AP] = {s1, s2 : …} ;
|
||||
|
||||
lin
|
||||
-- : AP -> AP -> ListAP ; -- red, white
|
||||
BaseAP x y =
|
||||
|
||||
-- : AP -> ListAP -> ListAP ; -- red, white, blue
|
||||
ConsAP x xs =
|
||||
|
||||
-- : Conj -> ListAP -> AP ; -- cold and warm
|
||||
ConjAP conj xs =
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- CN is variable on …
|
||||
-- CN conjunction is not in the API, so this can be lower prio
|
||||
|
||||
lincat
|
||||
[CN] = {s1, s2 : …} ;
|
||||
|
||||
lin
|
||||
-- : CN -> CN -> ListCN ; -- man, woman
|
||||
BaseCN x y =
|
||||
|
||||
-- : CN -> ListCN -> ListCN ; -- man, woman, child
|
||||
ConsCN x xs =
|
||||
|
||||
-- : Conj -> ListCN -> CN ; -- man and woman
|
||||
ConjCN conj xs =
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Det and DAP
|
||||
-- Note that there is no [Det], the way to coordinate Dets is to make them
|
||||
-- into DAP first, using Noun.DetDAP : Det -> DAP ;
|
||||
-- DAP ("three small") isn't used in any API functions, so lower prio.
|
||||
|
||||
lincat
|
||||
[DAP] = {s1, s2 : …} ;
|
||||
|
||||
lin
|
||||
-- : DAP -> DAP -> ListDAP ;
|
||||
BaseDAP x y =
|
||||
|
||||
-- : DAP -> ListDAP -> ListDAP ;
|
||||
ConsDAP xs x =
|
||||
|
||||
-- : Conj -> ListDAP -> Det ; -- his or her
|
||||
ConjDet conj xs =
|
||||
-}
|
||||
}
|
||||
117
src/toki-pona/ConstructionTok.gf
Normal file
117
src/toki-pona/ConstructionTok.gf
Normal file
@@ -0,0 +1,117 @@
|
||||
concrete ConstructionTok of Construction = CatTok ** open ParadigmsTok in {
|
||||
|
||||
lincat
|
||||
Timeunit = N ;
|
||||
Weekday = N ;
|
||||
Monthday = NP ;
|
||||
Month = N ;
|
||||
Year = NP ;
|
||||
{-
|
||||
lin
|
||||
|
||||
timeunitAdv n time =
|
||||
let n_card : Card = n ;
|
||||
n_hours_NP : NP = mkNP n_card time ;
|
||||
in SyntaxTok.mkAdv for_Prep n_hours_NP | mkAdv (n_hours_NP.s ! R.npNom) ;
|
||||
|
||||
weekdayPunctualAdv w = ; -- on Sunday
|
||||
weekdayHabitualAdv w = ; -- on Sundays
|
||||
weekdayNextAdv w = -- next Sunday
|
||||
weekdayLastAdv w = -- last Sunday
|
||||
|
||||
monthAdv m = mkAdv in_Prep (mkNP m) ;
|
||||
yearAdv y = mkAdv in_Prep y ;
|
||||
dayMonthAdv d m = ; -- on 17 Tok
|
||||
monthYearAdv m y = ; -- in Tok 2012
|
||||
dayMonthYearAdv d m y = ; -- on 17 Tok 2013
|
||||
|
||||
intYear = symb ;
|
||||
intMonthday = symb ;
|
||||
|
||||
lincat Language = N ;
|
||||
|
||||
lin InLanguage l = mkAdv ???_Prep (mkNP l) ;
|
||||
|
||||
lin
|
||||
weekdayN w = w ;
|
||||
monthN m = m ;
|
||||
|
||||
weekdayPN w = mkPN w ;
|
||||
monthPN m = mkPN m ;
|
||||
|
||||
languageCN l = mkCN l ;
|
||||
languageNP l = mkNP l ;
|
||||
|
||||
|
||||
oper mkLanguage : Str -> N = \s -> mkN s ;
|
||||
|
||||
----------------------------------------------
|
||||
---- lexicon of special names
|
||||
|
||||
lin second_Timeunit = mkN "second" ;
|
||||
lin minute_Timeunit = mkN "minute" ;
|
||||
lin hour_Timeunit = mkN "hour" ;
|
||||
lin day_Timeunit = mkN "day" ;
|
||||
lin week_Timeunit = mkN "week" ;
|
||||
lin month_Timeunit = mkN "month" ;
|
||||
lin year_Timeunit = mkN "year" ;
|
||||
|
||||
lin monday_Weekday = mkN "Monday" ;
|
||||
lin tuesday_Weekday = mkN "Tuesday" ;
|
||||
lin wednesday_Weekday = mkN "Wednesday" ;
|
||||
lin thursday_Weekday = mkN "Thursday" ;
|
||||
lin friday_Weekday = mkN "Friday" ;
|
||||
lin saturday_Weekday = mkN "Saturday" ;
|
||||
lin sunday_Weekday = mkN "Sunday" ;
|
||||
|
||||
lin january_Month = mkN "January" ;
|
||||
lin february_Month = mkN "February" ;
|
||||
lin march_Month = mkN "March" ;
|
||||
lin april_Month = mkN "April" ;
|
||||
lin may_Month = mkN "May" ;
|
||||
lin june_Month = mkN "June" ;
|
||||
lin july_Month = mkN "July" ;
|
||||
lin august_Month = mkN "August" ;
|
||||
lin september_Month = mkN "September" ;
|
||||
lin october_Month = mkN "October" ;
|
||||
lin november_Month = mkN "November" ;
|
||||
lin december_Month = mkN "December" ;
|
||||
|
||||
lin afrikaans_Language = mkLanguage "Afrikaans" ;
|
||||
lin amharic_Language = mkLanguage "Amharic" ;
|
||||
lin arabic_Language = mkLanguage "Arabic" ;
|
||||
lin bulgarian_Language = mkLanguage "Bulgarian" ;
|
||||
lin catalan_Language = mkLanguage "Catalan" ;
|
||||
lin chinese_Language = mkLanguage "Chinese" ;
|
||||
lin danish_Language = mkLanguage "Danish" ;
|
||||
lin dutch_Language = mkLanguage "Dutch" ;
|
||||
lin english_Language = mkLanguage "Euslish" ;
|
||||
lin estonian_Language = mkLanguage "Estonian" ;
|
||||
lin finnish_Language = mkLanguage "Finnish" ;
|
||||
lin french_Language = mkLanguage "French" ;
|
||||
lin german_Language = mkLanguage "German" ;
|
||||
lin greek_Language = mkLanguage "Greek" ;
|
||||
lin hebrew_Language = mkLanguage "Hebrew" ;
|
||||
lin hindi_Language = mkLanguage "Hindi" ;
|
||||
lin japanese_Language = mkLanguage "Japanese" ;
|
||||
lin italian_Language = mkLanguage "Italian" ;
|
||||
lin latin_Language = mkLanguage "Latin" ;
|
||||
lin latvian_Language = mkLanguage "Latvian" ;
|
||||
lin maltese_Language = mkLanguage "Maltese" ;
|
||||
lin nepali_Language = mkLanguage "Nepali" ;
|
||||
lin norwegian_Language = mkLanguage "Norwegian" ;
|
||||
lin persian_Language = mkLanguage "Persian" ;
|
||||
lin polish_Language = mkLanguage "Polish" ;
|
||||
lin punjabi_Language = mkLanguage "Punjabi" ;
|
||||
lin romanian_Language = mkLanguage "Romanian" ;
|
||||
lin russian_Language = mkLanguage "Russian" ;
|
||||
lin sindhi_Language = mkLanguage "Sindhi" ;
|
||||
lin spanish_Language = mkLanguage "Spanish" ;
|
||||
lin swahili_Language = mkLanguage "Swahili" ;
|
||||
lin swedish_Language = mkLanguage "Swedish" ;
|
||||
lin thai_Language = mkLanguage "Thai" ;
|
||||
lin turkish_Language = mkLanguage "Turkish" ;
|
||||
lin urdu_Language = mkLanguage "Urdu" ;
|
||||
|
||||
-}
|
||||
}
|
||||
35
src/toki-pona/ExtendTok.gf
Normal file
35
src/toki-pona/ExtendTok.gf
Normal file
@@ -0,0 +1,35 @@
|
||||
--# -path=.:../common:../abstract
|
||||
|
||||
concrete ExtendTok of Extend = CatTok
|
||||
** ExtendFunctor - [
|
||||
VPS -- finite VP's with tense and polarity
|
||||
, ListVPS
|
||||
, VPI
|
||||
, ListVPI -- infinitive VP's (TODO: with anteriority and polarity)
|
||||
, MkVPS
|
||||
, PredVPS
|
||||
|
||||
-- excluded because RGL funs needed for them not implemented yet
|
||||
, SlashBareV2S
|
||||
, PredAPVP
|
||||
, ComplBareVS
|
||||
, AdvIsNP, AdvIsNPAP
|
||||
, CompBareCN
|
||||
, CompIQuant
|
||||
, ComplSlashPartLast
|
||||
, ComplDirectVQ
|
||||
, ComplDirectVS
|
||||
, DetNPFem, DetNPMasc
|
||||
, ExistCN, ExistMassCN, ExistPluralCN, ExistsNP
|
||||
, ExistIPQS, ExistNPQS, ExistS
|
||||
, PredIAdvVP
|
||||
, PrepCN
|
||||
, ReflPossPron
|
||||
, UttVP, UttVPShort, UttAccNP, UttDatNP, UttAccIP, UttDatIP
|
||||
, EmptyRelSlash, StrandQuestSlash, StrandRelSlash
|
||||
, SubjRelNP
|
||||
, UseComp_ser, UseComp_estar
|
||||
, iFem_Pron, weFem_Pron, youFem_Pron, youPlFem_Pron, youPolFem_Pron, youPolPlFem_Pron, youPolPl_Pron, theyFem_Pron, theyNeutr_Pron
|
||||
, GenModNP
|
||||
|
||||
] with (Grammar=GrammarTok) ;
|
||||
17
src/toki-pona/GrammarTok.gf
Normal file
17
src/toki-pona/GrammarTok.gf
Normal file
@@ -0,0 +1,17 @@
|
||||
concrete GrammarTok of Grammar =
|
||||
NounTok
|
||||
, VerbTok
|
||||
, AdjectiveTok
|
||||
, AdverbTok
|
||||
, NumeralTok
|
||||
, SentenceTok
|
||||
, QuestionTok
|
||||
, RelativeTok
|
||||
, ConjunctionTok
|
||||
, PhraseTok
|
||||
, TextX
|
||||
, StructuralTok
|
||||
, IdiomTok
|
||||
, TenseX
|
||||
, NamesTok -- Not part of original Grammar, here to trigger compilation
|
||||
;
|
||||
56
src/toki-pona/IdiomTok.gf
Normal file
56
src/toki-pona/IdiomTok.gf
Normal file
@@ -0,0 +1,56 @@
|
||||
|
||||
--1 Idiom: Idiomatic Expressions
|
||||
|
||||
concrete IdiomTok of Idiom = CatTok ** open Prelude, ResTok, VerbTok, QuestionTok, NounTok, StructuralTok in {
|
||||
|
||||
-- This module defines constructions that are formed in fixed ways,
|
||||
-- often different even in closely related languages.
|
||||
|
||||
{-
|
||||
lin
|
||||
|
||||
|
||||
-- ImpersCl : VP -> Cl ; -- it is hot
|
||||
ImpersCl vp = {
|
||||
} ;
|
||||
|
||||
-- : NP -> Cl ; -- there is a house
|
||||
ExistNP np =
|
||||
|
||||
-- ExistIP : IP -> QCl ; -- which houses are there
|
||||
ExistIP ip =
|
||||
|
||||
-- GenericCl : VP -> Cl ; -- one sleeps
|
||||
GenericCl vp =
|
||||
|
||||
CleftNP : NP -> RS -> Cl ; -- it is I who did it
|
||||
CleftAdv : Adv -> S -> Cl ; -- it is here she slept
|
||||
|
||||
-- : NP -> Cl ; -- there is a house
|
||||
ExistNP np =
|
||||
|
||||
ExistIP : IP -> QCl ; -- which houses are there
|
||||
|
||||
-- 7/12/2012 generalizations of these
|
||||
|
||||
ExistNPAdv : NP -> Adv -> Cl ; -- there is a house in Paris
|
||||
ExistIPAdv : IP -> Adv -> QCl ; -- which houses are there in Paris
|
||||
|
||||
-- : VP -> VP ;
|
||||
ProgrVP vp = vp ** {
|
||||
} ;
|
||||
|
||||
|
||||
-- : VP -> Utt ; -- let's go
|
||||
ImpPl1 vp = { } ;
|
||||
|
||||
ImpP3 : NP -> VP -> Utt ; -- let John walk
|
||||
|
||||
-- 3/12/2013 non-reflexive uses of "self"
|
||||
|
||||
SelfAdvVP : VP -> VP ; -- is at home himself
|
||||
SelfAdVVP : VP -> VP ; -- is himself at home
|
||||
SelfNP : NP -> NP ; -- the president himself (is at home)
|
||||
-}
|
||||
|
||||
}
|
||||
5
src/toki-pona/LangTok.gf
Normal file
5
src/toki-pona/LangTok.gf
Normal file
@@ -0,0 +1,5 @@
|
||||
--# -path=.:../abstract:../common:../prelude:../api
|
||||
concrete LangTok of Lang =
|
||||
GrammarTok,
|
||||
LexiconTok,
|
||||
ConstructionTok ;
|
||||
420
src/toki-pona/LexiconTok.gf
Normal file
420
src/toki-pona/LexiconTok.gf
Normal file
@@ -0,0 +1,420 @@
|
||||
concrete LexiconTok of Lexicon = CatTok **
|
||||
open ParadigmsTok, ResTok in {
|
||||
|
||||
----
|
||||
-- A
|
||||
|
||||
-- lin add_V3 = mkV3 (mkV "") ;
|
||||
-- lin airplane_N = mkN "" ;
|
||||
-- lin alas_Interj = mkInterj "" ;
|
||||
-- lin already_Adv = mkA "" ;
|
||||
lin animal_N = mkN "soweli" ;
|
||||
-- lin answer_V2S = mkV2S (mkV "") ;
|
||||
lin apartment_N = mkN "tomo" ;
|
||||
lin apple_N = mkN "kili" ;
|
||||
-- lin art_N = mkN "" ;
|
||||
-- lin ashes_N = mkN "" ;
|
||||
-- lin ask_V2Q = mkV2Q (mkV "") ;
|
||||
|
||||
----
|
||||
-- B
|
||||
|
||||
-- lin baby_N = mkN "" ;
|
||||
-- lin back_N = mkN "" ;
|
||||
-- lin bad_A = mkA "" ;
|
||||
lin bank_N = mkN "tomo mani" ;
|
||||
-- lin bark_N = mkN "" ;
|
||||
-- lin beautiful_A = mkA "" ;
|
||||
-- lin become_VA = mkVA (mkV "") ;
|
||||
lin beer_N = mkN "telo nasa" ;
|
||||
-- lin beg_V2V = mkV2V (mkV "") ;
|
||||
-- lin belly_N = mkN "" ;
|
||||
lin big_A = mkA "suli" ;
|
||||
-- lin bike_N = mkN "" ;
|
||||
|
||||
lin bird_N = mkN "waso" ;
|
||||
-- lin bite_V2 = mkV2 "" ;
|
||||
-- lin black_A = mkA "" ;
|
||||
-- lin blood_N = mkN "blood" ;
|
||||
-- lin blow_V = mkV "" ;
|
||||
-- lin blue_A = mkA "" ;
|
||||
-- lin boat_N = mkN "" ;
|
||||
-- lin bone_N = mkN "" ;
|
||||
-- lin boot_N = mkN "" ;
|
||||
-- lin boss_N = mkN "" ;
|
||||
lin book_N = mkN "lipu" ;
|
||||
lin boy_N = mkN "mije" ;
|
||||
-- lin bread_N = mkN "" ;
|
||||
lin break_V2 = mkV2 "pakala" ;
|
||||
-- lin breast_N = mkN "" ;
|
||||
-- lin breathe_V = mkV "" ;
|
||||
-- lin broad_A = mkA "" ;
|
||||
-- lin brother_N2 = mkN "" ;
|
||||
-- lin brown_A = mkA "" ;
|
||||
lin burn_V = mkV "seli" ;
|
||||
-- lin butter_N = mkN "" ;
|
||||
lin buy_V2 = mkV2 "esun" ;
|
||||
|
||||
----
|
||||
-- C
|
||||
|
||||
-- lin camera_N = mkN "" ;
|
||||
-- lin cap_N = mkN "" ;
|
||||
-- lin car_N = mkN "" ;
|
||||
-- lin carpet_N = mkN "" ;
|
||||
-- lin cat_N = mkN "" ;
|
||||
-- lin ceiling_N = mkN "" ;
|
||||
-- lin chair_N = mkN "" ;
|
||||
-- lin cheese_N = mkN "" ;
|
||||
-- lin child_N = mkN "" ;
|
||||
-- lin church_N = mkN "" ;
|
||||
-- lin city_N = mkN "" ;
|
||||
-- lin clean_A = mkA "" ;
|
||||
-- lin clever_A = mkA "" ;
|
||||
-- lin close_V2 = mkV2 "" ;
|
||||
-- lin cloud_N = mkN "" ;
|
||||
-- lin coat_N = mkN "" ;
|
||||
-- lin cold_A = mkA "" ;
|
||||
lin come_V = mkV "kama" ;
|
||||
-- lin computer_N = mkN "" ;
|
||||
-- lin correct_A = mkA "" ;
|
||||
-- lin count_V2 = mkV2 "" ;
|
||||
-- lin country_N = mkN "" ;
|
||||
-- lin cousin_N = mkN "" ;
|
||||
-- lin cow_N = mkN "" ;
|
||||
-- lin cut_V2 = mkV2 "" ;
|
||||
|
||||
----
|
||||
-- D
|
||||
|
||||
-- lin day_N = mkN "" ;
|
||||
lin die_V = mkV "moli" ;
|
||||
-- lin dig_V = mkV "" ;
|
||||
-- lin dirty_A = mkA "" ;
|
||||
-- lin distance_N3 = mkN3 (mkN "") ;
|
||||
-- lin do_V2 = mkV2 "" ;
|
||||
-- lin doctor_N = mkN "" ;
|
||||
lin dog_N = mkN "soweli" ;
|
||||
-- lin door_N = mkN "" ;
|
||||
-- lin drink_V2 = mkV2 "" ;
|
||||
-- lin dry_A = mkA "" ;
|
||||
-- lin dull_A = mkA "" ;
|
||||
-- lin dust_N = mkN "" ;
|
||||
|
||||
----
|
||||
-- E
|
||||
|
||||
lin ear_N = mkN "kute" ;
|
||||
lin earth_N = mkN "ma" ;
|
||||
lin eat_V2 = mkV "moku" ;
|
||||
-- lin egg_N = mkN "" ;
|
||||
-- lin empty_A = mkA "" ;
|
||||
-- lin enemy_N = mkN "" ;
|
||||
lin eye_N = mkN "lukin" ;
|
||||
|
||||
----
|
||||
-- F
|
||||
|
||||
-- lin factory_N = mkN "" ;
|
||||
-- lin fall_V = mkV "" ;
|
||||
-- lin far_Adv = mkA "" ;
|
||||
-- lin fat_N = mkN "" ;
|
||||
-- lin father_N2 = mkN2 (mkN "") ;
|
||||
-- lin fear_V2 = mkV2 "" ;
|
||||
-- lin fear_VS = mkVS (mkV "") ;
|
||||
-- lin feather_N = mkN "" ;
|
||||
-- lin fight_V2 = mkV2 "" ;
|
||||
-- lin find_V2 = mkV2 "" ;
|
||||
-- lin fingernail_N = mkN "" ;
|
||||
-- lin fire_N = mkN "" ;
|
||||
lin fish_N = mkN "kala" ;
|
||||
-- lin float_V = mkV "" ;
|
||||
-- lin floor_N = mkN "" ;
|
||||
-- lin flow_V = mkV "" ;
|
||||
-- lin flower_N = mkN "" ;
|
||||
-- lin fly_V = mkV "" ;
|
||||
-- lin fog_N = mkN "" ;
|
||||
-- lin foot_N = mkN "" ;
|
||||
-- lin forest_N = mkN "" ;
|
||||
-- lin forget_V2 = mkV2 "" ;
|
||||
-- lin freeze_V = mkV "" ;
|
||||
-- lin fridge_N = mkN "" ;
|
||||
lin friend_N = mkN "jan pona" ;
|
||||
lin fruit_N = mkN "kili" ;
|
||||
-- lin full_A = mkA "" ;
|
||||
-- --lin fun_AV
|
||||
|
||||
----
|
||||
-- G
|
||||
|
||||
-- lin garden_N = mkN "" ;
|
||||
-- lin girl_N = mkN "" ;
|
||||
-- lin give_V3 = mkV3 (mkV "") ;
|
||||
-- lin glove_N = mkN "" ;
|
||||
lin go_V = mkV "tawa" ;
|
||||
-- lin gold_N = mkN "" ;
|
||||
lin good_A = mkA "pona" ;
|
||||
-- lin grammar_N = mkN "" ;
|
||||
-- lin grass_N = mkN "" ;
|
||||
-- lin green_A = mkA "" ;
|
||||
|
||||
----
|
||||
-- H
|
||||
|
||||
-- lin hair_N = mkN "" ;
|
||||
lin hand_N = mkN "luka" ;
|
||||
-- lin harbour_N = mkN "" ;
|
||||
lin hat_N = mkN "len lawa" ;
|
||||
-- lin hate_V2 = mkV2 "" ;
|
||||
lin head_N = mkN "lawa" ;
|
||||
-- lin hear_V2 = mkV2 "" ;
|
||||
-- lin heart_N = mkN "" ;
|
||||
-- lin heavy_A = mkA "" ;
|
||||
-- lin hill_N = mkN "" ;
|
||||
-- lin hit_V2 = mkV2 "" ;
|
||||
-- lin hold_V2 = mkV2 "" ;
|
||||
-- lin hope_VS = mkV "" ;
|
||||
-- lin horn_N = mkN "" ;
|
||||
-- lin horse_N = mkN "" ;
|
||||
-- lin hot_A = mkA "" ;
|
||||
lin house_N = mkN "tomo" ;
|
||||
-- lin hunt_V2 = mkV2 "" ;
|
||||
-- lin husband_N = mkN "" ;
|
||||
|
||||
--------
|
||||
-- I - K
|
||||
|
||||
-- lin ice_N = mkN "" ;
|
||||
-- lin industry_N = mkN "" ;
|
||||
-- lin iron_N = mkN "" ;
|
||||
lin john_PN = mkPN "jan" "Jon" ;
|
||||
-- lin jump_V = mkV "" ;
|
||||
-- lin kill_V2 = mkV2 "" ;
|
||||
-- lin king_N = mkN "" ;
|
||||
-- lin knee_N = mkN "" ;
|
||||
lin know_V2 = mkV2 "sona" ;
|
||||
-- lin know_VQ = mkVQ (mkV "") ;
|
||||
-- lin know_VS = mkV "" ;
|
||||
|
||||
|
||||
----
|
||||
-- L
|
||||
|
||||
-- lin lake_N = mkN "" ;
|
||||
-- lin lamp_N = mkN "" ;
|
||||
lin language_N = mkN "toki" ;
|
||||
-- lin laugh_V = mkV "" ;
|
||||
-- lin leaf_N = mkN "" ;
|
||||
-- lin learn_V2 = mkV2 "" ;
|
||||
-- lin leather_N = mkN "" ;
|
||||
-- lin leave_V2 = mkV2 "" ;
|
||||
-- lin leg_N = mkN "" ;
|
||||
-- lin lie_V = mkV "" ;
|
||||
-- lin like_V2 = mkV2 "" ;
|
||||
-- lin listen_V2 = mkV2 "" ;
|
||||
-- lin live_V = mkV "";
|
||||
-- lin liver_N = mkN "" ;
|
||||
-- lin long_A = mkA "" ;
|
||||
-- lin lose_V2 = mkV2 "" ;
|
||||
-- lin louse_N = mkN "" ;
|
||||
lin love_N = mkN "olin" ;
|
||||
lin love_V2 = mkV2 "olin" ;
|
||||
|
||||
----
|
||||
-- M
|
||||
|
||||
-- lin man_N = mkN "" ;
|
||||
-- lin married_A2 = mkA2 (mkA "") ;
|
||||
-- lin meat_N = mkN "" ;
|
||||
-- lin milk_N = mkN "" ;
|
||||
lin moon_N = mkN "mun" ;
|
||||
-- lin mother_N2 = mkN2 (mkN "") ;
|
||||
-- lin mountain_N = mkN "" ;
|
||||
-- lin mouth_N = mkN "" ;
|
||||
-- lin music_N = mkN "" ;
|
||||
|
||||
----
|
||||
-- N
|
||||
|
||||
lin name_N = mkN "nimi" ;
|
||||
-- lin narrow_A = mkA "" ;
|
||||
-- lin near_A = mkA "" ;
|
||||
-- lin neck_N = mkN "" ;
|
||||
-- lin new_A = mkA "" ;
|
||||
-- lin newspaper_N = mkN "" ;
|
||||
-- lin night_N = mkN "" ;
|
||||
-- lin nose_N = mkN "" ;
|
||||
-- lin now_Adv = mkAdv "" ;
|
||||
-- lin number_N = mkN "" ;
|
||||
|
||||
--------
|
||||
-- O - P
|
||||
|
||||
|
||||
-- lin oil_N = mkN "" ;
|
||||
-- lin old_A = mkA "" ;
|
||||
-- lin open_V2 = mkV2 "" ;
|
||||
-- lin paint_V2A = mkV2A (mkV "") ;
|
||||
-- lin paper_N = mkN "" ;
|
||||
lin paris_PN = mkPN "ma tomo" "Paki" ;
|
||||
-- lin peace_N = mkN "" ;
|
||||
-- lin pen_N = mkN "" ;
|
||||
lin person_N = mkN "jan" ;
|
||||
-- lin planet_N = mkN "" ;
|
||||
-- lin plastic_N = mkN "" ;
|
||||
lin play_V = mkV "musi" ;
|
||||
-- lin policeman_N = mkN "" ;
|
||||
-- lin priest_N = mkN "" ;
|
||||
-- lin pull_V2 = mkV2 "" ;
|
||||
-- lin push_V2 = mkV2 "" ;
|
||||
-- lin put_V2 = mkV2 "" ;
|
||||
|
||||
--------
|
||||
-- Q - R
|
||||
|
||||
|
||||
-- lin queen_N = mkN "" ;
|
||||
-- lin question_N = mkN "" ;
|
||||
-- lin radio_N = mkN "" ;
|
||||
-- lin rain_N = mkN "" ;
|
||||
-- lin rain_V0 = mkV "" ;
|
||||
-- lin read_V2 = mkV2 "" ;
|
||||
-- lin ready_A = mkA "" ;
|
||||
-- lin reason_N = mkN "" ;
|
||||
lin red_A = mkA "loje" ;
|
||||
-- lin religion_N = mkN "" ;
|
||||
-- lin restaurant_N = mkN "" ;
|
||||
-- lin river_N = mkN "" ;
|
||||
-- lin road_N = mkN "" ;
|
||||
-- lin rock_N = mkN "" ;
|
||||
-- lin roof_N = mkN "" ;
|
||||
-- lin root_N = mkN "" ;
|
||||
-- lin rope_N = mkN "" ;
|
||||
-- lin rotten_A = mkA "" ;
|
||||
-- lin round_A = mkA "" ;
|
||||
-- lin rub_V2 = mkV2 "" ;
|
||||
-- lin rubber_N = mkN "" ;
|
||||
-- lin rule_N = mkN "" ;
|
||||
-- lin run_V = mkV "" ;
|
||||
|
||||
----
|
||||
-- S
|
||||
|
||||
-- lin salt_N = mkN "" ;
|
||||
-- lin sand_N = mkN "" ;
|
||||
-- lin say_VS = mkVS (mkV "") ;
|
||||
-- lin school_N = mkN "" ;
|
||||
-- lin science_N = mkN "" ;
|
||||
-- lin scratch_V2 = mkV2 "" ;
|
||||
-- lin sea_N = mkN "" ;
|
||||
-- lin see_V2 = mkV2 "" ;
|
||||
-- lin seed_N = mkN "" ;
|
||||
-- lin seek_V2 = mkV2 "" ;
|
||||
-- lin sell_V3 = mkV3 (mkV "" Meng) emptyPrep emptyPrep ; -- TODO
|
||||
-- lin send_V3 = mkV3 (mkV "") ;
|
||||
-- lin sew_V = mkV "" ;
|
||||
-- lin sharp_A = mkA "" ;
|
||||
-- lin sheep_N = mkN "" fem ;
|
||||
-- lin ship_N = mkN "" ;
|
||||
-- lin shirt_N = mkN "" ;
|
||||
-- lin shoe_N = mkN "" ;
|
||||
-- lin shop_N = mkN "" ;
|
||||
-- lin short_A = mkA "" ;
|
||||
-- lin silver_N = mkN "" ;
|
||||
-- lin sing_V = mkV "" ;
|
||||
-- lin sister_N = mkN "" ;
|
||||
-- lin sit_V = mkV "" ;
|
||||
-- lin skin_N = mkN "" ;
|
||||
-- lin sky_N = mkN "" ;
|
||||
lin sleep_V = mkV "lape" ;
|
||||
lin small_A = mkA "lili" ;
|
||||
-- lin smell_V = mkV "" ;
|
||||
-- lin smoke_N = mkN "" ;
|
||||
-- lin smooth_A = mkA "" ;
|
||||
-- lin snake_N = mkN "" ;
|
||||
-- lin snow_N = mkN "" ;
|
||||
-- lin sock_N = mkN "" ;
|
||||
-- lin song_N = mkN "" ;
|
||||
-- lin speak_V2 = mkV2 "toki" ;
|
||||
-- lin spit_V = mkV "" ;
|
||||
-- lin split_V2 = mkV2 "" ;
|
||||
-- lin squeeze_V2 = mkV2 "" ;
|
||||
-- lin stab_V2 = mkV2 "" ;
|
||||
-- lin stand_V = mkV "" ;
|
||||
-- lin star_N = mkN "" ;
|
||||
-- lin steel_N = mkN "" ;
|
||||
-- lin stick_N = mkN "" ;
|
||||
-- lin stone_N = mkN "" ;
|
||||
lin stop_V = mkV "pini" ;
|
||||
-- lin stove_N = mkN "" ;
|
||||
-- lin straight_A = mkA "" ;
|
||||
-- lin student_N = mkN "" ;
|
||||
-- lin stupid_A = mkA "" ;
|
||||
-- lin suck_V2 = mkV2 "" ;
|
||||
-- lin sun_N = mkN "" ;
|
||||
-- lin swell_V = mkV "" ;
|
||||
-- lin swim_V = mkV "" ;
|
||||
|
||||
----
|
||||
-- T
|
||||
|
||||
|
||||
-- lin table_N = mkN "" ;
|
||||
-- lin tail_N = mkN "" ;
|
||||
-- lin talk_V3 = mkV3 (mkV "" Ber) (mkPrep "") (mkPrep "") ;
|
||||
-- lin teach_V2 = mkV2 "" ;
|
||||
-- lin teacher_N = mkN "" ;
|
||||
-- lin television_N = mkN "" ;
|
||||
-- lin thick_A = mkA "" ;
|
||||
-- lin thin_A = mkA "" ;
|
||||
-- lin think_V = mkV "" ;
|
||||
-- lin throw_V2 = mkV2 "" ;
|
||||
-- lin tie_V2 = mkV2 "" ;
|
||||
-- lin today_Adv = mkA "" ;
|
||||
-- lin tongue_N = mkN "" ;
|
||||
-- lin tooth_N = mkN "" ;
|
||||
-- lin train_N = mkN "" ;
|
||||
-- lin travel_V = mkV "" ;
|
||||
-- lin tree_N = mkN "" ;
|
||||
-- lin turn_V = mkV "" ;
|
||||
|
||||
--------
|
||||
-- U - V
|
||||
|
||||
-- lin ugly_A = mkA "" ;
|
||||
-- lin uncertain_A = mkA "" ;
|
||||
-- lin understand_V2 = mkV2 "" ;
|
||||
-- lin university_N = mkN "" ;
|
||||
-- lin village_N = mkN "" ;
|
||||
-- lin vomit_V = mkV2 "" ;
|
||||
|
||||
--------
|
||||
-- W - Y
|
||||
|
||||
-- lin wait_V2 = mkV2 "" ;
|
||||
-- lin walk_V = mkV "" ;
|
||||
-- lin war_N = mkN "" ;
|
||||
-- lin warm_A = mkA "" ;
|
||||
-- lin wash_V2 = mkV2 "" ;
|
||||
-- lin watch_V2 = mkV2 "" ;
|
||||
lin water_N = mkN "telo" ;
|
||||
-- lin wet_A = mkA "" ;
|
||||
-- lin white_A = mkA "" ;
|
||||
-- lin wide_A = mkA "" ;
|
||||
-- lin wife_N = mkN "" ;
|
||||
-- lin win_V2 = mkV2 "" ;
|
||||
-- lin wind_N = mkN "" ;
|
||||
-- lin window_N = mkN "" ;
|
||||
-- lin wine_N = mkN "" ;
|
||||
-- lin wing_N = mkN "" ;
|
||||
-- lin wipe_V2 = mkV2 "" ;
|
||||
-- lin woman_N = mkN "" ;
|
||||
-- lin wonder_VQ = mkVQ (mkV "") ;
|
||||
-- lin wood_N = mkN "" ;
|
||||
-- lin worm_N = mkN "" ;
|
||||
-- lin write_V2 = mkV2 "" ;
|
||||
-- lin year_N = mkN "" ;
|
||||
-- lin yellow_A = mkA "" ;
|
||||
-- lin young_A = mkA "" ;
|
||||
|
||||
}
|
||||
313
src/toki-pona/MissingTok.gf
Normal file
313
src/toki-pona/MissingTok.gf
Normal file
@@ -0,0 +1,313 @@
|
||||
resource MissingTok = open GrammarTok, Prelude in {
|
||||
-- temporary definitions to enable the compilation of RGL API
|
||||
oper AdAP : AdA -> AP -> AP = notYet "AdAP" ;
|
||||
oper AdAdv : AdA -> Adv -> Adv = notYet "AdAdv" ;
|
||||
oper AdNum : AdN -> Card -> Card = notYet "AdNum" ;
|
||||
oper AdVVP : AdV -> VP -> VP = notYet "AdVVP" ;
|
||||
oper AdVVPSlash : AdV -> VPSlash -> VPSlash = notYet "AdVVPSlash" ;
|
||||
oper AddAdvQVP : QVP -> IAdv -> QVP = notYet "AddAdvQVP" ;
|
||||
oper AdjCN : AP -> CN -> CN = notYet "AdjCN" ;
|
||||
oper AdjDAP : DAP -> AP -> DAP = notYet "AdjDAP" ;
|
||||
oper AdjOrd : Ord -> AP = notYet "AdjOrd" ;
|
||||
oper AdnCAdv : CAdv -> AdN = notYet "AdnCAdv" ;
|
||||
oper AdvAP : AP -> Adv -> AP = notYet "AdvAP" ;
|
||||
oper AdvCN : CN -> Adv -> CN = notYet "AdvCN" ;
|
||||
oper AdvIAdv : IAdv -> Adv -> IAdv = notYet "AdvIAdv" ;
|
||||
oper AdvIP : IP -> Adv -> IP = notYet "AdvIP" ;
|
||||
oper AdvImp : Adv -> Imp -> Imp = notYet "AdvImp" ;
|
||||
oper AdvNP : NP -> Adv -> NP = notYet "AdvNP" ;
|
||||
oper AdvQVP : VP -> IAdv -> QVP = notYet "AdvQVP" ;
|
||||
oper AdvS : Adv -> S -> S = notYet "AdvS" ;
|
||||
oper AdvSlash : ClSlash -> Adv -> ClSlash = notYet "AdvSlash" ;
|
||||
oper AdvVP : VP -> Adv -> VP = notYet "AdvVP" ;
|
||||
oper AdvVPSlash : VPSlash -> Adv -> VPSlash = notYet "AdvVPSlash" ;
|
||||
oper ApposCN : CN -> NP -> CN = notYet "ApposCN" ;
|
||||
oper BaseAP : AP -> AP -> ListAP = notYet "BaseAP" ;
|
||||
oper BaseAdV : AdV -> AdV -> ListAdV = notYet "BaseAdV" ;
|
||||
oper BaseAdv : Adv -> Adv -> ListAdv = notYet "BaseAdv" ;
|
||||
oper BaseCN : CN -> CN -> ListCN = notYet "BaseCN" ;
|
||||
oper BaseIAdv : IAdv -> IAdv -> ListIAdv = notYet "BaseIAdv" ;
|
||||
oper BaseNP : NP -> NP -> ListNP = notYet "BaseNP" ;
|
||||
oper BaseRS : RS -> RS -> ListRS = notYet "BaseRS" ;
|
||||
oper BaseS : S -> S -> ListS = notYet "BaseS" ;
|
||||
oper CAdvAP : CAdv -> AP -> NP -> AP = notYet "CAdvAP" ;
|
||||
oper CleftAdv : Adv -> S -> Cl = notYet "CleftAdv" ;
|
||||
oper CleftNP : NP -> RS -> Cl = notYet "CleftNP" ;
|
||||
oper CompAP : AP -> Comp = notYet "CompAP" ;
|
||||
oper CompAdv : Adv -> Comp = notYet "CompAdv" ;
|
||||
oper CompCN : CN -> Comp = notYet "CompCN" ;
|
||||
oper CompIAdv : IAdv -> IComp = notYet "CompIAdv" ;
|
||||
oper CompIP : IP -> IComp = notYet "CompIP" ;
|
||||
oper CompNP : NP -> Comp = notYet "CompNP" ;
|
||||
oper ComparA : A -> NP -> AP = notYet "ComparA" ;
|
||||
oper ComparAdvAdj : CAdv -> A -> NP -> Adv = notYet "ComparAdvAdj" ;
|
||||
oper ComparAdvAdjS : CAdv -> A -> S -> Adv = notYet "ComparAdvAdjS" ;
|
||||
oper ComplA2 : A2 -> NP -> AP = notYet "ComplA2" ;
|
||||
oper ComplN2 : N2 -> NP -> CN = notYet "ComplN2" ;
|
||||
oper ComplN3 : N3 -> NP -> N2 = notYet "ComplN3" ;
|
||||
oper ComplSlash : VPSlash -> NP -> VP = notYet "ComplSlash" ;
|
||||
oper ComplSlashIP : VPSlash -> IP -> QVP = notYet "ComplSlashIP" ;
|
||||
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 ConjAP : Conj -> ListAP -> AP = notYet "ConjAP" ;
|
||||
oper ConjAdV : Conj -> ListAdV -> AdV = notYet "ConjAdV" ;
|
||||
oper ConjAdv : Conj -> ListAdv -> Adv = notYet "ConjAdv" ;
|
||||
oper ConjCN : Conj -> ListCN -> CN = notYet "ConjCN" ;
|
||||
oper ConjDet : Conj -> ListDAP -> Det = notYet "ConjDet" ;
|
||||
oper ConjIAdv : Conj -> ListIAdv -> IAdv = notYet "ConjIAdv" ;
|
||||
oper ConjNP : Conj -> ListNP -> NP = notYet "ConjNP" ;
|
||||
oper ConjRS : Conj -> ListRS -> RS = notYet "ConjRS" ;
|
||||
oper ConjS : Conj -> ListS -> S = notYet "ConjS" ;
|
||||
oper ConsAP : AP -> ListAP -> ListAP = notYet "ConsAP" ;
|
||||
oper ConsAdV : AdV -> ListAdV -> ListAdV = notYet "ConsAdV" ;
|
||||
oper ConsAdv : Adv -> ListAdv -> ListAdv = notYet "ConsAdv" ;
|
||||
oper ConsCN : CN -> ListCN -> ListCN = notYet "ConsCN" ;
|
||||
oper ConsIAdv : IAdv -> ListIAdv -> ListIAdv = notYet "ConsIAdv" ;
|
||||
oper ConsNP : NP -> ListNP -> ListNP = notYet "ConsNP" ;
|
||||
oper ConsRS : RS -> ListRS -> ListRS = notYet "ConsRS" ;
|
||||
oper ConsS : S -> ListS -> ListS = notYet "ConsS" ;
|
||||
oper CountNP : Det -> NP -> NP = notYet "CountNP" ;
|
||||
oper DetCN : Det -> CN -> NP = notYet "DetCN" ;
|
||||
oper DetDAP : Det -> DAP = notYet "DetDAP" ;
|
||||
oper DetNP : Det -> NP = notYet "DetNP" ;
|
||||
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 ExistIPAdv : IP -> Adv -> QCl = notYet "ExistIPAdv" ;
|
||||
oper ExistNP : NP -> Cl = notYet "ExistNP" ;
|
||||
oper ExistNPAdv : NP -> Adv -> Cl = notYet "ExistNPAdv" ;
|
||||
oper ExtAdvS : Adv -> S -> S = notYet "ExtAdvS" ;
|
||||
oper ExtAdvVP : VP -> Adv -> VP = notYet "ExtAdvVP" ;
|
||||
oper FunRP : Prep -> NP -> RP -> RP = notYet "FunRP" ;
|
||||
oper GenericCl : VP -> Cl = notYet "GenericCl" ;
|
||||
oper IdRP : RP = notYet "IdRP" ;
|
||||
oper IdetCN : IDet -> CN -> IP = notYet "IdetCN" ;
|
||||
oper IdetIP : IDet -> IP = notYet "IdetIP" ;
|
||||
oper IdetQuant : IQuant -> Num -> IDet = notYet "IdetQuant" ;
|
||||
oper ImpP3 : NP -> VP -> Utt = notYet "ImpP3" ;
|
||||
oper ImpPl1 : VP -> Utt = notYet "ImpPl1" ;
|
||||
oper ImpVP : VP -> Imp = notYet "ImpVP" ;
|
||||
oper ImpersCl : VP -> Cl = notYet "ImpersCl" ;
|
||||
oper MassNP : CN -> NP = notYet "MassNP" ;
|
||||
oper NumCard : Card -> Num = notYet "NumCard" ;
|
||||
oper NumDigits : Digits -> Card = notYet "NumDigits" ;
|
||||
oper NumNumeral : Numeral -> Card = notYet "NumNumeral" ;
|
||||
oper OrdDigits : Digits -> Ord = notYet "OrdDigits" ;
|
||||
oper OrdNumeral : Numeral -> Ord = notYet "OrdNumeral" ;
|
||||
oper OrdNumeralSuperl : Numeral -> A -> Ord = notYet "OrdNumeralSuperl" ;
|
||||
oper OrdSuperl : A -> Ord = notYet "OrdSuperl" ;
|
||||
oper PConjConj : Conj -> PConj = notYet "PConjConj" ;
|
||||
oper PPartNP : NP -> V2 -> NP = notYet "PPartNP" ;
|
||||
oper PartNP : CN -> NP -> CN = notYet "PartNP" ;
|
||||
oper PassV2 : V2 -> VP = notYet "PassV2" ;
|
||||
oper PhrUtt : PConj -> Utt -> Voc -> Phr = notYet "PhrUtt" ;
|
||||
oper PositA : A -> AP = notYet "PositA" ;
|
||||
oper PositAdAAdj : A -> AdA = notYet "PositAdAAdj" ;
|
||||
oper PositAdvAdj : A -> Adv = notYet "PositAdvAdj" ;
|
||||
oper PossNP : CN -> NP -> CN = notYet "PossNP" ;
|
||||
oper PossPron : Pron -> Quant = notYet "PossPron" ;
|
||||
oper PredSCVP : SC -> VP -> Cl = notYet "PredSCVP" ;
|
||||
oper PredVP : NP -> VP -> Cl = notYet "PredVP" ;
|
||||
oper PredetNP : Predet -> NP -> NP = notYet "PredetNP" ;
|
||||
oper PrepIP : Prep -> IP -> IAdv = notYet "PrepIP" ;
|
||||
oper PrepNP : Prep -> NP -> Adv = notYet "PrepNP" ;
|
||||
oper ProgrVP : VP -> VP = notYet "ProgrVP" ;
|
||||
oper QuestCl : Cl -> QCl = notYet "QuestCl" ;
|
||||
oper QuestIAdv : IAdv -> Cl -> QCl = notYet "QuestIAdv" ;
|
||||
oper QuestIComp : IComp -> NP -> QCl = notYet "QuestIComp" ;
|
||||
oper QuestQVP : IP -> QVP -> QCl = notYet "QuestQVP" ;
|
||||
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 RelCN : CN -> RS -> CN = notYet "RelCN" ;
|
||||
oper RelCl : Cl -> RCl = notYet "RelCl" ;
|
||||
oper RelNP : NP -> RS -> NP = notYet "RelNP" ;
|
||||
oper RelS : S -> RS -> S = notYet "RelS" ;
|
||||
oper RelSlash : RP -> ClSlash -> RCl = notYet "RelSlash" ;
|
||||
oper RelVP : RP -> VP -> RCl = notYet "RelVP" ;
|
||||
oper SSubjS : S -> Subj -> S -> S = notYet "SSubjS" ;
|
||||
oper SelfAdVVP : VP -> VP = notYet "SelfAdVVP" ;
|
||||
oper SelfAdvVP : VP -> VP = notYet "SelfAdvVP" ;
|
||||
oper SelfNP : NP -> NP = notYet "SelfNP" ;
|
||||
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 SlashV2a : V2 -> VPSlash = notYet "SlashV2a" ;
|
||||
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 TFullStop : Phr -> Text -> Text = notYet "TFullStop" ;
|
||||
oper Use2N3 : N3 -> N2 = notYet "Use2N3" ;
|
||||
oper Use3N3 : N3 -> N2 = notYet "Use3N3" ;
|
||||
oper UseA2 : A2 -> AP = notYet "UseA2" ;
|
||||
oper UseCl : Temp -> Pol -> Cl -> S = notYet "UseCl" ;
|
||||
oper UseComp : Comp -> VP = notYet "UseComp" ;
|
||||
oper UseComparA : A -> AP = notYet "UseComparA" ;
|
||||
oper UseCopula : VP = notYet "UseCopula" ;
|
||||
oper UseN : N -> CN = notYet "UseN" ;
|
||||
oper UseN2 : N2 -> CN = notYet "UseN2" ;
|
||||
oper UsePN : PN -> NP = notYet "UsePN" ;
|
||||
oper UsePron : Pron -> NP = notYet "UsePron" ;
|
||||
oper UseQCl : Temp -> Pol -> QCl -> QS = notYet "UseQCl" ;
|
||||
oper UseRCl : Temp -> Pol -> RCl -> RS = notYet "UseRCl" ;
|
||||
oper UseSlash : Temp -> Pol -> ClSlash -> SSlash = notYet "UseSlash" ;
|
||||
oper UseV : V -> VP = notYet "UseV" ;
|
||||
oper UttAP : AP -> Utt = notYet "UttAP" ;
|
||||
oper UttAdv : Adv -> Utt = notYet "UttAdv" ;
|
||||
oper UttCN : CN -> Utt = notYet "UttCN" ;
|
||||
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 UttInterj : Interj -> Utt = notYet "UttInterj" ;
|
||||
oper UttNP : NP -> Utt = notYet "UttNP" ;
|
||||
oper UttQS : QS -> Utt = notYet "UttQS" ;
|
||||
oper UttS : S -> Utt = notYet "UttS" ;
|
||||
oper UttVP : VP -> Utt = notYet "UttVP" ;
|
||||
oper VPSlashPrep : VP -> Prep -> VPSlash = notYet "VPSlashPrep" ;
|
||||
oper VocNP : NP -> Voc = notYet "VocNP" ;
|
||||
oper above_Prep : Prep = notYet "above_Prep" ;
|
||||
oper active2passive : Cl -> Cl = notYet "active2passive" ;
|
||||
oper after_Prep : Prep = notYet "after_Prep" ;
|
||||
oper alas_Interj : Interj = notYet "alas_Interj" ;
|
||||
oper all_Predet : Predet = notYet "all_Predet" ;
|
||||
oper almost_AdA : AdA = notYet "almost_AdA" ;
|
||||
oper almost_AdN : AdN = notYet "almost_AdN" ;
|
||||
oper already_Adv : Adv = notYet "already_Adv" ;
|
||||
oper although_Subj : Subj = notYet "although_Subj" ;
|
||||
oper always_AdV : AdV = notYet "always_AdV" ;
|
||||
oper as_CAdv : CAdv = notYet "as_CAdv" ;
|
||||
oper at_least_AdN : AdN = notYet "at_least_AdN" ;
|
||||
oper at_most_AdN : AdN = notYet "at_most_AdN" ;
|
||||
oper because_Subj : Subj = notYet "because_Subj" ;
|
||||
oper before_Prep : Prep = notYet "before_Prep" ;
|
||||
oper behind_Prep : Prep = notYet "behind_Prep" ;
|
||||
oper between_Prep : Prep = notYet "between_Prep" ;
|
||||
oper both7and_DConj : Conj = notYet "both7and_DConj" ;
|
||||
oper but_PConj : PConj = notYet "but_PConj" ;
|
||||
oper by8agent_Prep : Prep = notYet "by8agent_Prep" ;
|
||||
oper by8means_Prep : Prep = notYet "by8means_Prep" ;
|
||||
oper dconcat : Digits -> Digits -> Digits = notYet "dconcat" ;
|
||||
oper digits2num : Digits -> Numeral = notYet "digits2num" ;
|
||||
oper digits2numeral : Card -> Card = notYet "digits2numeral" ;
|
||||
oper dn : Dig -> Digit = notYet "dn" ;
|
||||
oper dn10 : Dig -> Sub10 = notYet "dn10" ;
|
||||
oper dn100 : Dig -> Dig -> Sub100 = notYet "dn100" ;
|
||||
oper dn1000 : Dig -> Dig -> Dig -> Sub1000 = notYet "dn1000" ;
|
||||
oper dn1000000a : Dig -> Dig -> Dig -> Dig -> Sub1000000 = notYet "dn1000000a" ;
|
||||
oper dn1000000b : Dig -> Dig -> Dig -> Dig -> Dig -> Sub1000000 = notYet "dn1000000b" ;
|
||||
oper dn1000000c : Dig -> Dig -> Dig -> Dig -> Dig -> Dig -> Sub1000000 = notYet "dn1000000c" ;
|
||||
oper during_Prep : Prep = notYet "during_Prep" ;
|
||||
oper either7or_DConj : Conj = notYet "either7or_DConj" ;
|
||||
oper every_Det : Det = notYet "every_Det" ;
|
||||
oper everybody_NP : NP = notYet "everybody_NP" ;
|
||||
oper everything_NP : NP = notYet "everything_NP" ;
|
||||
oper everywhere_Adv : Adv = notYet "everywhere_Adv" ;
|
||||
oper except_Prep : Prep = notYet "except_Prep" ;
|
||||
oper few_Det : Det = notYet "few_Det" ;
|
||||
oper for_Prep : Prep = notYet "for_Prep" ;
|
||||
oper from_Prep : Prep = notYet "from_Prep" ;
|
||||
oper he_Pron : Pron = notYet "he_Pron" ;
|
||||
oper here7from_Adv : Adv = notYet "here7from_Adv" ;
|
||||
oper here7to_Adv : Adv = notYet "here7to_Adv" ;
|
||||
oper here_Adv : Adv = notYet "here_Adv" ;
|
||||
oper how8many_IDet : IDet = notYet "how8many_IDet" ;
|
||||
oper how8much_IAdv : IAdv = notYet "how8much_IAdv" ;
|
||||
oper how_IAdv : IAdv = notYet "how_IAdv" ;
|
||||
oper i_Pron : Pron = notYet "i_Pron" ;
|
||||
oper if_Subj : Subj = notYet "if_Subj" ;
|
||||
oper if_then_Conj : Conj = notYet "if_then_Conj" ;
|
||||
oper in8front_Prep : Prep = notYet "in8front_Prep" ;
|
||||
oper in_Prep : Prep = notYet "in_Prep" ;
|
||||
oper it_Pron : Pron = notYet "it_Pron" ;
|
||||
oper john_PN : PN = notYet "john_PN" ;
|
||||
oper language_title_Utt : Utt = notYet "language_title_Utt" ;
|
||||
oper left_Ord : Ord = notYet "left_Ord" ;
|
||||
oper less_CAdv : CAdv = notYet "less_CAdv" ;
|
||||
oper many_Det : Det = notYet "many_Det" ;
|
||||
oper more_CAdv : CAdv = notYet "more_CAdv" ;
|
||||
oper most_Predet : Predet = notYet "most_Predet" ;
|
||||
oper much_Det : Det = notYet "much_Det" ;
|
||||
oper nd : Digit -> Dig = notYet "nd" ;
|
||||
oper nd10 : Sub10 -> Digits = notYet "nd10" ;
|
||||
oper nd100 : Sub100 -> Digits = notYet "nd100" ;
|
||||
oper nd1000 : Sub1000 -> Digits = notYet "nd1000" ;
|
||||
oper nd1000000 : Sub1000000 -> Digits = notYet "nd1000000" ;
|
||||
oper no_Quant : Quant = notYet "no_Quant" ;
|
||||
oper no_Utt : Utt = notYet "no_Utt" ;
|
||||
oper nobody_NP : NP = notYet "nobody_NP" ;
|
||||
oper not_Predet : Predet = notYet "not_Predet" ;
|
||||
oper nothing_NP : NP = notYet "nothing_NP" ;
|
||||
oper num : Sub1000000 -> Numeral = notYet "num" ;
|
||||
oper num2digits : Numeral -> Digits = notYet "num2digits" ;
|
||||
oper on_Prep : Prep = notYet "on_Prep" ;
|
||||
oper only_Predet : Predet = notYet "only_Predet" ;
|
||||
oper or_Conj : Conj = notYet "or_Conj" ;
|
||||
oper otherwise_PConj : PConj = notYet "otherwise_PConj" ;
|
||||
oper part_Prep : Prep = notYet "part_Prep" ;
|
||||
oper please_Voc : Voc = notYet "please_Voc" ;
|
||||
oper possess_Prep : Prep = notYet "possess_Prep" ;
|
||||
oper pot01 : Sub10 = notYet "pot01" ;
|
||||
oper pot1 : Digit -> Sub100 = notYet "pot1" ;
|
||||
oper pot110 : Sub100 = notYet "pot110" ;
|
||||
oper pot111 : Sub100 = notYet "pot111" ;
|
||||
oper pot1plus : Digit -> Sub10 -> Sub100 = notYet "pot1plus" ;
|
||||
oper pot1to19 : Digit -> Sub100 = notYet "pot1to19" ;
|
||||
oper pot2 : Sub10 -> Sub1000 = notYet "pot2" ;
|
||||
oper pot2plus : Sub10 -> Sub100 -> Sub1000 = notYet "pot2plus" ;
|
||||
oper pot3 : Sub1000 -> Sub1000000 = notYet "pot3" ;
|
||||
oper pot3plus : Sub1000 -> Sub1000 -> Sub1000000 = notYet "pot3plus" ;
|
||||
oper quite_Adv : AdA = notYet "quite_Adv" ;
|
||||
oper right_Ord : Ord = notYet "right_Ord" ;
|
||||
oper she_Pron : Pron = notYet "she_Pron" ;
|
||||
oper so_AdA : AdA = notYet "so_AdA" ;
|
||||
oper somePl_Det : Det = notYet "somePl_Det" ;
|
||||
oper someSg_Det : Det = notYet "someSg_Det" ;
|
||||
oper somebody_NP : NP = notYet "somebody_NP" ;
|
||||
oper something_NP : NP = notYet "something_NP" ;
|
||||
oper somewhere_Adv : Adv = notYet "somewhere_Adv" ;
|
||||
oper that_Quant : Quant = notYet "that_Quant" ;
|
||||
oper that_Subj : Subj = notYet "that_Subj" ;
|
||||
oper there7from_Adv : Adv = notYet "there7from_Adv" ;
|
||||
oper there7to_Adv : Adv = notYet "there7to_Adv" ;
|
||||
oper there_Adv : Adv = notYet "there_Adv" ;
|
||||
oper therefore_PConj : PConj = notYet "therefore_PConj" ;
|
||||
oper they_Pron : Pron = notYet "they_Pron" ;
|
||||
oper this_Quant : Quant = notYet "this_Quant" ;
|
||||
oper through_Prep : Prep = notYet "through_Prep" ;
|
||||
oper to_Prep : Prep = notYet "to_Prep" ;
|
||||
oper too_AdA : AdA = notYet "too_AdA" ;
|
||||
oper under_Prep : Prep = notYet "under_Prep" ;
|
||||
oper very_AdA : AdA = notYet "very_AdA" ;
|
||||
oper we_Pron : Pron = notYet "we_Pron" ;
|
||||
oper whatPl_IP : IP = notYet "whatPl_IP" ;
|
||||
oper whatSg_IP : IP = notYet "whatSg_IP" ;
|
||||
oper when_IAdv : IAdv = notYet "when_IAdv" ;
|
||||
oper when_Subj : Subj = notYet "when_Subj" ;
|
||||
oper where_IAdv : IAdv = notYet "where_IAdv" ;
|
||||
oper which_IQuant : IQuant = notYet "which_IQuant" ;
|
||||
oper whoPl_IP : IP = notYet "whoPl_IP" ;
|
||||
oper whoSg_IP : IP = notYet "whoSg_IP" ;
|
||||
oper why_IAdv : IAdv = notYet "why_IAdv" ;
|
||||
oper with_Prep : Prep = notYet "with_Prep" ;
|
||||
oper without_Prep : Prep = notYet "without_Prep" ;
|
||||
oper yes_Utt : Utt = notYet "yes_Utt" ;
|
||||
oper youPl_Pron : Pron = notYet "youPl_Pron" ;
|
||||
oper youPol_Pron : Pron = notYet "youPol_Pron" ;
|
||||
oper youSg_Pron : Pron = notYet "youSg_Pron" ;
|
||||
}
|
||||
36
src/toki-pona/NamesTok.gf
Normal file
36
src/toki-pona/NamesTok.gf
Normal file
@@ -0,0 +1,36 @@
|
||||
concrete NamesTok of Names = CatTok ** open Prelude in {
|
||||
|
||||
-- An API layer to deal with names
|
||||
-- Not part of the RGL API, but used in the AW project
|
||||
-- So depends on your goals whether this is high or low priority to implement.
|
||||
{-
|
||||
lin
|
||||
-- : GN -> NP ;
|
||||
GivenName gn =
|
||||
|
||||
-- : SN -> NP ;
|
||||
MaleSurname sn =
|
||||
|
||||
-- : SN -> NP ;
|
||||
FemaleSurname sn =
|
||||
|
||||
-- : SN -> NP ;
|
||||
PlSurname sn =
|
||||
|
||||
-- : GN -> SN -> NP ;
|
||||
FullName gn sn =
|
||||
|
||||
lin
|
||||
-- : LN -> NP ;
|
||||
UseLN ln =
|
||||
|
||||
-- : LN -> NP ;
|
||||
PlainLN ln =
|
||||
|
||||
-- : LN -> Adv ;
|
||||
InLN ln =
|
||||
|
||||
-- : AP -> LN -> LN ;
|
||||
AdjLN ap ln =
|
||||
-}
|
||||
}
|
||||
211
src/toki-pona/NounTok.gf
Normal file
211
src/toki-pona/NounTok.gf
Normal file
@@ -0,0 +1,211 @@
|
||||
--# -path=.:../abstract:../common:../prelude
|
||||
concrete NounTok of Noun = CatTok ** open ResTok, Prelude in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
lin
|
||||
|
||||
--2 Noun phrases
|
||||
|
||||
-- : Det -> CN -> NP
|
||||
DetCN det cn = emptyNP ** {
|
||||
s = cn.s ++ det.s
|
||||
} ;
|
||||
|
||||
-- : PN -> NP ;
|
||||
-- Assuming that lincat PN = lincat NP
|
||||
UsePN pn = {
|
||||
s = pn.head ++ pn.tail ;
|
||||
p = P3 ;
|
||||
li = NotMiSina ;
|
||||
} ;
|
||||
|
||||
-- : Pron -> NP ;
|
||||
-- Assuming that lincat Pron = lincat NP
|
||||
UsePron pron = pron ;
|
||||
|
||||
-- : Predet -> NP -> NP ; -- only the man
|
||||
-- PredetNP predet np =
|
||||
|
||||
-- A noun phrase can also be postmodified by the past participle of a
|
||||
-- verb, by an adverb, or by a relative clause
|
||||
|
||||
-- low prio
|
||||
-- : NP -> V2 -> NP ; -- the man seen
|
||||
-- PPartNP np v2 = np ** {
|
||||
-- s =
|
||||
-- } ;
|
||||
|
||||
-- : NP -> Adv -> NP ; -- Paris today
|
||||
-- AdvNP np adv = np ** {
|
||||
-- s = np.s ++ "," ++ adv.s
|
||||
-- } ;
|
||||
|
||||
-- : NP -> Adv -> NP ; -- boys, such as ..
|
||||
-- ExtAdvNP np adv = AdvNP np {s = "," ++ adv.s} ;
|
||||
|
||||
-- : NP -> RS -> NP ; -- Paris, which is here
|
||||
-- RelNP np rs = np ** {
|
||||
|
||||
-- } ;
|
||||
|
||||
-- Determiners can form noun phrases directly.
|
||||
|
||||
|
||||
-- : Det -> NP ;
|
||||
DetNP det = emptyNP ** {
|
||||
s = det.s
|
||||
} ;
|
||||
-- MassNP : CN -> NP ;
|
||||
MassNP cn = emptyNP ** {
|
||||
s = linCN cn
|
||||
} ;
|
||||
|
||||
|
||||
--2 Determiners
|
||||
|
||||
-- The determiner has a fine-grained structure, in which a 'nucleus'
|
||||
-- quantifier and an optional numeral can be discerned.
|
||||
|
||||
-- : Quant -> Num -> Det ;
|
||||
DetQuant quant num = quant ** {
|
||||
s = quant.s ++ num.s
|
||||
} ;
|
||||
|
||||
-- : Quant -> Num -> Ord -> Det ;
|
||||
-- DetQuantOrd quant num ord = quant ** {
|
||||
|
||||
-- } ;
|
||||
|
||||
NumSg,NumPl = ss [] ;
|
||||
|
||||
-- Whether the resulting determiner is singular or plural depends on the
|
||||
-- cardinal.
|
||||
|
||||
-- All parts of the determiner can be empty, except $Quant$, which is
|
||||
-- the "kernel" of a determiner. It is, however, the $Num$ that determines
|
||||
-- the inherent number.
|
||||
|
||||
-- : Card -> Num ; -- two
|
||||
NumCard card = card ;
|
||||
|
||||
{-
|
||||
-- : Digits -> Card ;
|
||||
NumDigits dig = -- probably like OrdDigits, but choose the NCard form
|
||||
|
||||
-- : Numeral -> Card ;
|
||||
NumNumeral num = {
|
||||
s = num.s ! NCard ;
|
||||
n = num.n -- inherits grammatical number (Sg, Pl, …) from the Numeral
|
||||
} ;
|
||||
|
||||
-- : AdN -> Card -> Card ;
|
||||
AdNum adn card = card ** { s = adn.s ++ card.s } ;
|
||||
|
||||
-- : Digits -> Ord ;
|
||||
OrdDigits digs = digs ** { s = digs.s ! NOrd } ;
|
||||
|
||||
-- : Numeral -> Ord ;
|
||||
OrdNumeral num = {
|
||||
s = num.s ! NOrd
|
||||
} ;
|
||||
|
||||
-- : A -> Ord ;
|
||||
OrdSuperl a = {
|
||||
s = "most" ++ a.s ! Superl
|
||||
} ;
|
||||
|
||||
-- One can combine a numeral and a superlative.
|
||||
|
||||
-- : Numeral -> A -> Ord ; -- third largest
|
||||
OrdNumeralSuperl num a = {
|
||||
s = num.s ! NOrd ++ a.s ! Superl
|
||||
} ;
|
||||
-}
|
||||
|
||||
-- : Quant
|
||||
DefArt = mkQuant [] ;
|
||||
|
||||
-- : Quant
|
||||
IndefArt = mkQuant [] ;
|
||||
|
||||
-- : Pron -> Quant -- my
|
||||
PossPron pron = mkQuant pron.s ;
|
||||
|
||||
--2 Common nouns
|
||||
|
||||
-- : N -> CN
|
||||
UseN n = n ;
|
||||
|
||||
{-
|
||||
-- : N2 -> CN ;
|
||||
UseN2 n2 =
|
||||
|
||||
-- : N2 -> NP -> CN ;
|
||||
ComplN2 n2 np =
|
||||
|
||||
-- : N3 -> NP -> N2 ; -- distance from this city (to Paris)
|
||||
ComplN3 n3 np =
|
||||
|
||||
-- : N3 -> N2 ; -- distance (from this city)
|
||||
Use2N3 n3 = lin N2 n3 ** { c2 = n3.c3 } ;
|
||||
|
||||
-- : N3 -> N2 ; -- distance (to Paris)
|
||||
Use3N3 n3 = lin N2 n3 ;
|
||||
|
||||
-- : AP -> CN -> CN
|
||||
AdjCN ap cn =
|
||||
|
||||
-- : CN -> RS -> CN ;
|
||||
RelCN cn rs =
|
||||
|
||||
|
||||
-- : CN -> Adv -> CN ;
|
||||
AdvCN cn adv =
|
||||
|
||||
-- Nouns can also be modified by embedded sentences and questions.
|
||||
-- For some nouns this makes little sense, but we leave this for applications
|
||||
-- to decide. Sentential complements are defined in VerbTok.
|
||||
|
||||
-- : CN -> SC -> CN ; -- question where she sleeps
|
||||
SentCN cn sc =
|
||||
|
||||
--2 Apposition
|
||||
|
||||
-- This is certainly overgenerating.
|
||||
|
||||
-- : CN -> NP -> CN ; -- city Paris (, numbers x and y)
|
||||
ApposCN cn np = cn ** {
|
||||
s =
|
||||
} ;
|
||||
|
||||
--2 Possessive and partitive constructs
|
||||
-- NB. Below this, the functions are not in the API, so lower prio to implement
|
||||
|
||||
-- : PossNP : CN -> NP -> CN ;
|
||||
-- in English: book of someone; point is that we can add a determiner to the CN,
|
||||
-- so it can become "a book of someone" or "the book of someone"
|
||||
PossNP cn np =
|
||||
|
||||
|
||||
-- : Det -> NP -> NP ; -- three of them, some of the boys
|
||||
CountNP det np = -- Nonsense for DefArt or IndefArt, but don't worry about that! RGL can contain weird sentences, as long as it contains the non-weird stuff we want
|
||||
|
||||
|
||||
-- : CN -> NP -> CN ; -- glass of wine / two kilos of red apples
|
||||
PartNP cn np =
|
||||
|
||||
--3 Conjoinable determiners and ones with adjectives
|
||||
|
||||
-- : DAP -> AP -> DAP ; -- the large (one)
|
||||
AdjDAP dap ap = dap ** {
|
||||
|
||||
} ;
|
||||
|
||||
-- : Det -> DAP ; -- this (or that)
|
||||
DetDAP det = det ;
|
||||
-}
|
||||
|
||||
-- : AP -> CN -> CN
|
||||
AdjCN = \ap,cn -> { s = cn.s ++ ap.s ;};
|
||||
}
|
||||
113
src/toki-pona/NumeralTok.gf
Normal file
113
src/toki-pona/NumeralTok.gf
Normal file
@@ -0,0 +1,113 @@
|
||||
concrete NumeralTok of Numeral = CatTok [Numeral,Digits] **
|
||||
open Prelude, ResTok in {
|
||||
|
||||
lincat
|
||||
Digit = LinNumeral ; -- 2..9
|
||||
Sub10, -- 1..9
|
||||
Sub100, -- 1..99
|
||||
Sub1000, -- 1..999
|
||||
Sub1000000, -- 1..999999
|
||||
Sub1000000000, -- 1..999999999
|
||||
Sub1000000000000 -- 1..999999999999
|
||||
= LinNumeral ;
|
||||
|
||||
-- param CardOrd defined in ResTok
|
||||
-- type LinNumeral -""-
|
||||
|
||||
|
||||
lin
|
||||
-- : Sub1000000 -> Numeral ; -- 123456 [coercion to top category]
|
||||
num x = x ;
|
||||
|
||||
-- : Digit ;
|
||||
n2 = mkNumeral "two" ;
|
||||
n3 = mkNumeral "three" ;
|
||||
n4 = mkNumeral "four" ;
|
||||
n5 = mkNumeral "five" ;
|
||||
n6 = mkNumeral "six" ;
|
||||
n7 = mkNumeral "seven" ;
|
||||
n8 = mkNumeral "eight" ;
|
||||
n9 = mkNumeral "nine" ;
|
||||
|
||||
-- : Sub10 ; -- 1
|
||||
-- pot01 =
|
||||
|
||||
-- : Digit -> Sub10 ; -- d * 1
|
||||
pot0 d = d ;
|
||||
|
||||
-- : Sub100 ; -- 10
|
||||
-- pot110 = mkNum "ten" ;
|
||||
|
||||
-- : Sub100 ; -- 11
|
||||
-- pot111 = mkNum "eleven" ;
|
||||
|
||||
-- : Digit -> Sub100 ; -- 10 + d
|
||||
-- pot1to19 d =
|
||||
|
||||
-- : Sub10 -> Sub100 ; -- coercion of 1..9
|
||||
pot0as1 n = n ;
|
||||
|
||||
-- : Digit -> Sub100 ; -- d * 10
|
||||
-- pot1 d =
|
||||
|
||||
-- : Digit -> Sub10 -> Sub100 ; -- d * 10 + n
|
||||
-- pot1plus d e =
|
||||
|
||||
-- : Sub100 -> Sub1000 ; -- coercion of 1..99
|
||||
pot1as2 n = n ;
|
||||
|
||||
-- : Sub10 -> Sub1000 ; -- m * 100
|
||||
-- pot2 d =
|
||||
|
||||
-- : Sub10 -> Sub100 -> Sub1000 ; -- m * 100 + n
|
||||
-- pot2plus d e =
|
||||
|
||||
-- : Sub1000 -> Sub1000000 ; -- coercion of 1..999
|
||||
pot2as3 n = n ;
|
||||
|
||||
-- : Sub1000 -> Sub1000000 ; -- m * 1000
|
||||
-- pot3 d =
|
||||
|
||||
-- : Sub1000 -> Sub1000 -> Sub1000000 ; -- m * 1000 + n
|
||||
-- pot3plus d e =
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Numerals as sequences of digits have a separate, simpler grammar
|
||||
--
|
||||
|
||||
lincat
|
||||
Dig = LinDig ; -- single digit 0..9
|
||||
|
||||
lin
|
||||
-- : Dig -> Digits ; -- 8
|
||||
IDig d = d ;
|
||||
|
||||
-- : Dig -> Digits -> Digits ; -- 876
|
||||
IIDig d e = {
|
||||
s = table {
|
||||
NCard => glue (d.s ! NCard) (e.s ! NCard) ;
|
||||
NOrd => glue (d.s ! NCard) (e.s ! NOrd)
|
||||
} ;
|
||||
} ;
|
||||
|
||||
-- : Dig ;
|
||||
D_0 = mkDig "0" ;
|
||||
D_1 = mkDig "1" ;
|
||||
D_2 = mkDig "2" ;
|
||||
D_3 = mkDig "3" ;
|
||||
D_4 = mkDig "4" ;
|
||||
D_5 = mkDig "5" ;
|
||||
D_6 = mkDig "6" ;
|
||||
D_7 = mkDig "7" ;
|
||||
D_8 = mkDig "8" ;
|
||||
D_9 = mkDig "9" ;
|
||||
|
||||
oper
|
||||
LinDig : Type = {s : CardOrd => Str } ;
|
||||
mkDig : Str -> LinDig = \s -> {
|
||||
s = table {
|
||||
NCard => s ;
|
||||
NOrd => s + "th"
|
||||
} ;
|
||||
} ;
|
||||
}
|
||||
213
src/toki-pona/ParadigmsTok.gf
Normal file
213
src/toki-pona/ParadigmsTok.gf
Normal file
@@ -0,0 +1,213 @@
|
||||
resource ParadigmsTok = open CatTok, ResTok, NounTok, Prelude in {
|
||||
|
||||
oper
|
||||
|
||||
--2 Parameters
|
||||
--
|
||||
-- To abstract over number, valency and (some) case names,
|
||||
-- we define the following identifiers. The application programmer
|
||||
-- should always use these constants instead of the constructors
|
||||
-- defined in $ResSom$.
|
||||
|
||||
Prep : Type ;
|
||||
noPrep : Prep ;
|
||||
|
||||
-- Add more overload instances if needed for all categories!
|
||||
|
||||
--2 Nouns
|
||||
|
||||
mkN : overload {
|
||||
mkN : Str -> N ; -- Predictable nouns
|
||||
} ;
|
||||
|
||||
mkPN : overload {
|
||||
mkPN : Str -> Str -> PN ; -- Proper nouns
|
||||
} ;
|
||||
|
||||
--2 Adjectives
|
||||
|
||||
mkA : overload {
|
||||
mkA : Str -> A ; -- Predictable adjective
|
||||
} ;
|
||||
|
||||
mkA2 : overload {
|
||||
mkA2 : Str -> A2 ; -- Predictable A2, no preposition
|
||||
mkA2 : A -> Prep -> A2 ; -- A2 made from A and Prep
|
||||
} ;
|
||||
|
||||
--2 Verbs
|
||||
|
||||
-- Verbs
|
||||
mkV : overload {
|
||||
mkV : Str -> V ; -- Predictable verb
|
||||
} ;
|
||||
|
||||
|
||||
mkV2 : overload {
|
||||
mkV2 : Str -> V2 ; -- Predictable transitive verb
|
||||
mkV2 : V -> Prep -> V2 ; -- V2 made from V and Prep
|
||||
} ;
|
||||
|
||||
mkV3 : overload {
|
||||
mkV3 : V -> V3 ; -- No prepositions
|
||||
mkV3 : V -> Prep -> Prep -> V3 ; -- Prepositions for direct and indirect objects given
|
||||
} ;
|
||||
|
||||
mkVV : overload {
|
||||
mkVV : V -> VV ;
|
||||
} ;
|
||||
|
||||
mkVA : overload {
|
||||
mkVA : V -> VA ;
|
||||
} ;
|
||||
|
||||
mkVQ : overload {
|
||||
mkVQ : V -> VQ ;
|
||||
} ;
|
||||
|
||||
mkVS : overload {
|
||||
mkV : V -> VS ;
|
||||
} ;
|
||||
|
||||
-- Etc. do the same for other V subcats (V2A, V2V, V2S, …)
|
||||
|
||||
|
||||
-----
|
||||
|
||||
--2 Structural categories
|
||||
|
||||
-- If prepositions take case, add that as argument to mkPrep
|
||||
mkPrep : overload {
|
||||
mkPrep : Str -> Prep ;
|
||||
} ;
|
||||
|
||||
mkConj : overload {
|
||||
mkConj : (and : Str) -> Conj ; -- (coffee) and (tea)
|
||||
mkConj : (either : Str) -> (or : Str) -> Conj ; -- either (coffee) or (tea)
|
||||
} ;
|
||||
|
||||
mkSubj : overload {
|
||||
mkSubj : Str -> Subj ;
|
||||
} ;
|
||||
|
||||
mkAdv : overload {
|
||||
mkAdv : Str -> Adv ;
|
||||
} ;
|
||||
|
||||
mkAdV : overload {
|
||||
mkAdV : Str -> AdV ;
|
||||
} ;
|
||||
|
||||
mkAdA : overload {
|
||||
mkAdA : Str -> AdA ;
|
||||
} ;
|
||||
|
||||
|
||||
--.
|
||||
-------------------------------------------------------------------------------
|
||||
-- The definitions should not bother the user of the API. So they are
|
||||
-- hidden from the document.
|
||||
|
||||
Prep = CatTok.Prep ;
|
||||
noPrep = mkPrep [] ;
|
||||
|
||||
-- Add more overload instances if needed for all categories!
|
||||
|
||||
-- For explanation of `lin N`, see
|
||||
-- https://inariksit.github.io/gf/2018/05/25/subtyping-gf.html#lock-fields
|
||||
|
||||
mkN = overload {
|
||||
mkN : Str -> N = \s -> lin N (ResTok.mkNoun s) ;
|
||||
-- TODO: more overload instances
|
||||
} ;
|
||||
|
||||
mkPN = overload {
|
||||
mkPN : Str -> Str -> PN = \head,tail -> lin PN {
|
||||
head = head; tail = tail
|
||||
}
|
||||
} ;
|
||||
|
||||
--2 Adjectives
|
||||
|
||||
mkA = overload {
|
||||
mkA : Str -> A = \s -> ss s
|
||||
} ;
|
||||
{-
|
||||
|
||||
mkA2 = overload {
|
||||
mkA2 : Str -> A2 = \s -> …
|
||||
mkA2 : A -> Prep -> A2 = \s -> …
|
||||
} ;
|
||||
|
||||
--2 Verbs
|
||||
-}
|
||||
-- Verbs
|
||||
mkV = overload {
|
||||
mkV : Str -> V = \s -> lin V (mkVerb s) ;
|
||||
} ;
|
||||
|
||||
mkV2 = overload {
|
||||
mkV2 : Str -> V2 = \s -> ss s
|
||||
-- mkV2 : V -> Prep -> V2 = \s -> …
|
||||
} ;
|
||||
|
||||
{-
|
||||
|
||||
mkV3 = overload {
|
||||
mkV3 : V -> V3 = \s -> …
|
||||
mkV3 : V -> Prep -> Prep -> V3 = \s -> …
|
||||
} ;
|
||||
|
||||
mkVV = overload {
|
||||
mkVV : V -> VV = \s -> …
|
||||
} ;
|
||||
|
||||
mkVA = overload {
|
||||
mkVA : V -> VA = \s -> …
|
||||
} ;
|
||||
|
||||
mkVQ = overload {
|
||||
mkVQ : V -> VQ = \s -> …
|
||||
} ;
|
||||
|
||||
|
||||
mkVS = overload {
|
||||
mkV : V -> VS = \s -> …
|
||||
} ;
|
||||
|
||||
-- Etc. do the same for other V subcats (V2A, V2V, V2S, …)
|
||||
|
||||
|
||||
-----
|
||||
-}
|
||||
|
||||
-- If prepositions take case, add that as argument to mkPrep
|
||||
mkPrep = overload {
|
||||
mkPrep : Str -> Prep = \s -> lin Prep {s = s} ;
|
||||
} ;
|
||||
{-
|
||||
mkConj = overload {
|
||||
mkConj : (and : Str) -> Conj = \s -> …
|
||||
mkConj : (either : Str) -> (or : Str) -> Conj = \s -> …
|
||||
} ;
|
||||
|
||||
mkSubj = overload {
|
||||
mkSubj : Str -> Subj = \s -> …
|
||||
} ;
|
||||
|
||||
mkAdv = overload {
|
||||
mkAdv : Str -> Adv = \s -> …
|
||||
} ;
|
||||
|
||||
mkAdV = overload {
|
||||
mkAdV : Str -> AdV = \s -> …
|
||||
} ;
|
||||
|
||||
mkAdA = overload {
|
||||
mkAdA : Str -> AdA = \s -> …
|
||||
} ;
|
||||
|
||||
-}
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
}
|
||||
27
src/toki-pona/PhraseTok.gf
Normal file
27
src/toki-pona/PhraseTok.gf
Normal file
@@ -0,0 +1,27 @@
|
||||
concrete PhraseTok of Phrase = CatTok ** open Prelude, ResTok in {
|
||||
|
||||
lin
|
||||
PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ;
|
||||
|
||||
UttS s = s ;
|
||||
{-
|
||||
UttQS qs = qs ;
|
||||
UttIAdv iadv = iadv ;
|
||||
UttNP np =
|
||||
UttIP ip =
|
||||
UttImpSg pol imp = { s = pol.s ++ imp.s ! Sg ! pol.p } ;
|
||||
UttImpPl pol imp =
|
||||
UttImpPol pol imp = {s = pol.s ++ imp.s ! Sg ! pol.p} ;
|
||||
UttVP vp = {s = linVP vp} ;
|
||||
UttAP ap = { s = ap.s } ;
|
||||
UttAdv adv = {s = } ;
|
||||
UttCN n = {s = } ;
|
||||
UttCard n = {s = } ;
|
||||
UttInterj i = i ; -}
|
||||
NoPConj = {s = []} ;
|
||||
-- PConjConj conj = {s = conj.s1 ++ conj.s2 ! …} ;
|
||||
|
||||
NoVoc = {s = []} ;
|
||||
-- VocNP np = { s = "," ++ np.s ! … } ;
|
||||
|
||||
}
|
||||
105
src/toki-pona/QuestionTok.gf
Normal file
105
src/toki-pona/QuestionTok.gf
Normal file
@@ -0,0 +1,105 @@
|
||||
concrete QuestionTok of Question = CatTok ** open
|
||||
Prelude, ResTok, ParadigmsTok, (V=VerbTok), (Noun=NounTok), (S=StructuralTok) in {
|
||||
|
||||
-- A question can be formed from a clause ('yes-no question') or
|
||||
-- with an interrogative.
|
||||
-- Interrogative pronouns can be formed with interrogative
|
||||
-- determiners, with or without a noun.
|
||||
|
||||
{-
|
||||
lin
|
||||
-- : IDet -> CN -> IP ; -- which five songs
|
||||
IdetCN idet cn = Noun.DetCN idet cn ** {
|
||||
} ;
|
||||
|
||||
-- : IDet -> IP ; -- which five
|
||||
IdetIP idet = Noun.DetNP idet ** {sp = idet.sp};
|
||||
|
||||
-- : IQuant -> Num -> IDet ; -- which (five)
|
||||
IdetQuant iquant num = iquant ** {
|
||||
} ;
|
||||
|
||||
-- : IP -> ClSlash -> QCl ; -- whom does John love
|
||||
QuestSlash ip cls = cls ** {
|
||||
|
||||
} ;
|
||||
|
||||
-- : Cl -> QCl ;
|
||||
QuestCl cl = cl ** {
|
||||
};
|
||||
|
||||
|
||||
-- : IP -> VP -> QCl ;
|
||||
QuestVP ip cl = cl ** {
|
||||
} ;
|
||||
|
||||
-- : IAdv -> Cl -> QCl ; -- why does John walk
|
||||
QuestIAdv iadv cls = {
|
||||
} ;
|
||||
|
||||
-- : IP -> IComp ;
|
||||
CompIP ip = {s = ip.s ! } ; -- who (is it)
|
||||
|
||||
-- : IComp -> NP -> QCl ; -- where is John?
|
||||
QuestIComp icomp np = {
|
||||
} ;
|
||||
|
||||
|
||||
-- Interrogative pronouns can be formed with interrogative
|
||||
-- determiners, with or without a noun.
|
||||
|
||||
-- : IDet -> CN -> IP ; -- which five songs
|
||||
IdetCN idet cn =
|
||||
|
||||
-- : IDet -> IP ; -- which five
|
||||
IdetIP idet =
|
||||
|
||||
-- They can be modified with adverbs.
|
||||
|
||||
-- : IP -> Adv -> IP ; -- who in Paris
|
||||
AdvIP = Noun.AdvNP ;
|
||||
|
||||
-- Interrogative quantifiers have number forms and can take number modifiers.
|
||||
|
||||
-- : IQuant -> Num -> IDet ; -- which (five)
|
||||
IdetQuant = Noun.DetQuant ;
|
||||
|
||||
-- Interrogative adverbs can be formed prepositionally.
|
||||
-- : Prep -> IP -> IAdv ; -- with whom
|
||||
PrepIP prep ip =
|
||||
|
||||
-- They can be modified with other adverbs.
|
||||
|
||||
-- : IAdv -> Adv -> IAdv ; -- where in Paris
|
||||
AdvIAdv iadv adv =
|
||||
|
||||
-- Interrogative complements to copulas can be both adverbs and
|
||||
-- pronouns.
|
||||
|
||||
-- : IAdv -> IComp ;
|
||||
CompIAdv iadv = iadv ; -- where (is it)
|
||||
|
||||
|
||||
-- More $IP$, $IDet$, and $IAdv$ are defined in $Structural$.
|
||||
|
||||
-- Wh questions with two or more question words require a new, special category.
|
||||
|
||||
lincat
|
||||
-- buy what where
|
||||
QVP =
|
||||
lin
|
||||
-- : VPSlash -> IP -> QVP ; -- buys what
|
||||
ComplSlashIP vps ip =
|
||||
|
||||
-- : VP -> IAdv -> QVP ; -- lives where
|
||||
AdvQVP vp iadv =
|
||||
|
||||
-- : QVP -> IAdv -> QVP ; -- buys what where
|
||||
AddAdvQVP qvp iadv =
|
||||
|
||||
-- : IP -> QVP -> QCl ; -- who buys what where
|
||||
QuestQVP ip qvp =
|
||||
-}
|
||||
|
||||
|
||||
}
|
||||
24
src/toki-pona/RelativeTok.gf
Normal file
24
src/toki-pona/RelativeTok.gf
Normal file
@@ -0,0 +1,24 @@
|
||||
concrete RelativeTok of Relative = CatTok ** open
|
||||
ResTok, Prelude in {
|
||||
|
||||
{-
|
||||
lin
|
||||
-- : Cl -> RCl ; -- such that John loves her
|
||||
RelCl cl = cl ** {
|
||||
} ;
|
||||
|
||||
-- : RP -> VP -> RCl ;
|
||||
RelVP rp vp = {
|
||||
} ;
|
||||
|
||||
-- : RP -> ClSlash -> RCl ; -- who I went with
|
||||
RelSlash rp cls = {
|
||||
} ;
|
||||
|
||||
-- : RP ;
|
||||
IdRP = {s = "that"} ;
|
||||
|
||||
-- : Prep -> NP -> RP -> RP ; -- the mother of whom
|
||||
FunRP prep np rp =
|
||||
-}
|
||||
}
|
||||
262
src/toki-pona/ResTok.gf
Normal file
262
src/toki-pona/ResTok.gf
Normal file
@@ -0,0 +1,262 @@
|
||||
--# -path=.:../abstract:../common:../prelude
|
||||
resource ResTok = open Prelude, Predef, ParamX in {
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- General notes
|
||||
|
||||
-- ** Naming **
|
||||
{-
|
||||
I'm using the naming scheme for lincats and opers as explained here:
|
||||
https://inariksit.github.io/gf/2018/08/28/gf-gotchas.html#my-naming-scheme-for-lincats-and-opers
|
||||
-}
|
||||
|
||||
-- ** File structure **
|
||||
-- The rest of this module is organised as follows:
|
||||
|
||||
-----------------------------
|
||||
-- Grammatical categor(y|ies)
|
||||
|
||||
{-
|
||||
General comments on the cat(s)
|
||||
|
||||
params related to the cat(s)
|
||||
|
||||
opers related to the cat(s)
|
||||
-}
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Nouns
|
||||
|
||||
{-The param Number comes from common/ParamX, and has the values Sg and Pl.
|
||||
* If your language doesn't have number, remove Number from all records.
|
||||
* If your language has number with more than 2 values, define your own number in this module
|
||||
(e.g. uncomment line 56) and use that Number instead of Number.
|
||||
|
||||
The param Gender is defined here, and has the values Gender1 and Gender2.
|
||||
Currently it's only as a suggestion to be an inherent field in LinN.
|
||||
* If your language doesn't have gender, remove Gender from all records.
|
||||
* If your language has genders/noun classes, replace the placeholder Gender1 and Gender1
|
||||
with the actual values of your language (there can be more than 2!), and uncomment
|
||||
the g : Gender field from the definition of LinN.
|
||||
|
||||
If your nouns inflect in more things, like case, you can do one of the following
|
||||
* Replace the placeholder cases on line 53 and make the table 2-dimensional, like this:
|
||||
oper LinN : Type = {s : Number => Case => Str ; …} ;
|
||||
* Make your own parameter that combines all the relevant features, like this:
|
||||
param NForm = Whatever | You | Need | For | Noun | Inflection ;
|
||||
oper LinN : Type = {s : NForm => Str ; …} ;
|
||||
This can be a good idea, if your inflection table has some gaps, i.e. not all combinations are in use
|
||||
See https://gist.github.com/inariksit/708ab9df2498e88bc63aedf5fc7be2f3#file-tables-gf-L48-L122 for explanation
|
||||
-}
|
||||
|
||||
param
|
||||
Person = P1 | P2 | P3 ;
|
||||
|
||||
LiSubject = MiSina | NotMiSina ;
|
||||
|
||||
oper
|
||||
LinN : Type = {s : Str ;} ;
|
||||
|
||||
-- Most often, the lincat for CN is the same as N, with possibly some additional fields.
|
||||
-- However, sometimes you need more fields than just the s field, e.g. to keep word order flexible, or to add clitics and make sure they attach to the head, not modifiers.
|
||||
-- If you don't know what the previous line means, you can get started with just a single s field.
|
||||
-- You'll notice later whether you need such a field or not.
|
||||
LinCN : Type = LinN
|
||||
-- ** {postmod/premod/… : Str} -- if needed
|
||||
;
|
||||
|
||||
LinPN : Type = {
|
||||
head : Str ;
|
||||
tail : Str
|
||||
} ;
|
||||
|
||||
-- For inflection paradigms, see http://www.grammaticalframework.org/doc/tutorial/gf-tutorial.html#toc56
|
||||
mkNoun : Str -> LinN = \s -> {s = s ;} ;
|
||||
|
||||
linCN : LinCN -> Str = \cn -> cn.s ;
|
||||
|
||||
---------------------------------------------
|
||||
-- Numeral
|
||||
|
||||
-- Used in NumeralTok
|
||||
param
|
||||
CardOrd = NCard | NOrd ;
|
||||
|
||||
oper
|
||||
LinNumeral : Type = {s : CardOrd => Str } ;
|
||||
|
||||
mkNumeral : Str -> LinNumeral = \s -> {
|
||||
s = table {
|
||||
NCard => s ;
|
||||
NOrd => s + "th"
|
||||
} ;
|
||||
} ;
|
||||
|
||||
---------------------------------------------
|
||||
-- Pronoun
|
||||
|
||||
{-The param Person comes from common/ParamX, and has the values P1, P2 and P3.
|
||||
* If your language doesn't inflect in person, you may be able to remove Person from all records.
|
||||
- However, consider if it's really never present? How about e.g. reflexive ("myself", "yourself" etc?)
|
||||
* If your language is more fine-grained than {P1,P2,P3} x {Sg,Pl} (for instance gender and familiarity),
|
||||
you can define your own param. We provide an example called Agr to take inspiration from—remove if
|
||||
not needed, or use and refine if needed.
|
||||
-}
|
||||
|
||||
param
|
||||
-- These params are just for inspiration, not used anywhere currently.
|
||||
Agr = SgP1 -- I
|
||||
| SgP2 Politeness -- e.g. tū, tum, āp (Hindi) — note that the verb really inflects differently for all three!
|
||||
| SgP3 -- e.g. he, she (verb inflects the same, but distinction in reflexive: himself / herself)
|
||||
| FillInTheRestYourself ;
|
||||
Politeness = Intimate | Familiar | Polite ;
|
||||
|
||||
oper
|
||||
LinPron : Type = {
|
||||
s : Str ;
|
||||
p : Person ;
|
||||
li : LiSubject ;
|
||||
-- Alternative to the `n` and `p` fields:
|
||||
-- a : Agr -- sketched above, lines 97-103
|
||||
} ;
|
||||
|
||||
mkPron : (_ : Str) -> Person -> LinPron = \str,per -> {
|
||||
s = str ;
|
||||
p = per ;
|
||||
li = case str of {
|
||||
"mi"|"sina" => MiSina ;
|
||||
_ => NotMiSina
|
||||
} ;
|
||||
} ;
|
||||
|
||||
mi_Pron : LinPron = mkPron "mi" P1 ;
|
||||
sina_Pron : LinPron = mkPron "sina" P2 ;
|
||||
ona_Pron : LinPron = mkPron "ona" P3 ;
|
||||
|
||||
---------------------------------------------
|
||||
-- NP
|
||||
|
||||
{-
|
||||
In the RGL, a NP may come from a common noun, proper noun or pronoun.
|
||||
Pronouns are the only ones that have an inherent person (nouns are almost always 3rd person! please give me counterexamples if you can think of any.)
|
||||
So we can often say that NP's lincat is the same as Prons.
|
||||
|
||||
NB. for later, when you want to make Pron into possessives, you may need more fields in LinPron than in LinNP.
|
||||
That's why I'm copying over the definition below, instead of the neater `LinNP : Type = LinPron`.
|
||||
-}
|
||||
|
||||
LinNP : Type = {
|
||||
s : Str ;
|
||||
p : Person ;
|
||||
li : LiSubject ;
|
||||
|
||||
-- Alternative to the `n` and `p` fields:
|
||||
-- a : Agr -- sketched on lines 97-101
|
||||
} ;
|
||||
|
||||
linNP : LinNP -> Str = \np -> np.s ; -- Change when you change LinNP
|
||||
|
||||
emptyNP : LinNP = { -- Change when you change LinNP
|
||||
s = [] ;
|
||||
p = P3 ;
|
||||
li = NotMiSina
|
||||
} ;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Det, Quant, Card, Ord
|
||||
|
||||
LinQuant : Type = {
|
||||
s : Str -- quantifier in a context, e.g. 'this (cat) (is nice)'
|
||||
-- sp -- quantifier as standalone, e.g. 'this (is nice)'
|
||||
-- : Str ;
|
||||
} ;
|
||||
|
||||
LinDet : Type = {
|
||||
s : Str ;
|
||||
} ;
|
||||
|
||||
-- Can you reuse your mkNoun? Do nouns and quantifiers inflect the same way?
|
||||
mkQuant : Str -> LinQuant = \s -> {s=s;};
|
||||
|
||||
mkDet : Str -> LinDet = \str -> {
|
||||
s = str
|
||||
} ;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Adpositions
|
||||
|
||||
{- The main use of Prep is in the fun
|
||||
|
||||
PrepNP : Prep -> NP -> Adv
|
||||
|
||||
Despite the name of the RGL category, a 'Prep' can be a preposition, postposition,
|
||||
or just an instruction to choose a particular case from the NP.
|
||||
A language may use one, two or all these strategies.
|
||||
|
||||
-}
|
||||
|
||||
oper
|
||||
LinPrep : Type = {
|
||||
s : Str ;
|
||||
} ;
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Adjectives
|
||||
|
||||
LinA : Type = SS ;
|
||||
LinA2 : Type = LinA ;
|
||||
|
||||
mkAdj : Str -> LinA = \str -> {s = str} ;
|
||||
|
||||
AdjPhrase : Type = LinA ; -- ** {compar : Str} ;
|
||||
--------------------------------------------------------------------------------
|
||||
-- Verbs
|
||||
|
||||
oper
|
||||
LinV : Type = {
|
||||
s : Str
|
||||
} ;
|
||||
|
||||
LinV2 : Type = LinV ** {
|
||||
c2 : LinPrep ;
|
||||
} ;
|
||||
|
||||
mkVerb : Str -> LinV = \s -> {s = s} ;
|
||||
|
||||
copula : LinV = {s = "TODO: copula"} ; -- often useful
|
||||
|
||||
------------------
|
||||
-- VP
|
||||
|
||||
LinVP : Type = {
|
||||
s : Polarity => Str ;
|
||||
} ;
|
||||
|
||||
LinVPSlash : Type = LinVP ** {
|
||||
c2 : LinPrep ;
|
||||
} ;
|
||||
|
||||
-- linVP : LinVP -> Str = \vp -> vp.s ;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Cl, S
|
||||
|
||||
-- Operations for clauses, sentences
|
||||
LinCl : Type = {
|
||||
subj : Str ;
|
||||
pred : Polarity => Str ; -- TODO: depend on Temp and Pol
|
||||
} ;
|
||||
|
||||
-- linCl : LinCl -> Str = \cl -> case cl.subj of {
|
||||
-- "mi"|"sina" => cl.subj ++ cl.pred ;
|
||||
-- _ => cl.subj ++ "li" ++ cl.pred
|
||||
-- } ;
|
||||
|
||||
-- linCl : LinCl -> Str = \cl -> cl.subj ++ cl.pred ;
|
||||
|
||||
|
||||
-- Preverb, VV
|
||||
|
||||
Preverb = SS ;
|
||||
}
|
||||
72
src/toki-pona/SentenceTok.gf
Normal file
72
src/toki-pona/SentenceTok.gf
Normal file
@@ -0,0 +1,72 @@
|
||||
|
||||
concrete SentenceTok of Sentence = CatTok ** open
|
||||
TenseX, ResTok, (AM=AdverbTok), Prelude in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
lin
|
||||
|
||||
--2 Clauses
|
||||
|
||||
-- : NP -> VP -> Cl
|
||||
PredVP np vp = {
|
||||
subj = np.s ; -- ! Nom, if there are cases
|
||||
pred = \\pol => case np.li of {
|
||||
MiSina => vp.s ! pol ;
|
||||
NotMiSina => "li" ++ vp.s ! pol
|
||||
} ;
|
||||
} ;
|
||||
|
||||
-- : SC -> VP -> Cl ; -- that she goes is good
|
||||
-- PredSCVP sc vp = ;
|
||||
|
||||
--2 Clauses missing object noun phrases
|
||||
-- : NP -> VPSlash -> ClSlash ;
|
||||
-- SlashVP = \np,vps -> ss ()
|
||||
|
||||
-- : ClSlash -> Adv -> ClSlash ; -- (whom) he sees today
|
||||
-- AdvSlash cls adv =
|
||||
|
||||
-- : Cl -> Prep -> ClSlash ; -- (with whom) he walks
|
||||
-- SlashPrep cl prep = cl ** {c2 = prep} ;
|
||||
|
||||
-- Imperatives
|
||||
-- : VP -> Imp ;
|
||||
-- ImpVP vp =
|
||||
|
||||
--2 Embedded sentences
|
||||
|
||||
-- : S -> SC ;
|
||||
-- EmbedS s =
|
||||
|
||||
-- : QS -> SC ;
|
||||
-- EmbedQS qs =
|
||||
|
||||
-- : VP -> SC ;
|
||||
-- EmbedVP vp =
|
||||
|
||||
--2 Sentences
|
||||
|
||||
-- : Temp -> Pol -> Cl -> S ;
|
||||
UseCl t p cl = {
|
||||
s = cl.subj ++ t.s ++ p.s ++ cl.pred ! p.p
|
||||
} ;
|
||||
|
||||
-- : Temp -> Pol -> QCl -> QS ;
|
||||
-- UseQCl t p cl =
|
||||
|
||||
-- : Temp -> Pol -> RCl -> RS ;
|
||||
-- UseRCl t p cl =
|
||||
|
||||
-- AdvS : Adv -> S -> S ; -- then I will go home
|
||||
-- AdvS adv s =
|
||||
|
||||
-- ExtAdvS : Adv -> S -> S ; -- next week, I will go home
|
||||
-- ExtAdvS adv s =
|
||||
|
||||
-- : S -> Subj -> S -> S ;
|
||||
-- SSubjS s1 subj s2 =
|
||||
|
||||
-- : S -> RS -> S ; -- she sleeps, which is good
|
||||
-- RelS sent rs =
|
||||
}
|
||||
171
src/toki-pona/StructuralTok.gf
Normal file
171
src/toki-pona/StructuralTok.gf
Normal file
@@ -0,0 +1,171 @@
|
||||
concrete StructuralTok of Structural = CatTok **
|
||||
open Prelude, ResTok, (Noun=NounTok), ParadigmsTok in {
|
||||
|
||||
-------
|
||||
-- Ad*
|
||||
|
||||
-- lin almost_AdA =
|
||||
-- lin almost_AdN =
|
||||
-- lin at_least_AdN =
|
||||
-- lin at_most_AdN =
|
||||
-- lin so_AdA =
|
||||
-- lin too_AdA =
|
||||
-- lin very_AdA =
|
||||
|
||||
-- lin as_CAdv =
|
||||
-- lin less_CAdv =
|
||||
-- lin more_CAdv =
|
||||
|
||||
-- lin how8much_IAdv =
|
||||
-- lin when_IAdv =
|
||||
|
||||
-- lin how_IAdv =
|
||||
-- lin where_IAdv =
|
||||
-- lin why_IAdv =
|
||||
|
||||
-- lin always_AdV = ss "" ;
|
||||
|
||||
-- lin everywhere_Adv = ss "" ;
|
||||
-- lin here7from_Adv = ss "" ;
|
||||
-- lin here7to_Adv = ss "" ;
|
||||
-- lin here_Adv = ss "" ;
|
||||
-- lin quite_Adv = ss "" ;
|
||||
-- lin somewhere_Adv = ss "" ;
|
||||
-- lin there7from_Adv = ss "" ;
|
||||
-- lin there7to_Adv = ss "" ;
|
||||
-- lin there_Adv = ss "" ;
|
||||
|
||||
|
||||
-------
|
||||
-- Conj
|
||||
|
||||
-- The lincat of Conj is Coordination.ConjunctionDistr ** {n:Number}
|
||||
-- which means that there are two fields for the strings, and
|
||||
-- n:Number which specifies the number of the resulting NP.
|
||||
|
||||
-- lin and_Conj = {s1 = [] ; s2 = "and" } ;
|
||||
-- lin or_Conj =
|
||||
-- lin if_then_Conj =
|
||||
-- lin both7and_DConj = {s1 = "both" ; s2 = "and" } ;
|
||||
-- lin either7or_DConj =
|
||||
|
||||
-- lin but_PConj =
|
||||
-- lin otherwise_PConj =
|
||||
-- lin therefore_PConj =
|
||||
|
||||
|
||||
-----------------
|
||||
-- *Det and Quant
|
||||
|
||||
-- lin how8many_IDet =
|
||||
-- lin every_Det =
|
||||
|
||||
-- lin all_Predet = {s = ""} ;
|
||||
-- lin not_Predet = { s = "" } ;
|
||||
-- lin only_Predet = { s = "" } ;
|
||||
-- lin most_Predet = {s = ""} ;
|
||||
|
||||
-- lin few_Det = R.indefDet "" pl ;
|
||||
lin many_Det = ss "mute" ;
|
||||
lin much_Det = ss "mute" ;
|
||||
|
||||
-- lin somePl_Det =
|
||||
-- lin someSg_Det =
|
||||
|
||||
lin no_Quant = mkQuant "ala" ;
|
||||
-- lin that_Quant = mkQuant "" ;
|
||||
lin this_Quant = mkQuant "ni" ;
|
||||
-- lin which_IQuant = mkQuant "seme" ;
|
||||
|
||||
-----
|
||||
-- NP
|
||||
|
||||
-- lin somebody_NP =
|
||||
|
||||
|
||||
-- lin everybody_NP =
|
||||
-- lin everything_NP =
|
||||
-- lin nobody_NP =
|
||||
-- lin nothing_NP =
|
||||
-- lin somebody_NP =
|
||||
-- lin something_NP =
|
||||
|
||||
-------
|
||||
-- Prep
|
||||
|
||||
-- lin above_Prep = mkPrep "" ;
|
||||
-- lin after_Prep = mkPrep "" ;
|
||||
-- lin before_Prep = mkPrep "" ;
|
||||
-- lin behind_Prep = mkPrep "" ;
|
||||
-- lin between_Prep = = mkPrep "" ;
|
||||
-- lin by8agent_Prep = mkPrep "" ;
|
||||
-- lin by8means_Prep = mkPrep "" ;
|
||||
-- lin during_Prep = mkPrep "" ;
|
||||
-- lin except_Prep = mkPrep "" ;
|
||||
lin for_Prep = mkPrep "tawa" ;
|
||||
lin from_Prep = mkPrep "tan" ;
|
||||
-- lin in8front_Prep = mkPrep "" ;
|
||||
lin in_Prep = mkPrep "lon" ;
|
||||
-- lin on_Prep = mkPrep "" ;
|
||||
-- lin part_Prep = mkPrep ;
|
||||
-- lin possess_Prep = mkPrep "" ;
|
||||
-- lin through_Prep = mkPrep "" ;
|
||||
lin to_Prep = mkPrep "tawa" ;
|
||||
-- lin under_Prep = mkPrep "" ;
|
||||
-- lin with_Prep = mkPrep "" ;
|
||||
-- lin without_Prep = mkPrep "" ;
|
||||
|
||||
-------
|
||||
-- Pron
|
||||
|
||||
-- Pronouns are closed class, no constructor in ParadigmsTok.
|
||||
lin it_Pron = ona_Pron ;
|
||||
lin i_Pron = mi_Pron ;
|
||||
lin youPol_Pron = sina_Pron ;
|
||||
lin youSg_Pron = sina_Pron ;
|
||||
lin he_Pron = ona_Pron ;
|
||||
lin she_Pron = ona_Pron ;
|
||||
lin we_Pron = ona_Pron ;
|
||||
lin youPl_Pron = sina_Pron ;
|
||||
lin they_Pron = ona_Pron ;
|
||||
|
||||
-- lin whatPl_IP =
|
||||
-- lin whatSg_IP =
|
||||
-- lin whoPl_IP =
|
||||
-- lin whoSg_IP =
|
||||
|
||||
-------
|
||||
-- Subj
|
||||
|
||||
-- lin although_Subj =
|
||||
-- lin because_Subj =
|
||||
-- lin if_Subj =
|
||||
-- lin that_Subj =
|
||||
-- lin when_Subj =
|
||||
|
||||
|
||||
------
|
||||
-- Utt
|
||||
|
||||
lin language_title_Utt = ss "toki pona" ;
|
||||
-- lin no_Utt = ss "" ;
|
||||
-- lin yes_Utt = ss "" ;
|
||||
|
||||
|
||||
-------
|
||||
-- Verb
|
||||
|
||||
lin have_V2 = mkV "jo" ;
|
||||
|
||||
lin can8know_VV = ss "ken" ;
|
||||
lin can_VV = ss "ken" ;
|
||||
-- lin must_VV =
|
||||
lin want_VV = ss "wile" ;
|
||||
|
||||
------
|
||||
-- Voc
|
||||
|
||||
-- lin please_Voc = ss "" ;
|
||||
|
||||
|
||||
}
|
||||
73
src/toki-pona/SymbolTok.gf
Normal file
73
src/toki-pona/SymbolTok.gf
Normal file
@@ -0,0 +1,73 @@
|
||||
--# -path=.:../abstract:../common:../prelude
|
||||
|
||||
concrete SymbolTok of Symbol = CatTok **
|
||||
open Prelude, ParadigmsTok, ResTok, (Noun=NounTok) in {
|
||||
|
||||
lin
|
||||
|
||||
-- : Symb -> PN ; -- x
|
||||
SymbPN i = mkPN_onRuntimeToken i.s ;
|
||||
|
||||
-- : Int -> PN ; -- 27
|
||||
IntPN i = mkPN_onRuntimeToken i.s ;
|
||||
|
||||
-- : Float -> PN ; -- 3.14159
|
||||
FloatPN i = mkPN_onRuntimeToken i.s ;
|
||||
|
||||
-- : Card -> PN ; -- twelve [as proper name]
|
||||
NumPN i = mkPN_onRuntimeToken (i.s ! NCard) ;
|
||||
|
||||
lin
|
||||
-- CNIntNP cn i = {} ;
|
||||
|
||||
-- : Det -> CN -> [Symb] -> NP ; -- (the) (2) numbers x and y
|
||||
CNSymbNP det cn xs =
|
||||
let cnSymb : CN = cn ** {postmod = cn.postmod ++ xs.s}
|
||||
in Noun.DetCN det cnSymb ;
|
||||
|
||||
-- : CN -> Card -> NP ; -- level five ; level 5
|
||||
CNNumNP cn i =
|
||||
let cnSymb : CN = cn ** {postmod = cn.postmod ++ i.s}
|
||||
in Noun.MassNP cnSymb ;
|
||||
|
||||
-- : Symb -> S ;
|
||||
SymbS sy = sy ;
|
||||
|
||||
-- : Symb -> Card ;
|
||||
SymbNum sy = mkNumeral_onRuntimeToken sy.s ;
|
||||
|
||||
-- : Symb -> Ord ;
|
||||
SymbOrd sy = sy ; ---- TODO: nothing added to it. Lincat of Ord is just SS from the beginning.
|
||||
|
||||
oper
|
||||
-- To make Card or PN from a runtime argument, cannot use the single + operation.
|
||||
-- See https://inariksit.github.io/gf/2018/08/28/gf-gotchas.html#unsupported-token-gluing
|
||||
|
||||
mkNumeral_onRuntimeToken : Str -> LinNumeral = \str -> {
|
||||
s = table {
|
||||
NCard => str ;
|
||||
NOrd => str ++ BIND ++ "th"
|
||||
} ;
|
||||
n = Pl ; -- NB. probably singular for number 1
|
||||
} ;
|
||||
|
||||
mkPN_onRuntimeToken : Str -> LinPN = \str -> {
|
||||
s =
|
||||
-- table {_ => -- If lincat of PN changes so that it's an inflection table, uncomment this
|
||||
str
|
||||
-- }
|
||||
;
|
||||
n = Sg ;
|
||||
} ;
|
||||
|
||||
lincat
|
||||
Symb, [Symb] = SS ;
|
||||
|
||||
lin
|
||||
MkSymb s = s ;
|
||||
|
||||
BaseSymb = infixSS "and" ; -- this comes between the last two ones
|
||||
ConsSymb = infixSS "," ;
|
||||
|
||||
|
||||
}
|
||||
125
src/toki-pona/VerbTok.gf
Normal file
125
src/toki-pona/VerbTok.gf
Normal file
@@ -0,0 +1,125 @@
|
||||
concrete VerbTok of Verb = CatTok ** open ResTok, AdverbTok, Prelude, ParamX in {
|
||||
|
||||
|
||||
lin
|
||||
|
||||
-----
|
||||
-- VP
|
||||
-- : V -> VP
|
||||
-- NB. assumes that lincat V = lincat VP
|
||||
-- This will most likely change when you start working with VPs
|
||||
UseV v = {
|
||||
s = table {
|
||||
Pos => v.s ;
|
||||
Neg => v.s ++ "ala"
|
||||
} ;
|
||||
} ;
|
||||
|
||||
-- : V2 -> VP ;
|
||||
-- PassV2 v2 =
|
||||
|
||||
-- : VPSlash -> VP ;
|
||||
ReflVP vps = vps ;
|
||||
|
||||
-- : VV -> VP -> VP ;
|
||||
ComplVV vv vp = { s = \\p => vv.s ++ vp.s ! p ;} ;
|
||||
|
||||
{-
|
||||
-- : VS -> S -> VP ;
|
||||
ComplVS vs s =
|
||||
|
||||
-- : VQ -> QS -> VP ;
|
||||
ComplVQ vq qs =
|
||||
|
||||
-- : VA -> AP -> VP ;
|
||||
ComplVA va ap =
|
||||
|
||||
-- : Comp -> VP ;
|
||||
UseComp comp =
|
||||
-}
|
||||
--------
|
||||
-- Slash
|
||||
-- : V2 -> VPSlash
|
||||
SlashV2a = \v2 -> {
|
||||
s = table {
|
||||
Pos => v2.s ;
|
||||
Neg => v2.s ++ "ala"
|
||||
} ;
|
||||
} ;
|
||||
|
||||
-- : V3 -> NP -> VPSlash ; -- give it (to her)
|
||||
-- Slash2V3 v3 dobj =
|
||||
|
||||
-- : V3 -> NP -> VPSlash ; -- give (it) to her
|
||||
-- Slash3V3 v3 iobj =
|
||||
|
||||
-- SlashV2A v2 adj =
|
||||
|
||||
-- : V2S -> S -> VPSlash ; -- answer (to him) that it is good
|
||||
-- SlashV2S v2s s =
|
||||
|
||||
-- : V2V -> VP -> VPSlash ; -- beg (her) to go
|
||||
-- SlashV2V v2v vp = ;
|
||||
|
||||
-- : V2Q -> QS -> VPSlash ; -- ask (him) who came
|
||||
-- SlashV2Q v2q qs = ;
|
||||
|
||||
-- : V2A -> AP -> VPSlash ; -- paint (it) red
|
||||
-- SlashV2A v2a ap = ;
|
||||
|
||||
|
||||
-- : VPSlash -> NP -> VP
|
||||
-- Often VPSlash has a field called c2, which is used to pick right form of np complement
|
||||
ComplSlash vps np = {
|
||||
s = \\p => vps.s ! p ++ "e" ++ np.s
|
||||
} ;
|
||||
|
||||
-- : VV -> VPSlash -> VPSlash ;
|
||||
SlashVV vv vps = ComplVV vv vps;
|
||||
|
||||
-- : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy
|
||||
-- SlashV2VNP v2v np vps =
|
||||
|
||||
-- : VP -> Adv -> VP ; -- sleep here
|
||||
AdvVP vp adv = {
|
||||
s = \\p => vp.s ! p ++ adv.s ;
|
||||
} ;
|
||||
|
||||
-- : AdV -> VP -> VP ; -- always sleep
|
||||
-- AdVVP adv vp =
|
||||
|
||||
-- : VPSlash -> Adv -> VPSlash ; -- use (it) here
|
||||
-- AdvVPSlash = insertAdv ;
|
||||
|
||||
-- : VP -> Adv -> VP ; -- sleep , even though ...
|
||||
-- ExtAdvVP vp adv = ;
|
||||
|
||||
-- : AdV -> VPSlash -> VPSlash ; -- always use (it)
|
||||
-- AdVVPSlash adv vps = vps ** { adv = adv.s ++ vps.adv } ;
|
||||
|
||||
-- : VP -> Prep -> VPSlash ; -- live in (it)
|
||||
VPSlashPrep vp prep = {
|
||||
s = \\p => vp.s ! p ++ prep.s
|
||||
} ;
|
||||
|
||||
|
||||
--2 Complements to copula
|
||||
|
||||
-- Adjectival phrases, noun phrases, and adverbs can be used.
|
||||
|
||||
-- : AP -> Comp ;
|
||||
-- CompAP ap =
|
||||
|
||||
-- : CN -> Comp ;
|
||||
-- CompCN cn =
|
||||
|
||||
-- NP -> Comp ;
|
||||
-- CompNP np =
|
||||
|
||||
-- : Adv -> Comp ;
|
||||
-- CompAdv adv =
|
||||
|
||||
-- : VP -- Copula alone;
|
||||
-- UseCopula =
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user