forked from GitHub/comp-syntax-gu-mlt
Compare commits
10 Commits
f25a32e983
...
0ba6518630
| Author | SHA1 | Date | |
|---|---|---|---|
| 0ba6518630 | |||
| 99a260a729 | |||
| c481320ed6 | |||
| f6293e2834 | |||
| 9f59998ef2 | |||
| 8f07d8c73d | |||
| 997b50276f | |||
| f85bb5ef54 | |||
| 65a023a1f1 | |||
| 51df41ed8d |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1 +1,3 @@
|
||||
*.gfo
|
||||
*.gfo
|
||||
.gf-lsp
|
||||
.direnv
|
||||
133
flake.lock
generated
Normal file
133
flake.lock
generated
Normal file
@@ -0,0 +1,133 @@
|
||||
{
|
||||
"nodes": {
|
||||
"bnfc": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1694438405,
|
||||
"narHash": "sha256-UmrJlHrMlB4tOxQEnBA1blh3aUV28dJHFZs5LNUbNLU=",
|
||||
"owner": "BNFC",
|
||||
"repo": "bnfc",
|
||||
"rev": "1ead871febe45b8adecad286a90650414e24d8a4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "BNFC",
|
||||
"ref": "master",
|
||||
"repo": "bnfc",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gf": {
|
||||
"inputs": {
|
||||
"bnfc": "bnfc",
|
||||
"gf-core": "gf-core",
|
||||
"gf-rgl": "gf-rgl",
|
||||
"gf-wordnet": "gf-wordnet",
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1695852170,
|
||||
"narHash": "sha256-xgA9ltioXjh5gYdgmzWACMFeFJu3w4ytMqQlb649oH8=",
|
||||
"owner": "anka-213",
|
||||
"repo": "cclaw-nix-stuff",
|
||||
"rev": "bb591a7d0b6e81f5ae053d2e99a0f8dd9fb5d2a9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "anka-213",
|
||||
"ref": "nix-flakes",
|
||||
"repo": "cclaw-nix-stuff",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gf-core": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1695655790,
|
||||
"narHash": "sha256-de5Fk5TK5aUL1YQphoYNBrpJj8GRuPJis7komT95+q8=",
|
||||
"owner": "GrammaticalFramework",
|
||||
"repo": "gf-core",
|
||||
"rev": "7d9015e2e159b376cf2ba8332093c9623375557e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "GrammaticalFramework",
|
||||
"ref": "master",
|
||||
"repo": "gf-core",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gf-rgl": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1695810223,
|
||||
"narHash": "sha256-deTXlcYreUl/pHnFZbjSrZIq8L/XunLTODm7aE9LKSA=",
|
||||
"owner": "GrammaticalFramework",
|
||||
"repo": "gf-rgl",
|
||||
"rev": "f19dcc01f99252feb79823830863389e6cf0fc7f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "GrammaticalFramework",
|
||||
"ref": "master",
|
||||
"repo": "gf-rgl",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gf-wordnet": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1695803720,
|
||||
"narHash": "sha256-LG5NVsB81Any5P/2WgEpELJKZQmySloHk1F42E7wD1k=",
|
||||
"owner": "GrammaticalFramework",
|
||||
"repo": "gf-wordnet",
|
||||
"rev": "39efb2f91ccb9575c8d96bc272bd2d9f90c1eb23",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "GrammaticalFramework",
|
||||
"ref": "master",
|
||||
"repo": "gf-wordnet",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1665056165,
|
||||
"narHash": "sha256-2C7VfNphJa0FxPoT+suMOmUDVrQ5RIE+NKfDWqElvE4=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "27a89ba43b0fb735ce867e8ab3d2442f8cc61dad",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1769170682,
|
||||
"narHash": "sha256-oMmN1lVQU0F0W2k6OI3bgdzp2YOHWYUAw79qzDSjenU=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "c5296fdd05cfa2c187990dd909864da9658df755",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"gf": "gf",
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
40
flake.nix
Normal file
40
flake.nix
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
gf.url = "github:anka-213/cclaw-nix-stuff/nix-flakes";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, ... }@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; };
|
||||
inherit (pkgs) lib;
|
||||
inherit system;
|
||||
});
|
||||
in {
|
||||
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 {
|
||||
packages = [
|
||||
inputs.gf.packages.${system}.gf-with-rgl
|
||||
pkgs.graphviz
|
||||
gf-lsp.gf-lsp
|
||||
];
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
@@ -49,6 +49,11 @@ abstract MicroLang = {
|
||||
aPl_Det : Det ; -- indefinite plural ---s
|
||||
the_Det : Det ; -- definite singular ---s
|
||||
thePl_Det : Det ; -- definite plural ---s
|
||||
this_Det : Det ;
|
||||
thisPl_Det: Det ;
|
||||
that_Det : Det ;
|
||||
thatPl_Det: Det ;
|
||||
|
||||
UseN : N -> CN ; -- house
|
||||
AdjCN : AP -> CN -> CN ; -- big house
|
||||
|
||||
@@ -162,4 +167,4 @@ fun
|
||||
yellow_A : A ;
|
||||
young_A : A ;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ concrete MicroLangEng of MicroLang = open MicroResEng, Prelude in {
|
||||
PredVPS np vp = {
|
||||
s = np.s ! Nom ++ vp.verb.s ! agr2vform np.a ++ vp.compl
|
||||
} ;
|
||||
|
||||
|
||||
UseV v = {
|
||||
verb = v ;
|
||||
compl = [] ;
|
||||
@@ -62,6 +62,10 @@ concrete MicroLangEng of MicroLang = open MicroResEng, Prelude in {
|
||||
aPl_Det = {s = "" ; n = Pl} ;
|
||||
the_Det = {s = "the" ; n = Sg} ;
|
||||
thePl_Det = {s = "the" ; n = Pl} ;
|
||||
this_Det = {s = "this"; n = Sg} ;
|
||||
thisPl_Det = {s = "these"; n = Pl} ;
|
||||
that_Det = {s = "that"; n = Sg} ;
|
||||
thatPl_Det = {s = "those"; n = Pl} ;
|
||||
|
||||
UseN n = n ;
|
||||
|
||||
|
||||
152
lab1/grammar/korean/MicroLangKor.gf
Normal file
152
lab1/grammar/korean/MicroLangKor.gf
Normal file
@@ -0,0 +1,152 @@
|
||||
--# -path=.:../abstract
|
||||
concrete MicroLangKor of MicroLang = open MicroResKor, Prelude in {
|
||||
|
||||
-----------------------------------------------------
|
||||
---------------- Grammar part -----------------------
|
||||
-----------------------------------------------------
|
||||
|
||||
lincat
|
||||
Utt = {s : Str} ;
|
||||
|
||||
S = {s : Str} ;
|
||||
VP = {verb : Verb ; compl : Str} ; ---s special case of Mini
|
||||
Comp = Noun ;
|
||||
AP = Adjective ;
|
||||
CN = Noun ;
|
||||
NP = {s : Str} ;
|
||||
Pron = {s : Str} ;
|
||||
Det = {s : Str} ;
|
||||
Prep = {s : Str} ;
|
||||
V = Verb ;
|
||||
V2 = Verb2 ;
|
||||
A = Adjective ;
|
||||
N = Noun ;
|
||||
Adv = {s : Str} ;
|
||||
|
||||
lin
|
||||
UttS s = s ;
|
||||
UttNP np = {s = np.s} ;
|
||||
-- PredVPS np vp = {s = np.s ++ vp.compl ++ vp.verb.s} ;
|
||||
UseV v = {verb = v ; compl = []} ;
|
||||
ComplV2 v2 np = {verb = v2 ; compl = np.s};
|
||||
UseN n = n ;
|
||||
DetCN det cn = {s = det.s ++ cn.s} ;
|
||||
a_Det = {s = []} ;
|
||||
aPl_Det = {s = []} ;
|
||||
the_Det = {s = []} ;
|
||||
thePl_Det = {s = []} ;
|
||||
this_Det = {s = "이"} ;
|
||||
thisPl_Det = {s = "이"} ;
|
||||
that_Det = {s = "그"} ;
|
||||
thatPl_Det = {s = "그"} ;
|
||||
|
||||
-----------------------------------------------------
|
||||
---------------- Lexicon part -----------------------
|
||||
-----------------------------------------------------
|
||||
|
||||
-- lin already_Adv = mkAdv "벌써" ;
|
||||
lin animal_N = mkN "동물" ;
|
||||
lin apple_N = mkN "사과" ;
|
||||
lin baby_N = mkN "아기" ;
|
||||
-- lin bad_A = mkA "나쁜" ;
|
||||
lin beer_N = mkN "beer" ;
|
||||
-- lin big_A = mkA "큰" ;
|
||||
lin bike_N = mkN "bike" ;
|
||||
lin bird_N = mkN "bird" ;
|
||||
-- lin black_A = mkA "black" ;
|
||||
lin blood_N = mkN "피" ;
|
||||
-- lin blue_A = mkA "blue" ;
|
||||
lin boat_N = mkN "boat" ;
|
||||
lin book_N = mkN "책" ;
|
||||
lin boy_N = mkN "소녁" ;
|
||||
lin bread_N = mkN "bread" ;
|
||||
-- lin break_V2 = mkV2 (mkV "break" "broke" "broken") ;
|
||||
-- lin buy_V2 = mkV2 (mkV "buy" "bought" "bought") ;
|
||||
lin car_N = mkN "자동차" ;
|
||||
lin cat_N = mkN "고양이" ;
|
||||
lin child_N = mkN "어린이" ;
|
||||
lin city_N = mkN "city" ;
|
||||
-- lin clean_A = mkA "정소한" ;
|
||||
-- lin clever_A = mkA "똑똑한" ;
|
||||
lin cloud_N = mkN "cloud" ;
|
||||
-- lin cold_A = mkA "차가운" ;
|
||||
lin come_V = regVerb_a_o "오다" ;
|
||||
lin computer_N = mkN "컴퓨터" ;
|
||||
lin cow_N = mkN "cow" ;
|
||||
-- lin dirty_A = mkA "더러운" ;
|
||||
lin dog_N = mkN "개" ;
|
||||
-- lin drink_V2 = mkV2 (mkV "drink" "drank" "drunk") ;
|
||||
-- lin eat_V2 = mkV2 (mkV "eat" "ate" "eaten") ;
|
||||
-- lin find_V2 = mkV2 (mkV "find" "found" "found") ;
|
||||
lin fire_N = mkN "fire" ;
|
||||
lin fish_N = mkN "생선" ;
|
||||
lin flower_N = mkN "flower" ;
|
||||
lin friend_N = mkN "진구" ;
|
||||
lin girl_N = mkN "소녀" ;
|
||||
-- lin good_A = mkA "좋은" ;
|
||||
-- lin go_V = mkV "go" "went" "gone" ;
|
||||
lin grammar_N = mkN "grammar" ;
|
||||
-- lin green_A = mkA "green" ;
|
||||
-- lin heavy_A = mkA "heavy" ;
|
||||
lin horse_N = mkN "horse" ;
|
||||
-- lin hot_A = mkA "hot" ;
|
||||
lin house_N = mkN "집" ;
|
||||
-- lin john_PN = mkPN "John" ;
|
||||
-- lin jump_V = mkV "jump" ;
|
||||
-- lin kill_V2 = mkV2 "kill" ;
|
||||
-- lin know_VS = mkVS (mkV "know" "knew" "known") ;
|
||||
lin language_N = mkN "언어" ;
|
||||
-- lin live_V = mkV "live" ;
|
||||
-- lin love_V2 = mkV2 (mkV "love") ;
|
||||
lin man_N = mkN "남자" ;
|
||||
lin milk_N = mkN "우유" ;
|
||||
lin music_N = mkN "음악" ;
|
||||
-- lin new_A = mkA "new" ;
|
||||
-- lin now_Adv = mkAdv "지금" ;
|
||||
-- lin old_A = mkA "낡안" ;
|
||||
-- lin paris_PN = mkPN "Paris" ;
|
||||
-- lin play_V = mkV "놀" ;
|
||||
-- lin read_V2 = mkV2 (mkV "read" "read" "read") ;
|
||||
-- lin ready_A = mkA "ready" ;
|
||||
-- lin red_A = mkA "red" ;
|
||||
lin river_N = mkN "river" ;
|
||||
-- lin run_V = mkV "run" "ran" "run" ;
|
||||
lin sea_N = mkN "바다" ;
|
||||
-- lin see_V2 = mkV2 (mkV "see" "saw" "seen") ;
|
||||
lin ship_N = mkN "ship" ;
|
||||
lin sleep_V = regVerb_a_o "자다" ;
|
||||
-- lin small_A = mkA "작은" ;
|
||||
lin star_N = mkN "별" ;
|
||||
-- lin swim_V = mkV "swim" "swam" "swum" ;
|
||||
-- lin teach_V2 = mkV2 (mkV "teach" "taught" "taught") ;
|
||||
lin train_N = mkN "train" ;
|
||||
-- lin travel_V = mkV "travel" ;
|
||||
lin tree_N = mkN "tree" ;
|
||||
-- lin understand_V2 = mkV2 (mkV "understand" "understood" "understood") ;
|
||||
-- lin wait_V2 = mkV2 "wait" "for" ;
|
||||
-- lin walk_V = mkV "walk" ;
|
||||
-- lin warm_A = mkA "따뜻한" ;
|
||||
lin water_N = mkN "물" ;
|
||||
-- lin white_A = mkA "하얗은" ;
|
||||
lin wine_N = mkN "wine" ;
|
||||
lin woman_N = mkN "여자" ;
|
||||
-- lin yellow_A = mkA "yellow" ;
|
||||
-- lin young_A = mkA "young" ;
|
||||
|
||||
---------------------------
|
||||
-- Paradigms part ---------
|
||||
---------------------------
|
||||
|
||||
oper
|
||||
mkN : Str -> Noun
|
||||
= \s -> lin N {s = s} ;
|
||||
|
||||
-- mkA : Str -> A
|
||||
-- = \stem -> lin A (mkV stem) ;
|
||||
|
||||
mkAdv : Str -> Adv
|
||||
= \s -> lin Adv {s = s} ;
|
||||
|
||||
mkPrep : Str -> Prep
|
||||
= \s -> lin Prep {s = s} ;
|
||||
}
|
||||
44
lab1/grammar/korean/MicroResKor.gf
Normal file
44
lab1/grammar/korean/MicroResKor.gf
Normal file
@@ -0,0 +1,44 @@
|
||||
resource MicroResKor = open Prelude, Hangul in {
|
||||
param
|
||||
VForm = Lemma | VPresent | VPast ;
|
||||
|
||||
oper
|
||||
Noun : Type = {s : Str} ;
|
||||
Verb : Type = {s : VForm => Str} ;
|
||||
Verb2 : Type = Verb ;
|
||||
Adjective : Type = Verb ;
|
||||
|
||||
lemmaToStem : (lemma : Str) -> Str
|
||||
= \lemma -> case lemma of {
|
||||
stem + "다" => stem ;
|
||||
_ => Predef.error ("lemmaToStem was applied to a non-lemma," ++ lemma)
|
||||
} ;
|
||||
|
||||
regVerb_eo : (lemma : Str) -> Verb
|
||||
= \lemma ->
|
||||
let stem = lemmaToStem lemma ;
|
||||
in {
|
||||
s = table {
|
||||
Lemma => lemma ;
|
||||
VPresent => stem + "어요" ;
|
||||
VPast => stem + "었어요"
|
||||
}
|
||||
} ;
|
||||
|
||||
regVerb_a_o : (lemma : Str) -> Verb
|
||||
= \lemma ->
|
||||
let stem = lemmaToStem lemma ;
|
||||
in {
|
||||
s = table {
|
||||
Lemma => lemma ;
|
||||
VPresent => stem + "아요" ;
|
||||
VPast => stem + "았어요"
|
||||
}
|
||||
} ;
|
||||
|
||||
blah : Str -> Str
|
||||
= \s -> case s of {
|
||||
_ + "ᅡ" => "아-final" ;
|
||||
_ => "not 아-final"
|
||||
} ;
|
||||
}
|
||||
Reference in New Issue
Block a user