Remove unused experimental code

This commit is contained in:
Gerard Vermeulen 2022-11-07 12:19:35 +01:00
parent df6438e227
commit 8c5d751af1

View File

@ -3401,6 +3401,12 @@ abbreviation definitions in this file by means of:
#+name: lst:misspellings-abbrev
#+begin_src emacs-lisp
(with-eval-after-load 'emacs
(defun browse-common-misspellings ()
"Open the Wikipedia page of common misspellings for machines in EWW."
(interactive)
(eww (concat "https://en.wikipedia.org/wiki/Wikipedia"
":Lists_of_common_misspellings/For_machines")))
(fset 'misspellings-abbrev
(kmacro-lambda-form
[?\C-s ?- ?> return backspace backspace ?\C-k ?\C-x ?a ?i ?g ?\C-y return]
@ -3409,53 +3415,7 @@ abbreviation definitions in this file by means of:
(setq-default abbrev-mode t))
#+end_src
Listing [[lst:word-games]] defines the =anagram-p= function that migth be used for a
better exploitation of [[https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines][Wikipedia's list of common misspellings for machines]] in
the future.
#+caption[Better parsing of the common misspellings list]:
#+caption: Better parsing of the common misspellings list.
#+name: lst:better-misspellings
#+begin_src emacs-lisp
(with-eval-after-load 'emacs
(defun browse-common-misspellings ()
"Open the Wikipedia page of common misspellings for machines in EWW."
(interactive)
(eww (concat "https://en.wikipedia.org/wiki/Wikipedia"
":Lists_of_common_misspellings/For_machines")))
(defun wordnet-check (word)
"Check whether WORD occurs in the wordnet lexical database."
(cl-destructuring-bind (exit-code output)
(shell-command-with-exit-code "wn" word "-grepn" "-grepv" "-grepa" "-grepr")
(if (= 0 exit-code)
(< 0 (length (string-trim output)))
(error "%s" (string-trim output)))))
(defun better-misspellings ()
"Pick the best from each common misspelling multiple choice of corrections."
(interactive)
(let (start end lines)
(save-excursion
(if (re-search-forward (rx bol "abandon"))
(setq start (match-beginning 0))
(user-error "Failed to find beginning of misspellings"))
(if (re-search-forward (rx bol "Retrieved from"))
(setq end (match-beginning 0))
(user-error "Failed to find end of misspellings")))
(dolist (line (split-string
(buffer-substring-no-properties start end) "\n"))
(pcase-let ((`(,lhs . (,rhs . ,rest)) (split-string line "->")))
(when (and (stringp rhs)
(string-match ", " rhs))
(message "%s -> %s" lhs rhs)
(let ((words (split-string rhs ", "))
(stack))
(dolist (word words)
(when (wordnet-check word)
(message "wordnet finds: %s" word)
(push word stack))))))))))
#+end_src
Listing [[lst:word-games]] defines the =anagram-p= function that migth be used games.
#+caption[Word games]:
#+caption: Word games.
@ -3463,7 +3423,6 @@ the future.
#+begin_src emacs-lisp
;; https://funcall.blogspot.com/2022/07/lets-play-wordle.html
;; https://github.com/tabatkins/wordle-list
(defun anagram-p (evil vile)
"Check whether strings EVIL and VILE are anagrams of each other."
(if (string= evil vile)