From: Emanuel Berg <incal@dataswamp.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Testing validity of a word
Date: Wed, 26 Jul 2023 21:07:03 +0200 [thread overview]
Message-ID: <87fs5awkyw.fsf@dataswamp.org> (raw)
In-Reply-To: PqPlv29d0xSEnLAtJ99_6uFNop_mvtzFVrpzKjuZZriTFosAIQCn99cXes0lY9HjtZw9d9wQeKTuJX3d2iQQIazt8COMS-n2bQvSwiDPXcg=@proton.me
uzibalqa wrote:
> The following could be less intensive
>
> (defun is-valid-word (word)
> "Check if the WORD is valid using `ispell`."
> (ispell-lookup-words word))
Okay, so I tried with these
(defun spell-word-2 (word)
(and (ispell-lookup-words word) t) )
;; (spell-word-2 "length") ; t
;; (spell-word-2 "lenght") ; nil
(defun spell-word (word)
(with-temp-buffer
(save-excursion
(insert word) )
(condition-case nil
(not (ispell-word))
(error nil) )))
;; (spell-word "length") ; t
;; (spell-word "lenght") ; nil
Maybe spell-word-2, using `ispell-lookup-words', is faster as
you say, but something is different because with the
permutation use case and code previously discussed [1] this
(string-perms-filter "pigelsen")
only returns "sleeping". With my old spell-word both are
returned, i.e. ("peelings" "sleeping") - no idea why actually,
I'll leave it to my subconscious to figure out God willing ...
[1] https://dataswamp.org/~incal/emacs-init/perm.el
--
underground experts united
https://dataswamp.org/~incal
prev parent reply other threads:[~2023-07-26 19:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-26 0:21 Testing validity of a word uzibalqa
2023-07-26 1:33 ` [External] : " Drew Adams
2023-07-26 1:40 ` uzibalqa
2023-07-26 2:27 ` uzibalqa
2023-07-26 4:21 ` Drew Adams
2023-07-26 2:32 ` uzibalqa
2023-07-26 12:06 ` Emanuel Berg
2023-07-26 17:08 ` uzibalqa
2023-07-26 17:45 ` Emanuel Berg
2023-07-26 19:07 ` Emanuel Berg [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87fs5awkyw.fsf@dataswamp.org \
--to=incal@dataswamp.org \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).