From eb0798c421a9dccb1910ba40e7e0e61c46420689 Mon Sep 17 00:00:00 2001 From: Matthw Honnibal Date: Thu, 9 Jul 2020 14:38:26 +0200 Subject: [PATCH] Add __len__ method for Example --- spacy/gold/example.pyx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spacy/gold/example.pyx b/spacy/gold/example.pyx index f5b9f0eeb..09bc95bff 100644 --- a/spacy/gold/example.pyx +++ b/spacy/gold/example.pyx @@ -36,6 +36,9 @@ cdef class Example: self.y = reference self._alignment = alignment + def __len__(self): + return len(self.predicted) + property predicted: def __get__(self): return self.x