Skip to content

How to get a score of 100 #160

Description

@samayala22

Hey Max,

First off, thanks for creating/maintaining this awesome library !

I've been trying to find a way to get a score of 100 when comparing the strings 'simplee worde' and 'very simple big word'. Knowing that that:

>>> fuzz.partial_ratio('simplee','simple')
100.0
>>> fuzz.partial_ratio('worde','word')
100.0

By reading the docs, I thought that partial_token_set_ratio would work but it didn't.

>>> fuzz.partial_token_set_ratio('simplee worde','very simple big word')
69.23076923076923

I assume that's because there are no perfectly similar words between both ? (if i put simple instead of simplee it gives me 100)

Also, I found out that by adding letters after the worde increased the score to a cap of 75.00 but adding the letters to the end of the word simplee made the score drop to a lower limit of 55.17.

>>> fuzz.partial_token_ratio('simpleeadassdsdl worde','very simple big word')
55.172413793103445
>>> fuzz.partial_token_set_ratio('simplee wordeeaaasasdasd','very simple big word')
75.0

In case you're wondering, the other fuzz modules performed worse.

This is some strange behaviour that I don't understand because I don't know the underlying algorithms you're using.

Maybe you can shed some light here, and tell why, in this case, it's not possible to get a score of 100.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions