1
0
forked from GitHub/gf-rgl

li in PredVP

This commit is contained in:
2026-04-04 19:47:02 -06:00
parent d2568cf869
commit eccbdcfb97
12 changed files with 281 additions and 125 deletions

1
.envrc Normal file
View File

@@ -0,0 +1 @@
use flake

1
.gitignore vendored
View File

@@ -5,3 +5,4 @@ dist/
*.pgf *.pgf
*.tmp *.tmp
*~ *~
.direnv

62
flake.lock generated Normal file
View 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
View 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
View 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
'';
}

View File

@@ -1,3 +1,4 @@
--# -path=.:../abstract:../common:../prelude
concrete CatTok of Cat = CommonX ** open ResTok, Coordination, Prelude in { concrete CatTok of Cat = CommonX ** open ResTok, Coordination, Prelude in {
flags optimize=all_subs ; flags optimize=all_subs ;
@@ -51,7 +52,8 @@ concrete CatTok of Cat = CommonX ** open ResTok, Coordination, Prelude in {
CN = ResTok.LinCN ; CN = ResTok.LinCN ;
NP = ResTok.LinNP ; NP = ResTok.LinNP ;
Pron = SS ; -- NB. Pronouns need enough info to become NP or Quant. -- NB. Pronouns need enough info to become NP or Quant.
Pron = ResTok.LinPron ;
Det = ResTok.LinDet ; -- s : Str , n : Number Det = ResTok.LinDet ; -- s : Str , n : Number
Predet = SS ; Predet = SS ;
Quant = ResTok.LinQuant ; -- s : Number => Str Quant = ResTok.LinQuant ; -- s : Number => Str
@@ -68,14 +70,12 @@ concrete CatTok of Cat = CommonX ** open ResTok, Coordination, Prelude in {
Numeral = ResTok.LinNumeral ; Numeral = ResTok.LinNumeral ;
Digits = ResTok.LinNumeral ; Digits = ResTok.LinNumeral ;
Decimal = SS ;
--2 Structural words --2 Structural words
-- Constructed in StructuralTok. -- Constructed in StructuralTok.
Conj = Coordination.ConjunctionDistr ** { Conj = Coordination.ConjunctionDistr ;
-- n : Number -- The number of the NP that results from
-- coordinating a list of NPs with that Conj.
} ; -- "[Ann and Bob] are children" → and_Conj.n = Pl
Subj = SS ; Subj = SS ;
Prep = SS ; Prep = SS ;

View File

@@ -10,7 +10,7 @@ concrete LexiconTok of Lexicon = CatTok **
-- lin already_Adv = mkA "" ; -- lin already_Adv = mkA "" ;
lin animal_N = mkN "soweli" ; lin animal_N = mkN "soweli" ;
-- lin answer_V2S = mkV2S (mkV "") ; -- lin answer_V2S = mkV2S (mkV "") ;
lin apartment_N = mkN "taso" ; lin apartment_N = mkN "tomo" ;
-- lin apple_N = mkN "" ; -- lin apple_N = mkN "" ;
-- lin art_N = mkN "" ; -- lin art_N = mkN "" ;
-- lin ashes_N = mkN "" ; -- lin ashes_N = mkN "" ;
@@ -153,7 +153,7 @@ lin dog_N = mkN "soweli" ;
-- lin glove_N = mkN "" ; -- lin glove_N = mkN "" ;
-- lin go_V = mkV "" ; -- lin go_V = mkV "" ;
-- lin gold_N = mkN "" ; -- lin gold_N = mkN "" ;
-- lin good_A = mkA "" ; -- lin good_A = mkA "pona" ;
-- lin grammar_N = mkN "" ; -- lin grammar_N = mkN "" ;
-- lin grass_N = mkN "" ; -- lin grass_N = mkN "" ;
-- lin green_A = mkA "" ; -- lin green_A = mkA "" ;
@@ -202,7 +202,7 @@ lin dog_N = mkN "soweli" ;
-- lin lake_N = mkN "" ; -- lin lake_N = mkN "" ;
-- lin lamp_N = mkN "" ; -- lin lamp_N = mkN "" ;
-- lin language_N = mkN "" ; lin language_N = mkN "toki" ;
-- lin laugh_V = mkV "" ; -- lin laugh_V = mkV "" ;
-- lin leaf_N = mkN "" ; -- lin leaf_N = mkN "" ;
-- lin learn_V2 = mkV2 "" ; -- lin learn_V2 = mkV2 "" ;
@@ -217,8 +217,8 @@ lin dog_N = mkN "soweli" ;
-- lin long_A = mkA "" ; -- lin long_A = mkA "" ;
-- lin lose_V2 = mkV2 "" ; -- lin lose_V2 = mkV2 "" ;
-- lin louse_N = mkN "" ; -- lin louse_N = mkN "" ;
-- lin love_N = mkN "" ; lin love_N = mkN "olin" ;
-- lin love_V2 = mkV2 "" ; -- lin love_V2 = mkV2 "olin" ;
---- ----
-- M -- M
@@ -281,7 +281,7 @@ lin play_V = mkV "musi" ;
-- lin read_V2 = mkV2 "" ; -- lin read_V2 = mkV2 "" ;
-- lin ready_A = mkA "" ; -- lin ready_A = mkA "" ;
-- lin reason_N = mkN "" ; -- lin reason_N = mkN "" ;
-- lin red_A = mkA "loje" ; lin red_A = mkA "loje" ;
-- lin religion_N = mkN "" ; -- lin religion_N = mkN "" ;
-- lin restaurant_N = mkN "" ; -- lin restaurant_N = mkN "" ;
-- lin river_N = mkN "" ; -- lin river_N = mkN "" ;

View File

@@ -11,15 +11,15 @@ concrete NounTok of Noun = CatTok ** open ResTok, Prelude in {
DetCN det cn = emptyNP ** { DetCN det cn = emptyNP ** {
s = cn.s ++ det.s s = cn.s ++ det.s
} ; } ;
{-
-- : PN -> NP ; -- : PN -> NP ;
-- Assuming that lincat PN = lincat NP -- Assuming that lincat PN = lincat NP
UsePN pn = pn ; -- UsePN pn = pn ;
-- : Pron -> NP ; -- : Pron -> NP ;
-- Assuming that lincat Pron = lincat NP -- Assuming that lincat Pron = lincat NP
UsePron pron = pron ; UsePron pron = pron ;
{-
-- : Predet -> NP -> NP ; -- only the man -- : Predet -> NP -> NP ; -- only the man
PredetNP predet np = PredetNP predet np =

View File

@@ -121,16 +121,16 @@ oper
-- TODO: more overload instances -- TODO: more overload instances
} ; } ;
{-
mkPN = overload { mkPN = overload {
mkPN : Str -> PN = mkPN : Str -> PN = \s -> ss s ;
} ; } ;
--2 Adjectives --2 Adjectives
mkA = overload { mkA = overload {
mkA : Str -> A = \s -> mkA : Str -> A = \s -> ss s
} ; } ;
{-
mkA2 = overload { mkA2 = overload {
mkA2 : Str -> A2 = \s -> … mkA2 : Str -> A2 = \s -> …

View File

@@ -1,3 +1,4 @@
--# -path=.:../abstract:../common:../prelude
resource ResTok = open Prelude, Predef in { resource ResTok = open Prelude, Predef in {
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
@@ -51,6 +52,8 @@ https://inariksit.github.io/gf/2018/08/28/gf-gotchas.html#my-naming-scheme-for-l
param param
Person = P1 | P2 | P3 ; Person = P1 | P2 | P3 ;
LiSubject = MiSina | NotMiSina ;
oper oper
LinN : Type = {s : Str ;} ; LinN : Type = {s : Str ;} ;
@@ -111,13 +114,18 @@ oper
LinPron : Type = { LinPron : Type = {
s : Str ; s : Str ;
p : Person ; p : Person ;
li : LiSubject ;
-- Alternative to the `n` and `p` fields: -- Alternative to the `n` and `p` fields:
-- a : Agr -- sketched above, lines 97-103 -- a : Agr -- sketched above, lines 97-103
} ; } ;
mkPron : (_ : Str) -> Person -> LinPron = \str,per -> { mkPron : (_ : Str) -> Person -> LinPron = \str,per -> {
s = str ; s = str ;
p = per p = per ;
li = case str of {
"mi"|"sina" => MiSina ;
_ => NotMiSina
} ;
} ; } ;
--------------------------------------------- ---------------------------------------------
@@ -135,6 +143,8 @@ That's why I'm copying over the definition below, instead of the neater `LinNP :
LinNP : Type = { LinNP : Type = {
s : Str ; s : Str ;
p : Person ; p : Person ;
li : LiSubject ;
-- Alternative to the `n` and `p` fields: -- Alternative to the `n` and `p` fields:
-- a : Agr -- sketched on lines 97-101 -- a : Agr -- sketched on lines 97-101
} ; } ;
@@ -144,6 +154,7 @@ That's why I'm copying over the definition below, instead of the neater `LinNP :
emptyNP : LinNP = { -- Change when you change LinNP emptyNP : LinNP = { -- Change when you change LinNP
s = [] ; s = [] ;
p = P3 ; p = P3 ;
li = NotMiSina
} ; } ;
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
@@ -235,6 +246,11 @@ oper
pred : Str ; -- TODO: depend on Temp and Pol pred : 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 ; linCl : LinCl -> Str = \cl -> cl.subj ++ cl.pred ;
} }

View File

@@ -11,12 +11,10 @@ lin
-- : NP -> VP -> Cl -- : NP -> VP -> Cl
PredVP np vp = { PredVP np vp = {
subj = np.s ; -- ! Nom, if there are cases subj = np.s ; -- ! Nom, if there are cases
pred = pred = case np.li of {
-- table {something with tense+polarity => MiSina => vp.s ;
vp.s NotMiSina => "li" ++ vp.s
-- TODO: all of the VP's tense and polarity should be open here! } ;
-- PredVP only decides the subject.
-- }
} ; } ;
{- {-

View File

@@ -3,39 +3,39 @@ concrete StructuralTok of Structural = CatTok **
------- -------
-- Ad* -- 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 almost_AdA =
lin less_CAdv = -- lin almost_AdN =
lin more_CAdv = -- lin at_least_AdN =
-- lin at_most_AdN =
-- lin so_AdA =
-- lin too_AdA =
-- lin very_AdA =
lin how8much_IAdv = -- lin as_CAdv =
lin when_IAdv = -- lin less_CAdv =
-- lin more_CAdv =
lin how_IAdv = -- lin how8much_IAdv =
lin where_IAdv = -- lin when_IAdv =
lin why_IAdv =
lin always_AdV = ss "" ; -- 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 "" ;
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 -- Conj
@@ -43,10 +43,10 @@ lin there_Adv = ss "" ;
-- which means that there are two fields for the strings, and -- which means that there are two fields for the strings, and
-- n:Number which specifies the number of the resulting NP. -- n:Number which specifies the number of the resulting NP.
lin and_Conj = {s1 = [] ; s2 = "and" } ; -- lin and_Conj = {s1 = [] ; s2 = "and" } ;
-- lin or_Conj = -- lin or_Conj =
-- lin if_then_Conj = -- lin if_then_Conj =
lin both7and_DConj = {s1 = "both" ; s2 = "and" } ; -- lin both7and_DConj = {s1 = "both" ; s2 = "and" } ;
-- lin either7or_DConj = -- lin either7or_DConj =
-- lin but_PConj = -- lin but_PConj =
@@ -56,116 +56,116 @@ lin both7and_DConj = {s1 = "both" ; s2 = "and" } ;
----------------- -----------------
-- *Det and Quant -- *Det and Quant
{-
lin how8many_IDet =
lin every_Det =
lin all_Predet = {s = ""} ; -- lin how8many_IDet =
lin not_Predet = { s = "" } ; -- lin every_Det =
lin only_Predet = { s = "" } ;
lin most_Predet = {s = ""} ;
lin few_Det = R.indefDet "" pl ; -- lin all_Predet = {s = ""} ;
lin many_Det = R.indefDet "" pl ; -- lin not_Predet = { s = "" } ;
lin much_Det = R.indefDet "" sg ; -- lin only_Predet = { s = "" } ;
-- lin most_Predet = {s = ""} ;
lin somePl_Det = -- lin few_Det = R.indefDet "" pl ;
lin someSg_Det = -- lin many_Det = R.indefDet "" pl ;
-- lin much_Det = R.indefDet "" sg ;
lin no_Quant = -- lin somePl_Det =
lin that_Quant = mkQuant "" ; -- lin someSg_Det =
lin this_Quant = mkQuant "" ;
lin which_IQuant = mkQuant "" ; -- lin no_Quant =
-- lin that_Quant = mkQuant "" ;
-- lin this_Quant = mkQuant "" ;
-- lin which_IQuant = mkQuant "" ;
----- -----
-- NP -- NP
lin somebody_NP = -- lin somebody_NP =
lin everybody_NP = -- lin everybody_NP =
lin everything_NP = -- lin everything_NP =
lin nobody_NP = -- lin nobody_NP =
lin nothing_NP = -- lin nothing_NP =
lin somebody_NP = -- lin somebody_NP =
lin something_NP = -- lin something_NP =
------- -------
-- Prep -- Prep
lin above_Prep = mkPrep "" ; -- lin above_Prep = mkPrep "" ;
lin after_Prep = mkPrep "" ; -- lin after_Prep = mkPrep "" ;
lin before_Prep = mkPrep "" ; -- lin before_Prep = mkPrep "" ;
lin behind_Prep = mkPrep "" ; -- lin behind_Prep = mkPrep "" ;
lin between_Prep = = mkPrep "" ; -- lin between_Prep = = mkPrep "" ;
lin by8agent_Prep = mkPrep "" ; -- lin by8agent_Prep = mkPrep "" ;
lin by8means_Prep = mkPrep "" ; -- lin by8means_Prep = mkPrep "" ;
lin during_Prep = mkPrep "" ; -- lin during_Prep = mkPrep "" ;
lin except_Prep = mkPrep "" ; -- lin except_Prep = mkPrep "" ;
lin for_Prep = mkPrep "" ; -- lin for_Prep = mkPrep "" ;
lin from_Prep = mkPrep "" ; -- lin from_Prep = mkPrep "" ;
lin in8front_Prep = mkPrep "" ; -- lin in8front_Prep = mkPrep "" ;
lin in_Prep = mkPrep "" ; -- lin in_Prep = mkPrep "" ;
lin on_Prep = mkPrep "" ; -- lin on_Prep = mkPrep "" ;
lin part_Prep = mkPrep ; -- lin part_Prep = mkPrep ;
lin possess_Prep = mkPrep "" ; -- lin possess_Prep = mkPrep "" ;
lin through_Prep = mkPrep "" ; -- lin through_Prep = mkPrep "" ;
lin to_Prep = mkPrep "k" ; -- lin to_Prep = mkPrep "k" ;
lin under_Prep = mkPrep "" ; -- lin under_Prep = mkPrep "" ;
lin with_Prep = mkPrep "" ; -- lin with_Prep = mkPrep "" ;
lin without_Prep = mkPrep "" ; -- lin without_Prep = mkPrep "" ;
------- -------
-- Pron -- Pron
-- Pronouns are closed class, no constructor in ParadigmsTok. -- Pronouns are closed class, no constructor in ParadigmsTok.
lin it_Pron = -- lin it_Pron =
lin i_Pron = lin i_Pron = mkPron "mi" P1 ;
lin youPol_Pron = -- lin youPol_Pron =
lin youSg_Pron = lin youSg_Pron = mkPron "sina" P2 ;
lin he_Pron = -- lin he_Pron =
lin she_Pron = -- lin she_Pron =
lin we_Pron = lin we_Pron = mkPron "mi" P1 ;
lin youPl_Pron = lin youPl_Pron = mkPron "sina" P2 ;
lin they_Pron = -- lin they_Pron =
lin whatPl_IP = -- lin whatPl_IP =
lin whatSg_IP = -- lin whatSg_IP =
lin whoPl_IP = -- lin whoPl_IP =
lin whoSg_IP = -- lin whoSg_IP =
------- -------
-- Subj -- Subj
lin although_Subj = -- lin although_Subj =
lin because_Subj = -- lin because_Subj =
lin if_Subj = -- lin if_Subj =
lin that_Subj = -- lin that_Subj =
lin when_Subj = -- lin when_Subj =
------ ------
-- Utt -- Utt
lin language_title_Utt = ss "" ; -- lin language_title_Utt = ss "" ;
lin no_Utt = ss "" ; -- lin no_Utt = ss "" ;
lin yes_Utt = ss "" ; -- lin yes_Utt = ss "" ;
------- -------
-- Verb -- Verb
lin have_V2 = -- lin have_V2 =
lin can8know_VV = -- can (capacity) -- lin can8know_VV = -- can (capacity)
lin can_VV = -- can (possibility) -- lin can_VV = -- can (possibility)
lin must_VV = -- lin must_VV =
lin want_VV = -- lin want_VV =
------ ------
-- Voc -- Voc
lin please_Voc = ss "" ; -- lin please_Voc = ss "" ;
-}
} }