fiffu / arisa2

Very soft Discord bot
5 stars 5 forks source link

DigestDict key match should order by key length #18

Closed fiffu closed 4 years ago

fiffu commented 4 years ago

Currently lookup algo for DigestDict goes by Python's sorted() using [A-Za-z]. This leads to cases where a substring like "Angelic" resolves to "Angelic Montmorancy" rather than "Angelica" which would be the preferred behaviour.

This should be resolved by iterating the candidate keys in DigestDict ordered primarily by length.

fiffu commented 4 years ago

Fixed in 88a40c6