Re: Multi(dual) language support in roguelikes.



On Jun 17, 10:05 pm, Gelatinous Mutant Coconut
<GelatinousMutantCoco...@xxxxxxxxx> wrote:
On Jun 17, 9:44 pm, Jeff Lait <torespondisfut...@xxxxxxxxxxx> wrote:

I had a bit of an eye-opener with the a vs an rules of English.  I had
naively thought they were driven by vowel vs consonant placement, but
in fact they are driven by the pronunciation of the word, not the
spelling.

Do you actually handle this in your code somehow?

Yep.

I'm assuming that
you don't store phonetic details along with every string. (That would
be going overboard if you're not trying something equally over-the-top
like procedural voice acting.)

Of course not! That also is horribly bad because it requires one to
enter lots of meta data for every string! You want to make it quick
and easy to add new text to the roguelike - data entry is the hard
part after all. Never have your fancy-dancy grammar/multi-lingual
support stuff ever make simple text entry one iota more difficult!

The 'initial letter' heuristic is probably all that you need for
written text to not look wrong, actually; that's actually the rule
that I (mono-lingual native English speaker in America) was taught in
school, even though I and everyone I know still unconsciously chose
between 'a' and 'an' based on pronunciation when speaking.

Yes, it was the rule I was taught too. Which is why I coded it as
such at first. I then started to run into ugly text where I just
*knew* it was wrong, because, as you note, I never actually used that
rule in practice.

There are really two key exceptions, h and u. h, when pronounced,
uses a, but when not pronounced, an. Whether or not you pronounce h
in which words is rather regional. In my case, I'd have a horse but
an honourable procession. u is difficult because it often becomes a
'you' sound, like in usual and utility, as opposed to urban.

This is the code for a/an, I've skipped the code to determine if you
need a definite article.

const char *
gram_getarticle(const char *noun)
{
if (gram_isnameplural(noun))
return "";

if (gram_ispronoun(noun))
return "";

// Check for proper nouns, redacted

// Check if first letter is a vowel.
if (!gram_isvowel(*noun))
{
// These are usually pretty straight forward. However,
// some words such as "honourable" cause problems. Contrast
// with "horse" and "hone".
if (*noun == 'h')
{
// Honour:
if (!strncmp(noun, "hono", 4))
return "an ";

// Lots of other cases likely follow...
}

return "a ";
}

// It is likely "an", however, a eucliedean geometry.
// However, "an eulerian proof".
if (!strncmp(noun, "euc", 3))
return "a ";

// The entire class of "u" causes problems. Many words, such as
// "usually", are pronounced with a "y" prefix, so should use "a
".
// Some, such as "urban" remain to cause us unfortunate problems.
// The rough rule here is:
// Determine if u is hard or soft. If two letters after the
// u is a vowel, it is "utility", "usual", or "ubiquitous", so
// it is "a ".
// If it is two consonents in a row, it is a "urbane" usage, so
// should use "an ".
if (*noun == 'u')
{
// The single letter 'u' also use "a ".
// Yet, if there is no third character, (Great city of Ur?) it
// should be treated as the double consonent case.
if (!noun[1] || gram_isvowel(noun[2]))
{
return "a ";
}
// We have either a u followed by two consonents or two vowels
// in a row. Two vowels in a row we consider to be a "a "
case,
// though I can't think of any.
if (gram_isvowel(noun[1]))
return "a ";

// Chain to default to "an "....
}

// Default to "an "...
return "an ";
}
--
Jeff Lait
(POWDER: http://www.zincland.com/powder)
.



Relevant Pages

  • Re: Build A Powerful, Muscular New Physique, In 12 Short Weeks Or Less
    ... No, Russians and Bulgarians know the meaning of "consonant", which ... letter>l< in Russian. ... I normally pronounce words in my head as I read them. ... reasonable sentences without a single vowel inside. ...
    (misc.fitness.weights)
  • Re: The proper use of "a" and "an"
    ... I always thought that "an" was used in front of a vowel ... and "a" was always used in front of a consonant. ... but "a handful". ... easier to pronounce "a h...". ...
    (alt.usage.english)
  • Phonetic Name Generator
    ... mapped to their English character translations ... // Chooses a phenom from the passed in list ... // Choose a consonant ... // Choose a vowel ...
    (rec.games.roguelike.development)
  • Re: Interconversion of and
    ... I've not seen any evidence of a distinction being made in Thai, ... I've often wondered about the tone mark on ... omitted the vowel development though ignorance. ... consonant governance, a.k.a. register spreading, despite the ...
    (sci.lang)
  • Learn to Speak Thai in 1 Easy Lesson ...and then ten years of summer school
    ... consonant class each consonant belongs to. ... a particular consonant belongs to as it has an effect on the tone. ... Syllables in spoken Thai can only end ... A syllable that ends with a long vowel or a sonorant final consonant is ...
    (soc.culture.thai)

Loading