Checking whether a word with a given prefix exists

AndrĂ© A. Gomes <[email protected]> Tue, 10 Aug 2021 22:48:12 +0300
Newsgroups gmane.comp.gnu.aspell.devel
Message-ID <[email protected]>
Hi,

I'm wondering if Aspell has the following feature implemented.

Given a string S, can it match "^S" (interpreted as a regex) against all
entries of a given dictionary?  I'm looking for a boolean as output, so
the actual list of matches is extra.

Examples: Let S be "te", and the language be english.  Then it outputs
true, since it would match "test" or "television".  Notice that it
wouldn't match "date" or "protein".  When S is "ghb", it outputs false.

This is equivalent to having a dictionary, i.e. a list of words of a
given language, and matching using a regex.  That could easily be
achieved with a file containing the dictionary and grep.  But it feels
that I'm reinventing the wheel.  I'd like to leverage the fact that
aspell already provides the dictionary.

The "closer" I get, with multiple obvious issues, is by using expand:

$ echo ghb/ABCDEFGHIJKLMNOPQRSTUVWXYZ | aspell -l en expand

Thank you.


P.S. - I asked on the user mailing list, but thought that it might be more
appropriate to post it here.

--
Andr=C3=A9 A. Gomes
"Free Thought, Free World"