Skip to content

Improve DOI extraction by refining regex to handle legacy and alternative citation formats#474

Open
Aakash-pal wants to merge 2 commits intorottingresearch:mainfrom
Aakash-pal:fix/doi-legacy-extraction
Open

Improve DOI extraction by refining regex to handle legacy and alternative citation formats#474
Aakash-pal wants to merge 2 commits intorottingresearch:mainfrom
Aakash-pal:fix/doi-legacy-extraction

Conversation

@Aakash-pal
Copy link
Copy Markdown
Contributor

Summary

This PR improves DOI extraction by refining the regex and fallback detection logic to better handle real-world formats.

Changes

  • Improved regex to prevent over-capturing (e.g., avoiding cases like 10.xxxx/abc)DOI)
  • Ensured proper handling of punctuation and edge cases
  • Validated extraction against multiple DOI formats including:
    • doi:10.xxxx/xxxx
    • https://doi.org/...
    • Bare DOIs
    • DOIs with punctuation
    • DOIs with addition space (DOI : 10.xxx)

Result

  • More robust DOI detection
  • Reduced false positives
  • Improved handling of messy real-world text inputs

Testing

Tested using multiple DOI patterns and edge cases to ensure correctness and consistency.

Full sample input file attached in PR for reference.
sample.txt

The output:
Output of the test

Closes #470

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhance DOI extraction to support legacy and alternative citation formats

2 participants