diff --git a/src/calibre/library/catalog.py b/src/calibre/library/catalog.py index 18568703df..77e7230c20 100644 --- a/src/calibre/library/catalog.py +++ b/src/calibre/library/catalog.py @@ -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)