Prototype causal rewriting with a syntax DAG #1

Merged
Zayden-Jung merged 5 commits from codex/syntax-dag into main 2026-11-04 08:42:04 +00:00
Showing only changes of commit 688613878f - Show all commits
+5 -1
View File
@@ -80,6 +80,10 @@ class Encoder:
clauses = []
proposals = []
for sentence in doc.sents:
content = [token.i for token in sentence if not token.is_space]
if not content:
continue
sentence = doc[content[0]:content[-1] + 1]
match = self._causal_marker(sentence)
if match is None:
continue
@@ -112,7 +116,7 @@ class Encoder:
or not marker.i < verb.i < end
or sentence.root.pos_ != "VERB"
or verb.pos_ != "VERB"
or sentence.root.tag_ != "VBD"
or sentence.root.tag_ not in {"VBD", "VBN"}
or verb.tag_ != "VBD"
or any(token.is_punct or token.is_space for token in sentence[:-1])
or any(token.dep_ in {"neg", "aux", "conj"} for token in sentence)