epub_to_audiobook
epub_to_audiobook copied to clipboard
We Should Be Able to Search And Replace Text
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