JasonKessler / scattertext

Beautiful visualizations of how language differs among document types.
Apache License 2.0
2.23k stars 287 forks source link

How to filter out category using search term ? #74

Closed Kavan72 closed 3 years ago

Kavan72 commented 3 years ago

Hey @JasonKessler

how could we improve the library so that when a user is searching for a specific term, then the categories not containing the word would be removed from the graph and from the listing beneath the graph?

we want basically to enhance it so that the user has a filter in and filter out possibility which would be automatically reflected in the graph.

My Environment

JasonKessler commented 3 years ago

Could you please include a screenshot of the issue and a mock-up of what you'd like to see?

ursachi commented 3 years ago

Hi Jason, it is not an issue per se, but an enhancement we would like to do. That is when someone is searching for a term, all categories not including that term should be not shown. Moreover the words belonging to the excluded categories but that are not in the remaining categories should be removed from the graph. See image below

image

The idea is that we want to help user visualize better what categories and sub-categories match to words or texts input by them and have the possibility to filter out while they understand better the context.

JasonKessler commented 3 years ago

If I understand the request, correct, you'd want to the system to eliminate document categories (i.e., the political parties above) and topics (the general inquirer categories in your example) which don't contain it?

That sounds interesting, but it's not something I have the bandwidth to do.

If you'd like the feature implemented, I'd encourage you to modify main.js which is where the relevant javascript is. I'd be happy to help integrate those additions into Scattertext.

ursachi commented 3 years ago

yes, the idea was to know where to do it, and we may give it a try