You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calling the function "apply_encoding_options" using Python3 raise following error:
AttributeError: 'filter' object has no attribute 'sort'
Reason:
Following two line cause the issue: token_counts = filter(lambda x: x[1] >= min_token_count, token_counts) token_counts.sort(key=lambda x: x[1], reverse=True)
In python 3 filter function return object filter
In python 2.7 filter function return list (the code working correctly here)
Suggested Solution:
Edit function 'apply_encoding_options' inside 'processing.py' to order and filter without using filter object as following: token_counts = sorted((x for x in token_counts if x[1] >= min_token_count), reverse=True, key=lambda x: x[1])
The text was updated successfully, but these errors were encountered:
Calling the function "apply_encoding_options" using Python3 raise following error:
Reason:
Following two line cause the issue:
token_counts = filter(lambda x: x[1] >= min_token_count, token_counts) token_counts.sort(key=lambda x: x[1], reverse=True)
In python 3 filter function return object filter
In python 2.7 filter function return list (the code working correctly here)
Suggested Solution:
Edit function 'apply_encoding_options' inside 'processing.py' to order and filter without using filter object as following:
token_counts = sorted((x for x in token_counts if x[1] >= min_token_count), reverse=True, key=lambda x: x[1])
The text was updated successfully, but these errors were encountered: