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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: Support negative weights #10

Open
mod20388 opened this issue Nov 20, 2023 · 5 comments
Open

Request: Support negative weights #10

mod20388 opened this issue Nov 20, 2023 · 5 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@mod20388
Copy link
Contributor

Right now only positive values are supported by the filter. This is a request to support also negative values. The use case for this is filtering out keywords, authors, etc. that the user is not interested in.

@deragent deragent self-assigned this Nov 20, 2023
@deragent deragent added this to the V0.4.0 milestone Nov 20, 2023
@deragent deragent added the enhancement New feature or request label Nov 20, 2023
@deragent
Copy link
Owner

Hi,
I think this use case is very interesting, even though I did not use it so far.

But, the current implementation does not really distinguish the weights based on positive or negative values, and setting negative weights should already work.

I tried this quickly, and indeed, setting a negative value will lead to a lower score.
Also, if the total score goes below 0, the corresponding entry will not be shown in the top list, but in the bottom "Other Entries" list, as one might expect.

Can you please test this, and tell me how else you would like this feature to behave?

@mod20388
Copy link
Contributor Author

Yes, the negative scores seem to be taken into account but it is a bit funky. Consider the following two cases:

  • Say you give keyword A a score of 2 and keyword B a score of -20. Then suppose you have an article that both keywords in the abstract but only keyword A in the title. Then the overall score will be 2.
  • Now say that you have a "good" keyword with a score of 2 again and a "bad" author with score -20. Then an article by the bad author will get overall score 2 if it has the good keyword in the abstract (or even 4 if it is both in the abstract and the title).

This makes it hard to filter out uninteresting articles.

@mod20388
Copy link
Contributor Author

I think the simplest solution is removing the positive score checks in the score computation in filter.py. This then allows negative scores to add up. Unless there is a rationale for insisting in positive scores for each key?

@deragent
Copy link
Owner

You are completely right.

I hove overlooked, that the threshold score > 0 is applied on a per category basis and not overall.

I agree, negative scores should add up, I will implement this.
I will also work out, how to highlight the matched terms properly in this case.

@mod20388
Copy link
Contributor Author

I have fiddled with this locally and it seems to be working fine. I'm going to create a PR with what I have.

I wonder if there are any UI changes that should go along with this? As you already mentioned highlighted text makes sense. Perhaps the articles in the "Other Entries" should also be sorted by (negative) score?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants