From 688613878f3b5888213ebef7eb9cbbdf5cc015d6 Mon Sep 17 00:00:00 2001 From: Codex Bot Date: Wed, 4 Nov 2026 16:40:13 +0800 Subject: [PATCH] Handle standalone past verbs tagged as participles --- syntax_dag.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/syntax_dag.py b/syntax_dag.py index 927b92a..c429063 100644 --- a/syntax_dag.py +++ b/syntax_dag.py @@ -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)