From 6d3caeadd21e0953d42b6ad9201796312cb6ad93 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sun, 28 May 2017 23:22:45 +0200 Subject: [PATCH] Fix type check for long --- spacy/tokens/doc.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spacy/tokens/doc.pyx b/spacy/tokens/doc.pyx index 51e61507e..0d5545a58 100644 --- a/spacy/tokens/doc.pyx +++ b/spacy/tokens/doc.pyx @@ -684,10 +684,10 @@ cdef class Doc: attributes[ENT_TYPE] = ent_type elif not args: if "label" in attributes and 'ent_type' not in attributes: - if type(attributes["label"]) == int: + if isinstance(attributes["label"], int): attributes[ENT_TYPE] = attributes["label"] else: - attributes[ENT_TYPE] = self.vocab.strings.add(attributes["label"]) + attributes[ENT_TYPE] = self.vocab.strings[attributes["label"]) if 'ent_type' in attributes: attributes[ENT_TYPE] = attributes['ent_type'] elif args: