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

Avoid false positives in bloomington matching #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion scibot/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,11 +329,14 @@ def find_rrids(text):
regex3 = '(.{0,32})(BDSC|BL|Bl|Bloomington)(\s?)(stock)?(\s)?(#|no|no\.)?(\s?)([0-9]{2,10})([^\w].{0,31})'
matches3 = re.findall(regex3, text)
for prefix, a, b, c, d, e, f, nums, suffix in matches3:
if nums in ['17', '21']:
# special case to avoid false positives
continue
yield prefix, f'RRID:BDSC_{nums.strip()}', f'{a}{b}{c}{d}{e}{f}{nums}', suffix

# fourth round for SAMN
regex4 = '(.{0,32})(SAMN)(\s?)([0-9]{3,15})([^\w].{0,31})'
matches4 = re.findall(regex3, text)
matches4 = re.findall(regex4, text)
for prefix, a, b, nums, suffix in matches4:
yield prefix, f'RRID:SAMN{nums.strip()}', f'{a}{b}{nums}', suffix

Expand Down