This commit is contained in:
j 2014-05-14 11:57:11 +02:00
commit d385853186
48 changed files with 1344 additions and 488 deletions

View file

@ -8,6 +8,8 @@ import stdnum.isbn
import ox
from meta.utils import normalize_isbn
def valid_olid(id):
return id.startswith('OL') and id.endswith('M')
@ -74,9 +76,6 @@ def sort_title(title):
title = re.sub(u'[\'!¿¡,\.;\-"\:\*\[\]]', '', title)
return title.strip()
def normalize_isbn(value):
return ''.join([s for s in value if s.isdigit() or s == 'X'])
def find_isbns(text):
matches = re.compile('\d[\d\-X\ ]+').findall(text)
matches = [normalize_isbn(value) for value in matches]