Cleanup espeak IPA output.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Thu, 26 Jan 2017 23:07:23 +0200
changeset 744 4d78dbc5a9b0
parent 743 03065194ef59
child 745 4679b9e75798
Cleanup espeak IPA output.
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