Make highlighted entities clickable in visualization - #490
Open
UditDewan wants to merge 3 commits into
Open
Conversation
Clicking a highlighted entity in the HTML visualization now selects it, updating the attributes panel, slider, and position info, which makes reviewing extractions on longer documents much faster than stepping through them sequentially. Adds a pointer cursor on highlights to signal clickability. Fixes google#103
|
Your branch is 1 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 1 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 1 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Clicking a highlighted entity in the HTML visualization now jumps the selector to that extraction — updating the attributes panel, progress slider, entity counter, and position info. This makes reviewing extractions on longer documents much faster than stepping through them one at a time with Previous/Next.
Implements the suggestion from the linked issue:
cursor: pointerto.lx-highlightso highlights signal they are clickable..lx-highlightspan (viaclosest(), so nested spans work) and calls the existingjumpToExtraction().Fixes #103
Feature
How Has This Been Tested?
Added
test_visualize_highlights_are_clickabletotests/visualization_test.pyverifying the generated HTML wires up the click handler and pointer cursor.Also exercised the generated HTML in a DOM environment (jsdom): clicking a highlight selects that entity (attributes panel, slider, entity counter, and position info all update, and the
lx-current-highlightmarker moves), clicking the first entity (data-idx="0") works, and clicks on non-highlighted text are a no-op. Play/Previous/Next behavior is unchanged.Checklist:
Code of conduct.
Contributing
page, and I either signed the Google
Individual CLA
or am covered by my company's
Corporate CLA.
issue(s) and we have agreed upon the general approach.
issue(s) that documentation elsewhere needs updating.
Google's Python Style Guide
and ran
pylintover the affected code.