From 3c45dba7ccb24e6328236c65c04c43b2378d5d03 Mon Sep 17 00:00:00 2001 From: ldolse Date: Wed, 19 Jan 2011 02:01:40 +0800 Subject: [PATCH] ... --- src/calibre/ebooks/conversion/preprocess.py | 2 +- src/calibre/ebooks/conversion/utils.py | 6 +++--- src/calibre/ebooks/txt/input.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/calibre/ebooks/conversion/preprocess.py b/src/calibre/ebooks/conversion/preprocess.py index da20af6e8a..bbd71ede3a 100644 --- a/src/calibre/ebooks/conversion/preprocess.py +++ b/src/calibre/ebooks/conversion/preprocess.py @@ -175,7 +175,7 @@ class Dehyphenator(object): ''' def __init__(self, verbose=0, log=None): - self.log = default_log if log is None else log + self.log = log self.verbose = verbose # Add common suffixes to the regex below to increase the likelihood of a match - # don't add suffixes which are also complete words, such as 'able' or 'sex' diff --git a/src/calibre/ebooks/conversion/utils.py b/src/calibre/ebooks/conversion/utils.py index 9ae8e5ab6f..4663eeccdf 100644 --- a/src/calibre/ebooks/conversion/utils.py +++ b/src/calibre/ebooks/conversion/utils.py @@ -92,8 +92,8 @@ class HeuristicProcessor(object): line_end = line_end_ere.findall(raw) tot_htm_ends = len(htm_end) tot_ln_fds = len(line_end) - self.log.debug("There are " + unicode(tot_ln_fds) + " total Line feeds, and " + - unicode(tot_htm_ends) + " marked up endings") + #self.log.debug("There are " + unicode(tot_ln_fds) + " total Line feeds, and " + + # unicode(tot_htm_ends) + " marked up endings") if percent > 1: percent = 1 @@ -101,7 +101,7 @@ class HeuristicProcessor(object): percent = 0 min_lns = tot_ln_fds * percent - self.log.debug("There must be fewer than " + unicode(min_lns) + " unmarked lines to add markup") + #self.log.debug("There must be fewer than " + unicode(min_lns) + " unmarked lines to add markup") if min_lns > tot_htm_ends: return True diff --git a/src/calibre/ebooks/txt/input.py b/src/calibre/ebooks/txt/input.py index c918d145f4..dd14de2d20 100644 --- a/src/calibre/ebooks/txt/input.py +++ b/src/calibre/ebooks/txt/input.py @@ -118,11 +118,11 @@ class TXTInput(InputFormatPlugin): txt = separate_paragraphs_print_formatted(txt) if options.paragraph_type == 'unformatted': - from calibre.ebooks.conversion.utils import PreProcessor + from calibre.ebooks.conversion.utils import HeuristicProcessor # get length # unwrap lines based on punctuation - preprocessor = PreProcessor(options, log=getattr(self, 'log', None)) + preprocessor = HeuristicProcessor(options, log=getattr(self, 'log', None)) txt = preprocessor.punctuation_unwrap(length, txt, 'txt') flow_size = getattr(options, 'flow_size', 0)