equal
deleted
inserted
replaced
35 s)) |
35 s)) |
36 |
36 |
37 (defun gadict--trim (s) |
37 (defun gadict--trim (s) |
38 "Remove whitespace at the beginning and end of S." |
38 "Remove whitespace at the beginning and end of S." |
39 (gadict--trim-left (gadict--trim-right s))) |
39 (gadict--trim-left (gadict--trim-right s))) |
|
40 |
|
41 (defun gadict--espeak-cleanup (s) |
|
42 "Cleanup espeak IPA output." |
|
43 (replace-regexp-in-string "[\x200D]" "" (gadict--trim s))) |
40 |
44 |
41 (defconst gadict--pos '("n" "v" "adj" "adv" "pron" "det" "prep" "num" "conj" "int" "phr" "phr.v" "contr" "abbr" "prefix") |
45 (defconst gadict--pos '("n" "v" "adj" "adv" "pron" "det" "prep" "num" "conj" "int" "phr" "phr.v" "contr" "abbr" "prefix") |
42 "Defined parts of speech.") |
46 "Defined parts of speech.") |
43 |
47 |
44 (defconst gadict--art-lang-regex (regexp-opt '("en" "ru" "uk" "la"))) |
48 (defconst gadict--art-lang-regex (regexp-opt '("en" "ru" "uk" "la"))) |
300 "What voices to show. Look to 'espeak --voices' for full list.") |
304 "What voices to show. Look to 'espeak --voices' for full list.") |
301 (defvar gadict-espeak-default-voice "en-us" |
305 (defvar gadict-espeak-default-voice "en-us" |
302 "Default voice for espeak. Used in article template.") |
306 "Default voice for espeak. Used in article template.") |
303 |
307 |
304 (defun gadict-espeak-ipa (str &optional voice) |
308 (defun gadict-espeak-ipa (str &optional voice) |
305 (gadict--trim |
309 (gadict--espeak-cleanup |
306 (shell-command-to-string |
310 (shell-command-to-string |
307 (format "%s %s %s %s" |
311 (format "%s %s %s %s" |
308 gadict-espeak-program |
312 gadict-espeak-program |
309 gadict-espeak-program-ipa-args |
313 gadict-espeak-program-ipa-args |
310 (if (stringp voice) (concat "-v" (shell-quote-argument voice)) "") |
314 (if (stringp voice) (concat "-v" (shell-quote-argument voice)) "") |