From 98354be150f91b22f330e9c668914f3f6a6a2206 Mon Sep 17 00:00:00 2001 From: ines Date: Mon, 15 May 2017 13:39:47 +0200 Subject: [PATCH] Only get user_data if it exists on doc --- spacy/displacy/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spacy/displacy/__init__.py b/spacy/displacy/__init__.py index 427097369..45671612f 100644 --- a/spacy/displacy/__init__.py +++ b/spacy/displacy/__init__.py @@ -99,5 +99,5 @@ def parse_ents(doc, options={}): """ ents = [{'start': ent.start_char, 'end': ent.end_char, 'label': ent.label_} for ent in doc.ents] - title = doc.user_data.get('title', None) + title = doc.user_data.get('title', None) if hasattr(doc, 'user_data') else None return {'text': doc.text, 'ents': ents, 'title': title}