Skip to content

Commit 39ea09c

Browse files
Copilotwannaphong
andcommitted
Fix ValueError in dependency parsing by handling variable-length field tuples
Co-authored-by: wannaphong <8536487+wannaphong@users.noreply.github.com>
1 parent d35cd90 commit 39ea09c

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

spacy_pythainlp/core.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,9 @@ def _dep(self, doc:Doc):
164164
offset = 0
165165
_dep_temp = dependency_parsing(text, model=self.dependency_parsing_model, engine=self.dependency_parsing_engine, tag="list")
166166
for i in _dep_temp:
167-
idx, word, _, postag, _, _, head, dep, _, space = i
167+
# Handle variable number of fields returned by dependency_parsing
168+
# Only unpack the first 10 fields we need (CoNLL-U format)
169+
idx, word, _, postag, _, _, head, dep, _, space = i[:10]
168170
words.append(word)
169171
pos.append(postag)
170172
heads.append(int(head))

0 commit comments

Comments
 (0)