fix detcn

This commit is contained in:
2026-04-05 10:31:50 -06:00
parent 786340192f
commit 43979ed054
19 changed files with 317 additions and 23 deletions

60
src/_grphp_1.dot Normal file
View File

@@ -0,0 +1,60 @@
graph {
edge[style="solid"]; node[shape="plaintext"];
subgraph {rank=same;
n18[label="Phr"];
}
subgraph {rank=same;
n16[label="Utt"];
}
n18 -- n16[label="dep#1"];
subgraph {rank=same;
n15[label="S"];
}
n16 -- n15
subgraph {rank=same;
n14[label="Cl"];
}
n15 -- n14[label="dep#2"];
subgraph {rank=same;
n6[label="NP"];
n13[label="VP"];
edge[style="invis"];
n6 -- n13 ;
}
n14 -- n6
n14 -- n13[label="dep#1"];
subgraph {rank=same;
n5[label="Pron"];
n8[label="VPSlash"];
edge[style="invis"];
n5 -- n8 ;
}
n6 -- n5
n13 -- n8
subgraph {rank=same;
n7[label="V2"];
}
n8 -- n7
edge[style="dashed"]; node[shape="plaintext"];
subgraph {rank=same;
n100000[label="Pron
I"];
n100001[label="Cl
don't"];
n100002[label="V2
know"];
edge[style="invis"];
n100000 -- n100001 -- n100002 ;
}
n5 -- n100000;
n14 -- n100001;
n7 -- n100002;
}

BIN
src/_grphp_1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

42
src/_grphp_2.dot Normal file
View File

@@ -0,0 +1,42 @@
graph {
edge[style="solid"]; node[shape="plaintext"];
subgraph {rank=same;
n12[label="PhrUtt : Phr"];
}
subgraph {rank=same;
n10[label="UttImpPol : Utt"];
}
n12 -- n10;
subgraph {rank=same;
n9[label="ImpVP : Imp"];
}
n10 -- n9;
subgraph {rank=same;
n8[label="ComplSlash : VP"];
}
n9 -- n8;
subgraph {rank=same;
n3[label="SlashV2a : VPSlash"];
}
n8 -- n3;
subgraph {rank=same;
n2[label="know_V2 : V2"];
}
n3 -- n2;
edge[style="dashed"]; node[shape="plaintext"];
subgraph {rank=same;
n100000[label="don't"];
n100001[label="know"];
edge[style="invis"];
n100000 -- n100001 ;
}
n9 -- n100000;
n2 -- n100001;
}

BIN
src/_grphp_2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

42
src/_grphp_3.dot Normal file
View File

@@ -0,0 +1,42 @@
graph {
edge[style="solid"]; node[shape="plaintext"];
subgraph {rank=same;
n12[label="PhrUtt : Phr"];
}
subgraph {rank=same;
n10[label="UttImpSg : Utt"];
}
n12 -- n10;
subgraph {rank=same;
n9[label="ImpVP : Imp"];
}
n10 -- n9;
subgraph {rank=same;
n8[label="ComplSlash : VP"];
}
n9 -- n8;
subgraph {rank=same;
n3[label="SlashV2a : VPSlash"];
}
n8 -- n3;
subgraph {rank=same;
n2[label="know_V2 : V2"];
}
n3 -- n2;
edge[style="dashed"]; node[shape="plaintext"];
subgraph {rank=same;
n100000[label="don't"];
n100001[label="know"];
edge[style="invis"];
n100000 -- n100001 ;
}
n9 -- n100000;
n2 -- n100001;
}

BIN
src/_grphp_3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

52
src/_grphp_4.dot Normal file
View File

@@ -0,0 +1,52 @@
graph {
edge[style="solid"]; node[shape="plaintext"];
subgraph {rank=same;
n21[label="PhrUtt : Phr"];
}
subgraph {rank=same;
n19[label="UttQS : Utt"];
}
n21 -- n19;
subgraph {rank=same;
n18[label="UseQCl : QS"];
}
n19 -- n18;
subgraph {rank=same;
n17[label="QuestCl : QCl"];
}
n18 -- n17;
subgraph {rank=same;
n16[label="PredVP : Cl"];
}
n17 -- n16;
subgraph {rank=same;
n15[label="ComplSlash : VP"];
}
n16 -- n15;
subgraph {rank=same;
n10[label="SlashV2a : VPSlash"];
}
n15 -- n10;
subgraph {rank=same;
n9[label="know_V2 : V2"];
}
n10 -- n9;
edge[style="dashed"]; node[shape="plaintext"];
subgraph {rank=same;
n100000[label="don't"];
n100001[label="know"];
edge[style="invis"];
n100000 -- n100001 ;
}
n16 -- n100000;
n9 -- n100001;
}

BIN
src/_grphp_4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

47
src/_grphp_5.dot Normal file
View File

@@ -0,0 +1,47 @@
graph {
edge[style="solid"]; node[shape="plaintext"];
subgraph {rank=same;
n20[label="PhrUtt : Phr"];
}
subgraph {rank=same;
n18[label="UttS : Utt"];
}
n20 -- n18;
subgraph {rank=same;
n17[label="UseCl : S"];
}
n18 -- n17;
subgraph {rank=same;
n16[label="PredVP : Cl"];
}
n17 -- n16;
subgraph {rank=same;
n15[label="ComplSlash : VP"];
}
n16 -- n15;
subgraph {rank=same;
n10[label="SlashV2a : VPSlash"];
}
n15 -- n10;
subgraph {rank=same;
n9[label="know_V2 : V2"];
}
n10 -- n9;
edge[style="dashed"]; node[shape="plaintext"];
subgraph {rank=same;
n100000[label="don't"];
n100001[label="know"];
edge[style="invis"];
n100000 -- n100001 ;
}
n16 -- n100000;
n9 -- n100001;
}

BIN
src/_grphp_5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
src/_grphp_all.pdf Normal file

Binary file not shown.

39
src/_grpht_1.dot Normal file
View File

@@ -0,0 +1,39 @@
graph {
n0[label = "PhrUtt : Phr", style = "solid", shape = "plaintext"] ;
n0_0[label = "NoPConj : PConj", style = "solid", shape = "plaintext"] ;
n0 -- n0_0 [style = "solid"];
n1_0[label = "UttS : Utt", style = "solid", shape = "plaintext"] ;
n0 -- n1_0 [style = "solid"];
n0_1_0[label = "UseCl : S", style = "solid", shape = "plaintext"] ;
n1_0 -- n0_1_0 [style = "solid"];
n0_0_1_0[label = "TTAnt : Temp", style = "solid", shape = "plaintext"] ;
n0_1_0 -- n0_0_1_0 [style = "solid"];
n0_0_0_1_0[label = "TPres : Tense", style = "solid", shape = "plaintext"] ;
n0_0_1_0 -- n0_0_0_1_0 [style = "solid"];
n1_0_0_1_0[label = "ASimul : Ant", style = "solid", shape = "plaintext"] ;
n0_0_1_0 -- n1_0_0_1_0 [style = "solid"];
n1_0_1_0[label = "PNeg : Pol", style = "solid", shape = "plaintext"] ;
n0_1_0 -- n1_0_1_0 [style = "solid"];
n2_0_1_0[label = "PredVP : Cl", style = "solid", shape = "plaintext"] ;
n0_1_0 -- n2_0_1_0 [style = "solid"];
n0_2_0_1_0[label = "UsePron : NP", style = "solid", shape = "plaintext"] ;
n2_0_1_0 -- n0_2_0_1_0 [style = "solid"];
n0_0_2_0_1_0[label = "i_Pron : Pron", style = "solid", shape = "plaintext"] ;
n0_2_0_1_0 -- n0_0_2_0_1_0 [style = "solid"];
n1_2_0_1_0[label = "ComplSlash : VP", style = "solid", shape = "plaintext"] ;
n2_0_1_0 -- n1_2_0_1_0 [style = "solid"];
n0_1_2_0_1_0[label = "SlashV2a : VPSlash", style = "solid", shape = "plaintext"] ;
n1_2_0_1_0 -- n0_1_2_0_1_0 [style = "solid"];
n0_0_1_2_0_1_0[label = "know_V2 : V2", style = "solid", shape = "plaintext"] ;
n0_1_2_0_1_0 -- n0_0_1_2_0_1_0 [style = "solid"];
n1_1_2_0_1_0[label = "DetNP : NP", style = "solid", shape = "plaintext"] ;
n1_2_0_1_0 -- n1_1_2_0_1_0 [style = "solid"];
n0_1_1_2_0_1_0[label = "DetQuant : Det", style = "solid", shape = "plaintext"] ;
n1_1_2_0_1_0 -- n0_1_1_2_0_1_0 [style = "solid"];
n0_0_1_1_2_0_1_0[label = "IndefArt : Quant", style = "solid", shape = "plaintext"] ;
n0_1_1_2_0_1_0 -- n0_0_1_1_2_0_1_0 [style = "solid"];
n1_0_1_1_2_0_1_0[label = "NumPl : Num", style = "solid", shape = "plaintext"] ;
n0_1_1_2_0_1_0 -- n1_0_1_1_2_0_1_0 [style = "solid"];
n2_0[label = "NoVoc : Voc", style = "solid", shape = "plaintext"] ;
n0 -- n2_0 [style = "solid"];
}

BIN
src/_grpht_1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

View File

@@ -35,8 +35,7 @@ concrete CatTok of Cat = CommonX ** open ResTok, Coordination, Prelude in {
--2 Verb phrases --2 Verb phrases
-- Constructed in VerbTok. -- Constructed in VerbTok.
VP = ResTok.LinVP ; VP,VPSlash = ResTok.LinVP ;
VPSlash = SS ;
Comp = SS ; Comp = SS ;
--2 Adjectival phrases --2 Adjectival phrases
@@ -115,7 +114,7 @@ concrete CatTok of Cat = CommonX ** open ResTok, Coordination, Prelude in {
SN = SS ; -- Second name, e.g. "Washington" SN = SS ; -- Second name, e.g. "Washington"
LN = SS ; -- Location name, e.g. "Sweden" LN = SS ; -- Location name, e.g. "Sweden"
linref -- linref
Cl = linCl ; -- Cl = linCl ;
} }

View File

@@ -11,7 +11,7 @@ concrete LexiconTok of Lexicon = CatTok **
lin animal_N = mkN "soweli" ; lin animal_N = mkN "soweli" ;
-- lin answer_V2S = mkV2S (mkV "") ; -- lin answer_V2S = mkV2S (mkV "") ;
lin apartment_N = mkN "tomo" ; lin apartment_N = mkN "tomo" ;
-- lin apple_N = mkN "" ; lin apple_N = mkN "kili" ;
-- lin art_N = mkN "" ; -- lin art_N = mkN "" ;
-- lin ashes_N = mkN "" ; -- lin ashes_N = mkN "" ;
-- lin ask_V2Q = mkV2Q (mkV "") ; -- lin ask_V2Q = mkV2Q (mkV "") ;
@@ -106,7 +106,7 @@ lin dog_N = mkN "soweli" ;
lin ear_N = mkN "kute" ; lin ear_N = mkN "kute" ;
lin earth_N = mkN "ma" ; lin earth_N = mkN "ma" ;
lin eat_V2 = mkV "eat" ; lin eat_V2 = mkV "moku" ;
-- lin egg_N = mkN "" ; -- lin egg_N = mkN "" ;
-- lin empty_A = mkA "" ; -- lin empty_A = mkA "" ;
-- lin enemy_N = mkN "" ; -- lin enemy_N = mkN "" ;
@@ -139,7 +139,7 @@ lin fish_N = mkN "kala" ;
-- lin forget_V2 = mkV2 "" ; -- lin forget_V2 = mkV2 "" ;
-- lin freeze_V = mkV "" ; -- lin freeze_V = mkV "" ;
-- lin fridge_N = mkN "" ; -- lin fridge_N = mkN "" ;
-- lin friend_N = mkN "" ; lin friend_N = mkN "jan pona" ;
lin fruit_N = mkN "kili" ; lin fruit_N = mkN "kili" ;
-- lin full_A = mkA "" ; -- lin full_A = mkA "" ;
-- --lin fun_AV -- --lin fun_AV

View File

@@ -77,6 +77,8 @@ concrete NounTok of Noun = CatTok ** open ResTok, Prelude in {
-- } ; -- } ;
NumSg,NumPljk = ss [] ;
-- Whether the resulting determiner is singular or plural depends on the -- Whether the resulting determiner is singular or plural depends on the
-- cardinal. -- cardinal.

View File

@@ -1,5 +1,5 @@
--# -path=.:../abstract:../common:../prelude --# -path=.:../abstract:../common:../prelude
resource ResTok = open Prelude, Predef in { resource ResTok = open Prelude, Predef, ParamX in {
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- General notes -- General notes
@@ -233,14 +233,14 @@ oper
-- VP -- VP
LinVP : Type = { LinVP : Type = {
s : Str ; s : Polarity => Str ;
} ; } ;
LinVPSlash : Type = LinVP ** { LinVPSlash : Type = LinVP ** {
c2 : LinPrep ; c2 : LinPrep ;
} ; } ;
linVP : LinVP -> Str = \vp -> vp.s ; -- linVP : LinVP -> Str = \vp -> vp.s ;
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- Cl, S -- Cl, S
@@ -248,7 +248,7 @@ oper
-- Operations for clauses, sentences -- Operations for clauses, sentences
LinCl : Type = { LinCl : Type = {
subj : Str ; subj : Str ;
pred : Str ; -- TODO: depend on Temp and Pol pred : Polarity => Str ; -- TODO: depend on Temp and Pol
} ; } ;
-- linCl : LinCl -> Str = \cl -> case cl.subj of { -- linCl : LinCl -> Str = \cl -> case cl.subj of {
@@ -256,7 +256,7 @@ oper
-- _ => cl.subj ++ "li" ++ cl.pred -- _ => cl.subj ++ "li" ++ cl.pred
-- } ; -- } ;
linCl : LinCl -> Str = \cl -> cl.subj ++ cl.pred ; -- linCl : LinCl -> Str = \cl -> cl.subj ++ cl.pred ;
-- Preverb, VV -- Preverb, VV

View File

@@ -11,9 +11,9 @@ 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 = case np.li of { pred = \\pol => case np.li of {
MiSina => vp.s ; MiSina => vp.s ! pol ;
NotMiSina => "li" ++ vp.s NotMiSina => "li" ++ vp.s ! pol
} ; } ;
} ; } ;
@@ -49,7 +49,7 @@ lin
-- : Temp -> Pol -> Cl -> S ; -- : Temp -> Pol -> Cl -> S ;
UseCl t p cl = { UseCl t p cl = {
s = cl.subj ++ t.s ++ p.s ++ cl.pred -- ! t.t ! p.p -- eventually s = cl.subj ++ t.s ++ p.s ++ cl.pred ! p.p
} ; } ;
{- {-
-- : Temp -> Pol -> QCl -> QS ; -- : Temp -> Pol -> QCl -> QS ;

View File

@@ -1,4 +1,4 @@
concrete VerbTok of Verb = CatTok ** open ResTok, AdverbTok, Prelude in { concrete VerbTok of Verb = CatTok ** open ResTok, AdverbTok, Prelude, ParamX in {
lin lin
@@ -8,7 +8,12 @@ lin
-- : V -> VP -- : V -> VP
-- NB. assumes that lincat V = lincat VP -- NB. assumes that lincat V = lincat VP
-- This will most likely change when you start working with VPs -- This will most likely change when you start working with VPs
UseV v = v ; UseV v = {
s = table {
Pos => v.s ;
Neg => v.s ++ "ala"
} ;
} ;
-- : V2 -> VP ; -- : V2 -> VP ;
-- PassV2 v2 = -- PassV2 v2 =
@@ -17,7 +22,7 @@ lin
ReflVP vps = vps ; ReflVP vps = vps ;
-- : VV -> VP -> VP ; -- : VV -> VP -> VP ;
ComplVV vv vp = { s = vv.s ++ vp.s ;} ; ComplVV vv vp = { s = \\p => vv.s ++ vp.s ! p ;} ;
{- {-
-- : VS -> S -> VP ; -- : VS -> S -> VP ;
@@ -35,7 +40,12 @@ lin
-------- --------
-- Slash -- Slash
-- : V2 -> VPSlash -- : V2 -> VPSlash
SlashV2a v2 = v2 ; SlashV2a = \v2 -> {
s = table {
Pos => v2.s ;
Neg => v2.s ++ "ala"
} ;
} ;
-- : V3 -> NP -> VPSlash ; -- give it (to her) -- : V3 -> NP -> VPSlash ; -- give it (to her)
-- Slash2V3 v3 dobj = -- Slash2V3 v3 dobj =
@@ -60,11 +70,12 @@ lin
-- : VPSlash -> NP -> VP -- : VPSlash -> NP -> VP
-- Often VPSlash has a field called c2, which is used to pick right form of np complement -- Often VPSlash has a field called c2, which is used to pick right form of np complement
ComplSlash vps np = ss (vps.s ++ "e" ++ np.s) ; ComplSlash vps np = {
s = \\p => vps.s ! p ++ "e" ++ np.s
} ;
-- : VV -> VPSlash -> VPSlash ; -- : VV -> VPSlash -> VPSlash ;
-- SlashVV vv vps = ComplVV vv vps ** { SlashVV vv vps = ComplVV vv vps;
-- } ;
-- : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy -- : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy
-- SlashV2VNP v2v np vps = -- SlashV2VNP v2v np vps =