opensanctions / opensanctions/poliloom
Filter hidden elements in text extraction to match browser visibility behavior
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 22
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
Problem
Currently, our text extraction from Wikipedia and other websites includes hidden elements that browsers don't render. This causes issues with proof line matching between extracted text and what users see in the GUI.
Example issue: Wikipedia infoboxes contain hidden spans like <span style="display:none">(1977-08-21)</span> that appear in our extracted text but are invisible in browsers.
Current Behavior
Our enrichment pipeline extracts text using:
soup = BeautifulSoup(html_content, "html.parser")
text = soup.get_text()
This includes ALL text content, including hidden elements.
Expected Behavior
Text extraction should match what browsers display, excluding:
- Elements with
display: none - Elements with
visibility: hidden - Elements with
hiddenattribute - Script/style/noscript tags (already excluded by GUI highlighter)
GUI Highlighting Logic Reference
Our text highlighter at /poliloom-gui/src/lib/textHighlighter.ts:34-41 already excludes SCRIPT, STYLE, and NOSCRIPT elements but doesn't handle CSS-hidden elements.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the enrichment pipeline code containing the shown BeautifulSoup text extraction, then compare it with the exclusions in /poliloom-gui/src/lib/textHighlighter.ts:34-41. The change is done when extracted text excludes CSS-hidden elements, hidden attributes, and script/style/noscript content so proof-line matching follows browser-visible text.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100