epub_to_audiobook icon indicating copy to clipboard operation
epub_to_audiobook copied to clipboard

We Should Be Able to Search And Replace Text

Open reverendj1 opened this issue 6 months ago • 0 comments

There are many times when it would be beneficial to search and replace text in a book, before generating the audio narration. The biggest reasons would be to:

  • expand abbreviations
  • fix pronunciation
  • replace foreign characters not supported by the engine with phonetic equivalents. right now these are just skipped.

This PR adds this functionality, by allowing the user to specify a simple text file like this:

# this is the general structure
<search>==<replace>
# this is a comment
# fix cardinal direction abbreviations
N\.E\.==north east
# be careful with your regexes, as this would also match Sally N. Smith
N\.==north
# pronounce Barbadoes like the locals
Barbadoes==Barbayduss
python3 main.py examples/The_Life_and_Adventures_of_Robinson_Crusoe.epub output_folder --search_and_replace_file search.conf

reverendj1 avatar Jul 29 '24 21:07 reverendj1