From d53f0afaca813a4d80e39c083a40dd3af6032c3d Mon Sep 17 00:00:00 2001 From: Tan Long Date: Fri, 14 Apr 2023 21:05:48 +0800 Subject: [PATCH] perf(REL_OP): Replace some token.children with token.rights or token.lefts --- spacy/matcher/dependencymatcher.pyx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spacy/matcher/dependencymatcher.pyx b/spacy/matcher/dependencymatcher.pyx index adf96702b..48fb3eb2a 100644 --- a/spacy/matcher/dependencymatcher.pyx +++ b/spacy/matcher/dependencymatcher.pyx @@ -432,22 +432,22 @@ cdef class DependencyMatcher: return [doc[child.i] for child in doc[node].head.children if child.i < node] def _imm_right_child(self, doc, node): - for child in doc[node].children: + for child in doc[node].rights: if child.i == node + 1: return [doc[child.i]] return [] def _imm_left_child(self, doc, node): - for child in doc[node].children: + for child in doc[node].lefts: if child.i == node - 1: return [doc[child.i]] return [] def _right_child(self, doc, node): - return [doc[child.i] for child in doc[node].children if child.i > node] + return [child for child in doc[node].rights] def _left_child(self, doc, node): - return [doc[child.i] for child in doc[node].children if child.i < node] + return [child for child in doc[node].lefts] def _imm_right_parent(self, doc, node): if doc[node].head.i == node + 1: