Closed ramji-c closed 3 years ago
Thanks for investigating the cause of the bug and even proposing a fix. As I understand it, we can just set unroll=True
regardless of the templates
type, so I did that in 3fff9ea. Please let me know if you think this breaks anything.
We check the data type inside editor.template
, and only unroll if it's in [list, np.array, np.ndarray, tuple]
Thank you @marcotcr for a quick fix. I tested it and is working fine 👍
editor.synonyms()
callseditor._wordnet_stuff()
which in-turn invokeseditor.template()
before checking if the argword
is present all the strings passed intemplates
arg. However,template()
function expects anunroll
argument to beTrue
in order for atemplates
list to be properly unrolled. However,synonyms()
doesn't check the type oftemplates
arg passed to it and subsequently doesn't pass-along anunroll
arg to thetemplate()
function. This results in the following erroras the list of templates is wrapped inside another list, causing the check in line no. 347 to fail.
Steps to reproduce: I wrote this small snippet that recreates this error
A simple fix would be check the
templates
arg type in eithersynonyms()
or_wordnet_stuff()
and automatically setunroll=True
if type is list or tuple. I have a working change and can submit a PR if desired.