(defvar josh/abbrev-part-of-speech-list
'(("adjective" . "adj.")
("verb" . "v.")
("noun" . "n.")
("adverg" . "adv.")))
(defun josh/abbrev-part-of-speech (part-of-speech)
"Take the PART-OF-SPEECH and abbreviate it.
For example: adjective -> adj."
(let ((x (assoc part-of-speech josh/abbrev-part-of-speech-list)))
(if x
(cdr x)
part-of-speech)))
(defun josh/get-english-definitions (word)
"Get for a list of definitions for WORD"
(mapcar (lambda (defn)
(format "%s %s"
(josh/abbrev-part-of-speech (cdr (assoc 'partOfSpeech defn)))
(cdr (assoc 'text defn))))
(wordnik-fetch-definition word)))
(defun josh/prompt-english-definitions (word)
"Prompt using a list of definitions for WORD, return formatted string.x"
(mapconcat (lambda (x) (format "- %s" x))
(helm-comp-read "Pick definition(s): "
(josh/get-english-definitions word)
:marked-candidates t)
"\n"))
(defun josh/get-english-examples (word)
"Get for a list of examples for WORD"
(mapcar (lambda (x) (cdr (assoc 'text x)))
(wordnik-fetch-examples word)))
(defun josh/prompt-english-examples (word)
"Prompt using a list of examples for WORD, return formatted string."
(mapconcat (lambda (x) (format "- %s" x))
(helm-comp-read "Pick examples(s): "
(josh/get-english-examples word)
:marked-candidates t)
"\n"))
(defvar josh/english-word nil
"The word whose definition we're looking up.")
(defun josh/english-prompt ()
"Prompt for a word, return it"
(setq josh/english-word (read-from-minibuffer "Word: ")))