12

Is there any reasonably easy way to remove "hard" hyphens from an eBook? For example, I am reading a book by Ted Dekker where there are many places where a word has a hy-phen in the middle. (Not picking on Ted here -- lots of books seem to have the problem.)

Each one acts like a visual "speed-bump" to me. It seems that someone at some point manually hyphenated line endings, forgetting that a different screen size, font choice/size, etc. would require different hyphenation.

Ideas?

3
  • 1
    It seems to be a non-trivial problem ;) Jan 25, 2014 at 5:06
  • Nice! But when I do that "-<br>" I get white space that breaks up the word. Tried to figure out the calibre manual, but no luck with my skill..
    – user778
    Mar 2, 2014 at 18:45
  • This looks like a comment not an answer Mar 2, 2014 at 19:10

2 Answers 2

8

If the book has not a DRM and you are free to edit/convert it, you can use Calibre to convert to the same format (i.e. you can use an .epub as a source file and still convert to an .epub output.

In the Heuristic processing tab make sure to enable both the processing and Remove unnecessary hyphenation; if you want you can also enable other options here if you need to.

enter image description here

This method use the source document as a dictionary to verify if the hyphenated word is also spelled as a single word. Of course, if a given hyphenated word has a single occurrence it won't be corrected. From Calibre user manual:

calibre will analyze all hyphenated content in the document when this option is enabled. The document itself is used as a dictionary for analysis. This allows calibre to accurately remove hyphens for any words in the document in any language, along with made-up and obscure scientific words. The primary drawback is words appearing only a single time in the document will not be changed. Analysis happens in two passes, the first pass analyzes line endings. Lines are only unwrapped if the word exists with or without a hyphen in the document. The second pass analyzes all hyphenated words throughout the document, hyphens are removed if the word exists elsewhere in the document without a match.

If you happen to have the the source .pdf, where all hyphenated words are placed at the end of their respective lines, you can use the Search & Replace tab to add another tweak (I've personally tested and used it many times).

enter image description here

You must enter -<br> in the Search box and leave completely blank the Replacement one, and be sure to click Add to, well, add the rule to the conversion. This only works, as I've stated, if the hyphens are correctly placed at the end of their lines, so, in most cases, you need to have access to the source file. You can also click on the Wizard button to open a preview of the file, where you can preview what your source regex code (in this case -<br>) will select and delete (because we left blank the replacement box).

2
  • Great suggestion! I tried the Heuristic processing, and it helped quite a bit -- inexplicably, however, still failed to clean up things like 'sum-mer' and 'cut-ting'. But, like I said, better than before. All hail Calibre!
    – Ed Stout
    Jan 9, 2014 at 22:24
  • Maybe because these were the only occurrences of these words. The check is made by using the document as a dictionary. For those few leftover hyphens it should be easy to manually correct them with a simple search inside it.
    – Sekhemty
    Jan 10, 2014 at 12:01
1

Such hard hyphens are usually the result of a bad conversion from pdf to epub/mobi. I got them in books I regularly bought, so it's not a problem of piracy: my impression is that even today publishers start with a pdf file (made with InDesign or similar), and they forgot that some words are hyphenated. If the book had no DRM, sometimes I decided to use Sigil and painstakingly search for all occurrences, but this is time-consuming.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.