eldar icon indicating copy to clipboard operation
eldar copied to clipboard

match_word unable to handle multi-words and short words

Open Shaun-Tan-DJ opened this issue 6 months ago • 0 comments

Hi,

There is an issue with the match_word arg. If match_word=True, it will not be able to handle multi-words, but able to handle short words.

import eldar
eldar_query = eldar.Query('cake shop', match_word=True)
print(eldar_query('cake shop'))
# False, this is incorrect as it should match
import eldar
eldar_query = eldar.Query('cn', match_word=True)
print(eldar_query('cny'))
# False, this is correct

But if match_word=False, it will not be able to handle short words, but able to handle multi-words.

import eldar
eldar_query = eldar.Query('cake shop', match_word=False)
print(eldar_query('cake shop'))
# True, this is correct
import eldar
eldar_query = eldar.Query('cn', match_word=False)
print(eldar_query('cny'))
# True, this is incorrect as it should not match

I've tried testing with quotation marks and wildcards around multi-words, but it still does not work.

import eldar
eldar_query = eldar.Query('"cake shop"', match_word=True)
print(eldar_query('cake shop'))
# False, this is incorrect as it should not match

eldar_query = eldar.Query('cake*shop', match_word=True)
print(eldar_query('cake shop'))
# False, this is incorrect as it should not match

eldar_query = eldar.Query('"cake*shop"', match_word=True)
print(eldar_query('cake shop'))
# False, this is incorrect as it should not match

Shaun-Tan-DJ avatar Aug 06 '24 01:08 Shaun-Tan-DJ