Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

'list' object has no attribute 'items' #327

Open
syfulin opened this issue Nov 7, 2021 · 0 comments
Open

'list' object has no attribute 'items' #327

syfulin opened this issue Nov 7, 2021 · 0 comments

Comments

@syfulin
Copy link

syfulin commented Nov 7, 2021

When trying to get the data of such a string 'hello 饾檸饾檲饾檲 world' using token_set_ratio(), no problems arise, but there is an error when calling process.extract().

If you remove the incomprehensible characters "SMM" from the line, then there is no error

Example:

strtest = 'hello 饾檸饾檲饾檲 world'
stroka = "word"
print(str(fuzz.token_set_ratio(stroka, strtest))) # OK
for message in process.extract(stroka, [strtest, 'sss'], limit=1): # ERROR
    pass

Error:

Traceback (most recent call last):
  File "C:\Users\Alexey\AppData\Local\Programs\Python\Python39\lib\site-packages\fuzzywuzzy\process.py", line 108, in extractWithoutOrder
    for key, choice in choices.items():
AttributeError: 'list' object has no attribute 'items'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Alexey\Documents\fuzzywuzzy\index.py", line 191, in <module>
    for message in process.extract(stroka, [strtest, 'sss'], limit=1): # ERROR
  File "C:\Users\Alexey\AppData\Local\Programs\Python\Python39\lib\site-packages\fuzzywuzzy\process.py", line 168, in extract
    return heapq.nlargest(limit, sl, key=lambda i: i[1]) if limit is not None else \
  File "C:\Users\Alexey\AppData\Local\Programs\Python\Python39\lib\heapq.py", line 531, in nlargest
    result = max(it, default=sentinel, key=key)
  File "C:\Users\Alexey\AppData\Local\Programs\Python\Python39\lib\site-packages\fuzzywuzzy\process.py", line 117, in extractWithoutOrder
    score = scorer(processed_query, processed)
  File "C:\Users\Alexey\AppData\Local\Programs\Python\Python39\lib\site-packages\fuzzywuzzy\fuzz.py", line 288, in WRatio
    partial = partial_ratio(p1, p2) * partial_scale
  File "C:\Users\Alexey\AppData\Local\Programs\Python\Python39\lib\site-packages\fuzzywuzzy\utils.py", line 38, in decorator
    return func(*args, **kwargs)
  File "C:\Users\Alexey\AppData\Local\Programs\Python\Python39\lib\site-packages\fuzzywuzzy\utils.py", line 29, in decorator
    return func(*args, **kwargs)
  File "C:\Users\Alexey\AppData\Local\Programs\Python\Python39\lib\site-packages\fuzzywuzzy\utils.py", line 47, in decorator
    return func(*args, **kwargs)
  File "C:\Users\Alexey\AppData\Local\Programs\Python\Python39\lib\site-packages\fuzzywuzzy\fuzz.py", line 47, in partial_ratio
    blocks = m.get_matching_blocks()
  File "C:\Users\Alexey\AppData\Local\Programs\Python\Python39\lib\site-packages\fuzzywuzzy\StringMatcher.py", line 58, in get_matching_blocks
    self._matching_blocks = matching_blocks(self.get_opcodes(),
ValueError: apply_edit edit operations are invalid or inapplicable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant