A unified messaging system includes a voice gateway server coupled to an
electronics mail system and a private branch exchange (PBX). The voice
gateway server provides voice messaging services to a set of subscribers.
Within the voice gateway server, a trigraph analyzer sequentially examines
3-character combinations within a text message; determines occurrence
frequencies for the character combinations; compares the occurrence
frequencies with reference occurrence statistics modeled from text samples
written in particular languages; and generates a language identifier and a
likelihood value for the text message. Based upon the language identifier,
a message inquiry unit selects an appropriate text-to-speech engine for
converting the text message into computer-generated speech that is played
to a subscriber.