a/an ( word -- article )
English natural language transformations

Prev:singularize ( word -- singular )
Next:?plural-article ( word -- article )


Inputs and outputs
worda string
articlea "a" or a "an"

Word description
Gives the proper indefinite singular article (a or an) for the word. For words which begin with a vowel sound, an is used, whereas a is used for words which begin with a consonant sound.

The output does not contain the input. The output of this word is always a singular article, regardless of the plurality of the input.

USING: english kernel combinators sequences io ; "object" [ a/an ] keep " " glue print
an object

See also
?plural-article, a10n, comma-list, $or-markup-example, or-markup-example


: a/an ( word -- article )
[ first ] [ length ] bi 1 = "afhilmnorsx" "aeiou" ? member?
"an" "a" ? ;