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

ADS Bibcode fix #90

Merged
merged 1 commit into from
Oct 29, 2024
Merged
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
3 changes: 3 additions & 0 deletions idutils/normalizers.py
Original file line number Diff line number Diff line change
@@ -13,6 +13,8 @@

"""ID normalizer helper functions."""

import unicodedata

import isbnlib

from .proxies import custom_schemes_registry
@@ -34,6 +36,7 @@ def normalize_handle(val):

def normalize_ads(val):
"""Normalize an ADS bibliographic code."""
val = unicodedata.normalize("NFKD", val)
m = ads_regexp.match(val)
return m.group(2)

2 changes: 2 additions & 0 deletions idutils/validators.py
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@
"""Utility file containing ID validators."""


import unicodedata
from urllib.parse import urlparse

from .utils import *
@@ -187,6 +188,7 @@ def is_urn(val):

def is_ads(val):
"""Test if argument is an ADS bibliographic code."""
val = unicodedata.normalize("NFKD", val)
return ads_regexp.match(val)


6 changes: 6 additions & 0 deletions tests/test_idutils.py
Original file line number Diff line number Diff line change
@@ -268,6 +268,12 @@
"2017zndo....495787v",
"http://ui.adsabs.harvard.edu/#abs/2017zndo....495787v",
),
(
"1992ApJ…400L…1W",
["ads"],
"1992ApJ...400L...1W",
"http://ui.adsabs.harvard.edu/#abs/1992ApJ...400L...1W",
),
(
"0000000218250097",
["orcid", "isni"],