Has there been a change in the way lambda functions work between Python 2 and 3? I ran the code in python 2 and it works fine, but fails in Python 3 which I am trying to port my code into in order take advantage of a 3rd party module.
pos_io_tagged = map(lambda ((word, pos_tag), io_tag):
(word, pos_tag, io_tag), zip(zip(words, pos_tags), io_tags))
I have researched multiple questions on Stackoverflow and read a couple of articles such as this but still can't find the answer. Is there any resources that I can view?
Your problem is that you are using parentheses ()
with your lambda expression, which will confuse it. Try the following:
pos_io_tagged = map(lambda word, pos_tag, io_tag:
(word, pos_tag, io_tag), zip(zip(words, pos_tags), io_tags))
Look here for more information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With