Fix for title sorting, ignore numerics after 1st title word

This commit is contained in:
GRiker 2010-01-26 12:19:21 -07:00
parent c0f25a4428
commit 7977386ca0

View File

@ -338,7 +338,7 @@ class EPUB_MOBI(CatalogPlugin):
elif hundredsComponent and tensComponent:
result = hundredsComponentString + " " + tensComponentString
else:
prints(" NumberToText.stringFromInt(): empty result translating %d" % intToTranslate)
prints(" NumberToText.stringFromInt(): empty result translating %d" % intToTranslate)
return result
def numberTranslate(self):
@ -1879,7 +1879,7 @@ class EPUB_MOBI(CatalogPlugin):
# 'tag', 'file', 'authors'
self.opts.log.info(self.updateProgressFullStep("generateNCXByTags()"))
if not len(self.genres):
self.opts.log.warn(" No genres found in tags.\n"
" No Genre section added to Catalog")
@ -2296,14 +2296,20 @@ class EPUB_MOBI(CatalogPlugin):
# Convert the actual title to a string suitable for sorting.
# Convert numbers to strings, ignore leading stop words
# The 21-Day Consciousness Cleanse
# Scan for numbers in each word clump.
title_words = title.split(' ')
# Scan for numbers in each word clump
title_words = title.split()
stop_words = ['a','an','the']
translated = []
# Remove the stop words
# GwR *** conform this with KG's stop word list
while title_words[0].lower() in stop_words:
stop_word = title_words.pop(0)
for (i,word) in enumerate(title_words):
hit = re.search('[0-9]+',word)
if hit :
# Don't translate numeric content after first title word
if i==0 and re.search('[0-9]+',word):
translated.append(EPUB_MOBI.NumberToText(word).text)
else:
translated.append(word)