|
JSAPI 2.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectWord
public class Word
Provides a standard representation of words used by
speech Engine
s.
A Word
object provides the following information:
String
that can be used
to present the Word
visually. String
that indicates how
the Word
is spoken. String
of phonetic characters
indicating how the Word
is spoken. Word
.
SpeechLocale
: information regarding the intended language
for this Word
. Engine
.
Typically, one of the optional properties is specified. If more than one is specified, they are considered in the following precedence order from most to least specific:
SpeechLocale
.
The Word
class allows the specification of multiple pronunciations
and multiple grammatical categories.
If supplied, pronunciations must be appropriate to each category.
Otherwise, separate Word
objects should be created.
For example, consider the different verb and noun pronunciations in
"they will record a record".
Word
s are added through the VocabularyManager
.
In some applications, the pronunciation may be derived through acoustics
and the written-form text may be less useful than the pronunciation.
In this case, the Word may be created with the ACOUSTIC
category.
VocabularyManager
,
getVocabularyManager
,
ACOUSTIC
Field Summary | |
---|---|
static long |
ABBREVIATION
Grammatical category of Word is an abbreviation or acronym. |
static long |
ACOUSTIC
Grammatical category of Word is an acoustically-derived
pronunciation. |
static long |
ADJECTIVE
Grammatical category of Word is adjective. |
static long |
ADVERB
Grammatical category of Word is adverb. |
static long |
AUXILIARY
Grammatical category of Word is auxiliary. |
static long |
CARDINAL
Grammatical category of Word is cardinal. |
static long |
CONJUNCTION
Grammatical category of Word is conjunction. |
static long |
CONTRACTION
Grammatical category of Word is contraction. |
static long |
DETERMINER
Grammatical category of Word is determiner. |
static long |
DONT_CARE
Grammatical category of Word doesn't matter. |
static long |
NOUN
Grammatical category of Word is noun. |
static long |
OTHER
Grammatical category of Word not otherwise specified. |
static long |
PREPOSITION
Grammatical category of Word is preposition. |
static long |
PRONOUN
Grammatical category of word is pronoun. |
static long |
PROPER_ADJECTIVE
Grammatical category of Word is proper adjective. |
static long |
PROPER_NOUN
Grammatical category of Word is proper noun. |
static long |
UNKNOWN
Grammatical category of Word is unknown. |
static long |
VERB
Grammatical category of Word is verb. |
Constructor Summary | |
---|---|
Word(String text,
String[] pronunciations,
String spokenForm,
AudioSegment audioSegment,
long categories)
Constructs a Word object. |
|
Word(String text,
String[] pronunciations,
String spokenForm,
AudioSegment audioSegment,
long categories,
SpeechLocale locale)
Constructs a Word object with SpeechLocale information. |
Method Summary | |
---|---|
AudioSegment |
getAudioSegment()
Gets the AudioSegment for this Word . |
long |
getCategories()
Gets the categories of this Word . |
String[] |
getPronunciations()
Gets the pronunciations of this Word . |
SpeechLocale |
getSpeechLocale()
Gets the Word SpeechLocale . |
String |
getSpokenForm()
Gets the spoken-form text of this Word . |
String |
getText()
Gets the written-form text of this Word . |
Methods inherited from class Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long UNKNOWN
Word
is unknown.
This value implies that no other category flag is set.
getCategories
,
Constant Field Valuespublic static final long DONT_CARE
Word
doesn't matter.
getCategories
,
Constant Field Valuespublic static final long OTHER
Word
not otherwise specified.
getCategories
,
Constant Field Valuespublic static final long NOUN
Word
is noun.
English examples: "car", "house", "elephant".
getCategories
,
Constant Field Valuespublic static final long PROPER_NOUN
Word
is proper noun.
English examples: "Yellowstone", "Singapore".
getCategories
,
Constant Field Valuespublic static final long PRONOUN
getCategories
,
Constant Field Valuespublic static final long VERB
Word
is verb.
English examples: "run", "debug", "integrate".
getCategories
,
Constant Field Valuespublic static final long ADVERB
Word
is adverb.
English examples: "slowly", "loudly", "barely", "very", "never".
getCategories
,
Constant Field Valuespublic static final long ADJECTIVE
Word
is adjective.
English examples: "red", "mighty", "very", "first", "eighteenth".
getCategories
,
Constant Field Valuespublic static final long PROPER_ADJECTIVE
Word
is proper adjective.
English examples: "British", "Brazilian".
getCategories
,
Constant Field Valuespublic static final long AUXILIARY
Word
is auxiliary.
English examples: "have", "do", "is", "shall", "must", "cannot".
getCategories
,
Constant Field Valuespublic static final long DETERMINER
Word
is determiner.
English examples: "the", "a", "some", "many", "his", "her".
getCategories
,
Constant Field Valuespublic static final long CARDINAL
Word
is cardinal.
English examples: "one", "two", "million".
getCategories
,
Constant Field Valuespublic static final long CONJUNCTION
Word
is conjunction.
English examples: "and", "or", "since", "if".
getCategories
,
Constant Field Valuespublic static final long PREPOSITION
Word
is preposition.
English examples: "of", "for".
getCategories
,
Constant Field Valuespublic static final long CONTRACTION
Word
is contraction.
English examples: "don't", "can't".
getCategories
,
Constant Field Valuespublic static final long ABBREVIATION
Word
is an abbreviation or acronym.
English examples: "Mr.", "USA".
getCategories
,
Constant Field Valuespublic static final long ACOUSTIC
Word
is an acoustically-derived
pronunciation.
This is not a true grammatical category, but provides
information useful for deciding how to use this Word
.
In this case, the pronunciation is more useful than the written-form text. For example, the written-form text might be "<NameDialerEntry3>", but the pronunciation might represent "Bill Smith".
getText
,
getPronunciations
,
getAudioSegment
,
getCategories
,
Constant Field ValuesConstructor Detail |
---|
public Word(String text, String[] pronunciations, String spokenForm, AudioSegment audioSegment, long categories) throws IllegalArgumentException
Word
object.
This constructor uses null
for SpeechLocale
.
The Word
constructor with the SpeechLocale
parameter provides more details.
text
- the written-form text of the Word
pronunciations
- a set of pronunciations for the Word
spokenForm
- the spoken-form text of the Word
audioSegment
- a recorded AudioSegment
for the Word
categories
- grammatical categories for this Word
IllegalArgumentException
- if the written-form text is null
Word(String, String[], String, AudioSegment, long, SpeechLocale)
public Word(String text, String[] pronunciations, String spokenForm, AudioSegment audioSegment, long categories, SpeechLocale locale) throws IllegalArgumentException
Word
object with SpeechLocale
information.
This information can improve the performance of speech Engine
s.
The written-form text represents the Word
visually
and must be specified.
All other values may be null
(or UNKNOWN
for categories
).
The locale
parameter specifies the SpeechLocale
of this Word
.
It may be null
or partially specified.
See getSpeechLocale
for details.
The preamble defines a
precedence order
for Engine
s using the different kinds of information.
text
- the written-form text of the Word
pronunciations
- a set of pronunciations for the Word
spokenForm
- the spoken-form text of the Word
audioSegment
- a recorded AudioSegment
for the Word
categories
- grammatical categories for this Word
locale
- the SpeechLocale
of this Word
IllegalArgumentException
- if the written-form text is null
getText
,
getPronunciations
,
getSpokenForm
,
getAudioSegment
,
getCategories
,
getSpeechLocale
,
UNKNOWN
Method Detail |
---|
public AudioSegment getAudioSegment()
AudioSegment
for this Word
.
The value may be null
if it is not available.
Audio may be available for the Word
in speaker dependent systems
or when the pronunciation is derived from audio.
The audio may be used as feedback to the user.
AudioSegment
for this Word
ACOUSTIC
public long getCategories()
Word
.
Value may be UNKNOWN
or an OR'ed set of
the categories defined by this class.
For example, a Word
may be classified as both a noun and a verb:
Word w = new Word("running", null, null, null, Word.NOUN | Word.VERB);
The category information is a guide to the Word
's
grammatical role.
Engine
s can use this information to improve performance in
areas such as accuracy, phrasing and accenting.
Word
ABBREVIATION
,
ACOUSTIC
,
ADJECTIVE
,
ADVERB
,
AUXILIARY
,
CARDINAL
,
CONJUNCTION
,
CONTRACTION
,
DETERMINER
,
DONT_CARE
,
NOUN
,
OTHER
,
PREPOSITION
,
PRONOUN
,
PROPER_ADJECTIVE
,
PROPER_NOUN
,
VERB
,
UNKNOWN
public String[] getPronunciations()
Word
.
The pronunciation String
s use the Unicode IPA subset.
Returns null
if no pronunciations were specified.
Speech Engine
s should handle most words
of the language they support.
However, providing pronunciations with Word
s can
provide missing information and improve Engine
performance
in cases such as domain-specific or foreign words.
word
ACOUSTIC
public String getSpokenForm()
Word
.
Returns null
if the spoken-form text is not defined.
The spoken-form text of a Word
is useful for mapping
the written-form text to words that are likely to be handled
by a speech Engine
.
The following examples show corresponding written- and spoken-form text:
Word
getText
public String getText()
Word
.
The written-form text represents the Word
visually.
Word
getSpokenForm
public SpeechLocale getSpeechLocale()
Word
SpeechLocale
.
The SpeechLocale
includes the language, country,
and variant (for the language).
If partially specified, an Engine
uses the most complete match
from among possible Word
choices.
The SpeechLocale
may be null
to more conveniently
support mono-lingual Engine
s.
SpeechLocale
for this Word
|
JSAPI 2.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
JavaTM Speech API 2.0,
Final Release v2.0.6.
© 2008, Conversay and Sun Microsystems.