summaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorPatrick Simianer <patrick@lilt.com>2026-02-24 17:07:57 +0100
committerPatrick Simianer <patrick@lilt.com>2026-02-24 17:07:57 +0100
commit77666a09c0f82b231605da463a946a5a5fcd09b6 (patch)
tree44d0e96bac774b491290b548358b65176f5dec94 /example
parentc13b5650ac4bee7e674d263fcb778599bb449bff (diff)
Fix reordering bug in derive and add test example
derive used a sequential counter to index into the source-side NT map, which only worked for monotone rules. Now looks up tails by the target NT's own index via map.index(i.index). Adds toy-reorder example (German verb-final -> English SVO) to exercise the fix. Also updates trollop -> optimist and guards xmlsimple require. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'example')
-rw-r--r--example/toy-reorder/grammar6
-rw-r--r--example/toy-reorder/in1
-rw-r--r--example/toy-reorder/weights.toy1
3 files changed, 8 insertions, 0 deletions
diff --git a/example/toy-reorder/grammar b/example/toy-reorder/grammar
new file mode 100644
index 0000000..d93d98c
--- /dev/null
+++ b/example/toy-reorder/grammar
@@ -0,0 +1,6 @@
+[S] ||| [NP,1] [VP,2] ||| [NP,1] [VP,2] ||| logp=0
+[NP] ||| er ||| he ||| logp=-0.5
+[NP] ||| das [NN,1] ||| the [NN,1] ||| logp=0
+[NN] ||| buch ||| book ||| logp=0
+[VP] ||| [NP,1] [V,2] ||| [V,2] [NP,1] ||| logp=0
+[V] ||| liest ||| reads ||| logp=-0.25
diff --git a/example/toy-reorder/in b/example/toy-reorder/in
new file mode 100644
index 0000000..6eeb3a9
--- /dev/null
+++ b/example/toy-reorder/in
@@ -0,0 +1 @@
+er das buch liest
diff --git a/example/toy-reorder/weights.toy b/example/toy-reorder/weights.toy
new file mode 100644
index 0000000..3eb2502
--- /dev/null
+++ b/example/toy-reorder/weights.toy
@@ -0,0 +1 @@
+logp 2