aspell-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Checking whether a work with a given prefix exists


From: André A . Gomes
Subject: Checking whether a work with a given prefix exists
Date: Tue, 10 Aug 2021 20:19:20 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

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.


--
André A. Gomes
"Free Thought, Free World"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]