# HG changeset patch # User Oleksandr Gavenko # Date 1485464843 -7200 # Node ID 4d78dbc5a9b01c05b954994e9e8151ed45b08620 # Parent 03065194ef591f630cc3827e96c55d95c565c3e6 Cleanup espeak IPA output. diff -r 03065194ef59 -r 4d78dbc5a9b0 contrib/gadict.el --- a/contrib/gadict.el Thu Jan 26 22:46:12 2017 +0200 +++ b/contrib/gadict.el Thu Jan 26 23:07:23 2017 +0200 @@ -38,6 +38,10 @@ "Remove whitespace at the beginning and end of S." (gadict--trim-left (gadict--trim-right s))) +(defun gadict--espeak-cleanup (s) + "Cleanup espeak IPA output." + (replace-regexp-in-string "[\x200D]" "" (gadict--trim s))) + (defconst gadict--pos '("n" "v" "adj" "adv" "pron" "det" "prep" "num" "conj" "int" "phr" "phr.v" "contr" "abbr" "prefix") "Defined parts of speech.") @@ -302,7 +306,7 @@ "Default voice for espeak. Used in article template.") (defun gadict-espeak-ipa (str &optional voice) - (gadict--trim + (gadict--espeak-cleanup (shell-command-to-string (format "%s %s %s %s" gadict-espeak-program