From a82c3153ada16aeb9a3e34b9400084d1b5c3d546 Mon Sep 17 00:00:00 2001 From: kleinay Date: Wed, 4 Jul 2018 15:12:08 +0300 Subject: [PATCH] fix issue #2452 - displacy arrow direction is always forward (#2506) (closes #2452) Referring #2452, fixing displacy arrow directions to match the input. ## Description The fix is simply replacing `direction is 'left'` with `direction == 'left'` to include the case `direction` is a `str` and not a `unicode`. ### Types of change bug fix ## Checklist - [ ] I have submitted the spaCy Contributor Agreement. - [ ] I ran the tests, and all new and existing tests passed. - [x] My changes don't require a change to the documentation, or if they do, I've added all required information. --- spacy/displacy/render.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spacy/displacy/render.py b/spacy/displacy/render.py index fa84bf87d..f5c06d06b 100644 --- a/spacy/displacy/render.py +++ b/spacy/displacy/render.py @@ -136,7 +136,7 @@ class DependencyRenderer(object): end (int): X-coordinate of arrow end point. RETURNS (unicode): Definition of the arrow head path ('d' attribute). """ - if direction is 'left': + if direction == 'left': pos1, pos2, pos3 = (x, x-self.arrow_width+2, x+self.arrow_width-2) else: pos1, pos2, pos3 = (end, end+self.arrow_width-2,