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

[Feature Request] Exact phrase highlight #74

Open
vatterspun opened this issue Dec 11, 2022 · 9 comments
Open

[Feature Request] Exact phrase highlight #74

vatterspun opened this issue Dec 11, 2022 · 9 comments
Labels
enhancement New feature or request plugin Will be actioned in a separate 'plugin' add-on

Comments

@vatterspun
Copy link

vatterspun commented Dec 11, 2022

Sidenote: I know you've asked me for some more info on some other issues I've posted, I'll try to get to those soon.


Current Behavior

If a phrase is entered into the search it will highlight those terms as they appear throughout the document. If they appear exactly as entered in search, they are just listed as individual highlights.

Background

One of my experiences when I've been using Mark My Search is that I get a LOT of results. I already came up with a possible way to address this in issue #65 . As I tend to overdo the search terms, one way to surface the most important item on a page is when the specific term (and the way I typed it in) shows up.

Requested Behavior

When that exact phrase shows up, requesting the program highlight it as a solid block. Maybe with an underline or outline to further separate it from other word highlights on the page.

This might make more sense as an optional feature, since most search programs don't behave that way and it might confuse some users.

Also, for simplicity, should probably ignore this feature/option if there were any " characters in the search, since it's probably already an "exact phrase" search.

MOCKUP

So when searching:

clock strikes 12

... in the image below shows current behavior in #1 and #3. Requested behavior is #2

image

@ator-dev
Copy link
Member

ator-dev commented Dec 11, 2022

To add my own sidenote, thank you for all the ideas, and don't worry about providing info! I am very happy to think about features and how they might connect on my own.


Firstly, I think this is a good idea which is worth looking into. As you said it links to #65 nicely, since they are both ways (as I see it) to reduce visual complexity and increase clarity where many keywords are appearing; you can more quickly find areas of more relevance to your search.

I am a generalisation fanatic, and I can think of a few ways this might be made less specific in order to work for more use cases. I prefer not to let the order or even content of keywords matter to the algorithms using them, and details such as whether or not they originated from a "search" (e.g. on DuckDuckGo) are completely abstracted. Perhaps such groups could be determined simply by where words next to each other are highlighted, such as clock 12 strikes or strikes strikes? I feel like this will be simpler and more useful in many cases, but feel free to give your opinion on this.

I hot-patched this into my working version of Mark My Search 2:

'Alphabet Test' without grouping
image

'Alphabet Test' with grouping
image

Normal operation with grouping

image

image

Most likely, this would normally activate when highlights have either no gap or a gap of only whitespace. This would benefit from being more visible as well of course, so when experimenting I would try out different types of borders and/or backgrounds.

@ator-dev
Copy link
Member

ator-dev commented Dec 11, 2022

Note: the Alphabet Test is currently my favourite stress test for MMS, in which I highlight every letter in the alphabet. If it looks horrendous it's meant to, but I would love to see a method that manages to clean even it up. Unrelated, but while MMS 1 is slowed to a janky crawl under the test, MMS 2 works with almost no stutter or slowdown.

@ator-dev ator-dev added the enhancement New feature or request label Dec 11, 2022
@ator-dev
Copy link
Member

ator-dev commented Dec 11, 2022

By the way, you have accidentally pulled in some issues with #1 etc, could you surround them with ` to avoid confusion please? No worries though (:

@vatterspun
Copy link
Author

... could you surround them with ` to avoid confusion please?

Sure thing -- all set.

Unrelated, but while MMS 1 is slowed to a janky crawl under the test, MMS 2 works with almost no stutter or slowdown.

Yeah that seems one of those most unappreciated of all developer tasks: improving speed and nobody sees it :) Either way I'm very glad to have it.

@ator-dev
Copy link
Member

Yeah that seems one of those most unappreciated of all developer tasks: improving speed and nobody sees it :)

This is very true, thank you for appreciating it (:

I don't mind too much with MMS because I find it very satisfying to see a whole page filled with colour but running smoothly. Sadly Firefox doesn't support the API needed for version 2, so the new algorithm is slowed down and will probably be disabled by default even when v2 releases. I'll let you know when the situation changes!

@vatterspun
Copy link
Author

vatterspun commented Dec 12, 2022

Perhaps such groups could be determined simply by where words next to each other are highlighted, such as clock 12 strikes or strikes strikes?

Grouping similar terms that appear together does sound like an interesting feature and I'd be interested to have that available.

A few quick thoughts on this:

Use case for enabling this feature:

Research - when digging around on pages seeing words grouped together would save time and effort to gather ideas and pull you in directions. Looking at 27 documents for some mention of "blue laser" or similar reference would be greatly improved by something like this.

Use case for leaving this feature off:

A word repetition check. It's a very narrow group (I don't know anyone else who does this) but it's something I do to highlight each instance of a word with a specific color. Its something that helps me catch word duplication within a document. It's often unconscious but people do it all the time and it hurts readability moreso than long sentences or word complexity.

Anyway, I can walk through my process of gathering common words and searching for them, but in essence having each word with a separate color is crucial for this kind of check. Similar colors jump out at you and similar words being used over and over again sticks out like a bright neon sign.


Anyway, that's just an aside. More to the point I think that suggestion is a good a answer to the "exact phrase" prompt. Thanks!

@ator-dev
Copy link
Member

Sounds good, and I'm glad you like the idea! Context is definitely important, often more than individual words, and grouping should add another layer of understanding. I think it won't impact word repetition checks luckily - that's another use case I never thought of by the way, which is always interesting to me.

@ator-dev
Copy link
Member

Quick note: if you search using " (e.g. "everything everything" band), all enclosed words translate to a single keyword/phrase, which is useful as that's often what you want (and may help while waiting for this feature).

@ator-dev ator-dev added the review Needs further consideration label Mar 8, 2023
@ator-dev
Copy link
Member

ator-dev commented Mar 9, 2023

Considering the great complexity and nuance of this task, and the fact that it is a very specialised operation, this will only be implemented as a 'plug-in' add-on for MMS: an add-on that communicates with MMS but presents its own interface. The plug-in will be named along the lines of 'research tools for MMS', and will contain multiple related features.

Current plan as outlined in this issue:

UI

  • Popup, page 1
    • Sidebar containing keywords of the current tab
    • 2 areas into which you can drag the keywords (hopefully with a keyboard alternative e.g. number aliases), forming 2 lists of keyword groups
  • Popup, page 2
    • Exact-phrase and keywords-in-flow matches found in the tab are listed in order, each match providing a little in-page context and being clickable to jump to that point
    • Matches are fetched for the current tab every time this page of the popup is opened

Highlighting

  • Exact-phrase matches are not planned to affect style, since this would introduce too much complexity for little gain
  • Keywords-in-flow matches will cause entire flow containers to be picked out, with backgrounds based on the colours of the included phrases

Options

  • Show exact-phrase area, default on
  • Show keywords-in-flow area, default on
  • Fetch special keyword matches dynamically (as the page changes OR at regular intervals if infeasible), default off
  • Count exact-phrase matches as keywords-in-flow matches in special highlighting

Edit 2023-04-01: Still planned, but for-plugin implies being actioned. I will be able to start work on these in approximately 3 months.

@ator-dev ator-dev added planned Will be actioned plugin Will be actioned in a separate 'plugin' add-on and removed review Needs further consideration labels Mar 9, 2023
@ator-dev ator-dev removed the planned Will be actioned label Apr 1, 2023
@ator-dev ator-dev moved this to Todo in Plugin Roadmap Apr 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request plugin Will be actioned in a separate 'plugin' add-on
Projects
Status: Concept
Development

No branches or pull requests

2 participants