bskinn / sphobjinv

Toolkit for manipulation and inspection of Sphinx objects.inv files
https://sphobjinv.readthedocs.io
MIT License
81 stars 9 forks source link

Add suggest CLI arg indicating the desired max number of results to return #145

Open bskinn opened 4 years ago

bskinn commented 4 years ago

Alternative to juggling --thresh.

Probably should also be added to Inventory.suggest itself.

bskinn commented 2 years ago

Flagging maybe since this could well be YAGNI, and removing from v2.3 milestone since it's unclear how much effort it would take to integrate this into .suggest().

One option for implementing would just be to run with a threshold of zero, and then do statistical stuff on the results to pull out the desired number of results. It could also, as noted, be embedded as an option within .suggest().

A big problem with this idea is in the case of large inventories and the current fuzzywuzzy scoring. The diff-matching algorithm really does not do a great job of distinguishing score-numerically between similar but different objects, and so capping to a certain number of results may end up arbitrarily discarding the portion of a group of results that happens to contain the result the user is looking for --- without a better matching algorithm, it's just plain dicey.

Once #207 is (eventually...) implemented, and a (putative) ecosystem of scoring plugins starts to grow, the need for this feature may become more acute.

For now.... shelf.