fix: extract clickable URL annotations from PDF for accurate profile detection#250
Open
siddarthx07 wants to merge 1 commit into
Open
fix: extract clickable URL annotations from PDF for accurate profile detection#250siddarthx07 wants to merge 1 commit into
siddarthx07 wants to merge 1 commit into
Conversation
…detection Many resumes embed hyperlinks where display text (e.g. "GitHub", "LinkedIn") hides the actual URL as a PDF link annotation. PyMuPDF's to_markdown() drops these annotations, so the LLM never sees the real URLs and profile extraction in the basics section is inaccurate or empty. In extract_text_from_pdf(), reuse the already-open doc to iterate page.get_links() and collect all unique HTTP/HTTPS URIs. Append them as an explicit "=== CLICKABLE LINKS IN RESUME ===" block so the LLM treats them as explicit resume content — satisfying the existing basics.jinja constraint that only URLs present in the text should be extracted. Fixes interviewstreet#152 Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Problem
PDFHandlerusesto_markdown()(PyMuPDF) to extract resume text. This only captures visible text — it silently drops PDF link annotations. Many resumes embed hyperlinks where the display text isGitHuborLinkedInbut the actual URL lives as a hidden annotation. The LLM never sees it, so theprofilesarray in the extracted JSON comes back empty or wrong.Fix
In
extract_text_from_pdf(), reuse the already-opendocto callpage.get_links()on each page. Collect all uniquehttp:///https://URIs and append them as an explicit block:=== CLICKABLE LINKS IN RESUME === https://github.com/username https://linkedin.com/in/username
This satisfies the existing
basics.jinjaconstraint ("ONLY extract URLs that are EXPLICITLY present in the resume markdown") with no prompt changes needed.Details
pymupdf.open()call — reuses the already-opendocseen_urissetmailto:, internal#anchorlinks)pymupdf_rag.pyis untouchedFixes Feature Request: Extract clickable URLs from PDF text #152