upstream version 1.2.2
[debian/freetts] / javadoc / com / sun / speech / freetts / lexicon / LetterToSoundImpl.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\r
2 <!--NewPage-->\r
3 <HTML>\r
4 <HEAD>\r
5 <!-- Generated by javadoc (build 1.4.2_16) on Mon Mar 09 18:20:30 CET 2009 -->\r
6 <TITLE>\r
7 LetterToSoundImpl (FreeTTS 1.2)\r
8 </TITLE>\r
9 \r
10 <META NAME="keywords" CONTENT="com.sun.speech.freetts.lexicon.LetterToSoundImpl class">\r
11 \r
12 <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">\r
13 \r
14 <SCRIPT type="text/javascript">\r
15 function windowTitle()\r
16 {\r
17     parent.document.title="LetterToSoundImpl (FreeTTS 1.2)";\r
18 }\r
19 </SCRIPT>\r
20 \r
21 </HEAD>\r
22 \r
23 <BODY BGCOLOR="white" onload="windowTitle();">\r
24 \r
25
26 <!-- ========= START OF TOP NAVBAR ======= -->\r
27 <A NAME="navbar_top"><!-- --></A>
28 <A HREF="#skip-navbar_top" title="Skip navigation links"></A>
29 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">\r
30 <TR>\r
31 <TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">\r
32 <A NAME="navbar_top_firstrow"><!-- --></A>
33 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">\r
34   <TR ALIGN="center" VALIGN="top">\r
35   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>\r
36   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>\r
37   <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>\r
38   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>\r
39   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>\r
40   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>\r
41   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>\r
42   </TR>\r
43 </TABLE>\r
44 </TD>\r
45 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>\r
46 </EM>\r
47 </TD>\r
48 </TR>\r
49 \r
50 <TR>\r
51 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">\r
52 &nbsp;PREV CLASS&nbsp;\r
53 &nbsp;<A HREF="../../../../../com/sun/speech/freetts/lexicon/LexiconImpl.html" title="class in com.sun.speech.freetts.lexicon"><B>NEXT CLASS</B></A></FONT></TD>\r
54 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">\r
55   <A HREF="../../../../../index.html" target="_top"><B>FRAMES</B></A>  &nbsp;\r
56 &nbsp;<A HREF="LetterToSoundImpl.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;\r
57 &nbsp;<SCRIPT type="text/javascript">\r
58   <!--\r
59   if(window==top) {\r
60     document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');\r
61   }\r
62   //-->\r
63 </SCRIPT>\r
64 <NOSCRIPT>\r
65   <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>\r
66 </NOSCRIPT>
67 \r
68 </FONT></TD>\r
69 </TR>\r
70 <TR>\r
71 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">\r
72   SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>\r
73 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">\r
74 DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>\r
75 </TR>\r
76 </TABLE>\r
77 <A NAME="skip-navbar_top"></A>
78 <!-- ========= END OF TOP NAVBAR ========= -->\r
79 \r
80 <HR>\r
81 <!-- ======== START OF CLASS DATA ======== -->\r
82 <H2>\r
83 <FONT SIZE="-1">\r
84 com.sun.speech.freetts.lexicon</FONT>\r
85 <BR>\r
86 Class LetterToSoundImpl</H2>\r
87 <PRE>\r
88 java.lang.Object\r
89   <IMG SRC="../../../../../resources/inherit.gif" ALT="extended by"><B>com.sun.speech.freetts.lexicon.LetterToSoundImpl</B>\r
90 </PRE>\r
91 <DL>\r
92 <DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../../../../com/sun/speech/freetts/lexicon/LetterToSound.html" title="interface in com.sun.speech.freetts.lexicon">LetterToSound</A></DD>\r
93 </DL>\r
94 <HR>\r
95 <DL>\r
96 <DT>public class <B>LetterToSoundImpl</B><DT>extends java.lang.Object<DT>implements <A HREF="../../../../../com/sun/speech/freetts/lexicon/LetterToSound.html" title="interface in com.sun.speech.freetts.lexicon">LetterToSound</A></DL>\r
97 \r
98 <P>\r
99 Provides the phone list for words using the CMU6 letter-to-sound
100  (LTS) rules, which are based on the Black, Lenzo, and Pagel paper,
101  "Issues in Building General Letter-to-Sound Rules."  Proceedings
102  of ECSA Workshop on Speech Synthesis, pages 77-80, Australia, 1998.
103
104  <p>The LTS rules are a simple state machine, with one entry point
105  for each letter of the alphabet (lower case letters are always
106  assumed, and the rules keep an array with one entry per letter that
107  point into the state machine).
108
109  <p>The state machine consists of a huge array, with most entries
110  containing a decision and the indices of two other entries. The
111  first of these two indices represents where to go if the decision
112  is true, and the second represents where to go if the decision is
113  false. All entries that do not contain a decision are final
114  entries, and these contain a phone. 
115
116  <p>The decision in this case is a simple character comparison,
117  but it is done in the context of a window around the character in
118  the word. The decision consists of a index into the context window
119  and a character value. If the character in the context window
120  matches the character value, then the decision is true. 
121
122  <p>The machine traversal for each letter starts at that letter's
123  entry in the state machine and ends only when it reaches a final
124  state. If there is no phone that can be mapped, the phone in the
125  final state is set to 'epsilon.' 
126
127  <p>The context window for a character is generated in the following
128  way: 
129
130  <ul>
131  <li>Pad the original word on either side with '#' and '0'
132  characters the size of the window for the LTS rules (in this case,
133  the window size is 4). The "#" is used to indicate the beginning
134  and end of the word. So, the word "monkey" would turn into
135  "000#monkey#000".
136  <li>For each character in the word, the context window consists of
137  the characters in the padded form the preceed and follow the word.
138  The number of characters on each side is dependent upon the window
139  size. So, for this implementation, the context window for the 'k'
140  in monkey is "#money#0". 
141  </ul>
142   
143  <p>Here's how the phone for 'k' in 'monkey' might be determined: 
144
145  <ul>
146  <li>Create the context window "#money#0". 
147  <li>Start at the state machine entry for 'k' in the state machine. 
148  <li>Grab the 'index' from the current state. This represents an
149  index into the context window.
150  <li>Compare the value of the character at the index in the context
151  window to the character from the current state. If there is a
152  match, the next state is the qtrue value. If there isn't a match,
153  the next state is the qfalse state. 
154  <li>Keep on working through the machine until you read a final
155  state.
156  <li>When you get to the final state, the phone is the character in
157  that state. 
158  </ul>
159
160  <p>This implementation will either read from a straight ASCII file
161  or a binary file.  When reading from an ASCII file, you can specify
162  when the input line is tokenized:  load, lookup, or never.  If you
163  specify 'load', the entire file will be parsed when it is loaded.
164  If you specify 'lookup', the file will be loaded, but the parsing
165  for each line will be delayed until it is referenced and the parsed
166  form will be saved away.  If you specify 'never', the lines will
167  parsed each time they are referenced.  The default is 'load'.  To
168  specify the load type, set the system property as follows:
169
170  <pre>
171    -Dcom.sun.speech.freetts.lexicon.LTSTokenize=load
172  </pre>
173
174  <p>[[[TODO:  This implementation uses ASCII 'a'-'z', which is not
175  internationalized.]]]\r
176 <P>\r
177 \r
178 <P>\r
179 <HR>\r
180 \r
181 <P>\r
182 <!-- ======== NESTED CLASS SUMMARY ======== -->\r
183 \r
184 \r
185 <!-- =========== FIELD SUMMARY =========== -->\r
186 \r
187 <A NAME="field_summary"><!-- --></A>
188 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">\r
189 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">\r
190 <TD COLSPAN=2><FONT SIZE="+2">\r
191 <B>Field Summary</B></FONT></TD>\r
192 </TR>\r
193 <TR BGCOLOR="white" CLASS="TableRowColor">\r
194 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">\r
195 <CODE>protected &nbsp;java.util.HashMap</CODE></FONT></TD>\r
196 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/lexicon/LetterToSoundImpl.html#letterIndex">letterIndex</A></B></CODE>\r
197 \r
198 <BR>\r
199 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The indexes of the starting points for letters in the state machine.</TD>\r
200 </TR>\r
201 <TR BGCOLOR="white" CLASS="TableRowColor">\r
202 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">\r
203 <CODE>protected &nbsp;boolean</CODE></FONT></TD>\r
204 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/lexicon/LetterToSoundImpl.html#tokenizeOnLoad">tokenizeOnLoad</A></B></CODE>\r
205 \r
206 <BR>\r
207 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If true, the state string is tokenized when it is first read.
208  </TD>\r
209 </TR>\r
210 <TR BGCOLOR="white" CLASS="TableRowColor">\r
211 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">\r
212 <CODE>protected &nbsp;boolean</CODE></FONT></TD>\r
213 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/lexicon/LetterToSoundImpl.html#tokenizeOnLookup">tokenizeOnLookup</A></B></CODE>\r
214 \r
215 <BR>\r
216 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If true, the state string is tokenized the first time it is
217  referenced.  </TD>\r
218 </TR>\r
219 </TABLE>\r
220 &nbsp;\r
221 <!-- ======== CONSTRUCTOR SUMMARY ======== -->\r
222 \r
223 <A NAME="constructor_summary"><!-- --></A>
224 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">\r
225 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">\r
226 <TD COLSPAN=2><FONT SIZE="+2">\r
227 <B>Constructor Summary</B></FONT></TD>\r
228 </TR>\r
229 <TR BGCOLOR="white" CLASS="TableRowColor">\r
230 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/lexicon/LetterToSoundImpl.html#LetterToSoundImpl(java.net.URL, boolean)">LetterToSoundImpl</A></B>(java.net.URL&nbsp;ltsRules,
231                   boolean&nbsp;binary)</CODE>\r
232 \r
233 <BR>\r
234 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Class constructor.</TD>\r
235 </TR>\r
236 </TABLE>\r
237 &nbsp;\r
238 <!-- ========== METHOD SUMMARY =========== -->\r
239 \r
240 <A NAME="method_summary"><!-- --></A>
241 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">\r
242 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">\r
243 <TD COLSPAN=2><FONT SIZE="+2">\r
244 <B>Method Summary</B></FONT></TD>\r
245 </TR>\r
246 <TR BGCOLOR="white" CLASS="TableRowColor">\r
247 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">\r
248 <CODE>&nbsp;boolean</CODE></FONT></TD>\r
249 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/lexicon/LetterToSoundImpl.html#compare(com.sun.speech.freetts.lexicon.LetterToSoundImpl)">compare</A></B>(<A HREF="../../../../../com/sun/speech/freetts/lexicon/LetterToSoundImpl.html" title="class in com.sun.speech.freetts.lexicon">LetterToSoundImpl</A>&nbsp;other)</CODE>\r
250 \r
251 <BR>\r
252 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Compares this LTS to another for debugging purposes.</TD>\r
253 </TR>\r
254 <TR BGCOLOR="white" CLASS="TableRowColor">\r
255 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">\r
256 <CODE>&nbsp;void</CODE></FONT></TD>\r
257 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/lexicon/LetterToSoundImpl.html#dumpBinary(java.lang.String)">dumpBinary</A></B>(java.lang.String&nbsp;path)</CODE>\r
258 \r
259 <BR>\r
260 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dumps a binary form of the letter to sound rules.
261  </TD>\r
262 </TR>\r
263 <TR BGCOLOR="white" CLASS="TableRowColor">\r
264 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">\r
265 <CODE>protected &nbsp;char[]</CODE></FONT></TD>\r
266 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/lexicon/LetterToSoundImpl.html#getFullBuff(java.lang.String)">getFullBuff</A></B>(java.lang.String&nbsp;word)</CODE>\r
267 \r
268 <BR>\r
269 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Makes a character array that looks like "000#word#000".</TD>\r
270 </TR>\r
271 <TR BGCOLOR="white" CLASS="TableRowColor">\r
272 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">\r
273 <CODE>&nbsp;java.lang.String[]</CODE></FONT></TD>\r
274 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/lexicon/LetterToSoundImpl.html#getPhones(java.lang.String, java.lang.String)">getPhones</A></B>(java.lang.String&nbsp;word,
275           java.lang.String&nbsp;partOfSpeech)</CODE>\r
276 \r
277 <BR>\r
278 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Calculates the phone list for a given word.  </TD>\r
279 </TR>\r
280 <TR BGCOLOR="white" CLASS="TableRowColor">\r
281 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">\r
282 <CODE>protected &nbsp;com.sun.speech.freetts.lexicon.LetterToSoundImpl.State</CODE></FONT></TD>\r
283 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/lexicon/LetterToSoundImpl.html#getState(int)">getState</A></B>(int&nbsp;i)</CODE>\r
284 \r
285 <BR>\r
286 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Gets the <code>State</code> at the given index.  </TD>\r
287 </TR>\r
288 <TR BGCOLOR="white" CLASS="TableRowColor">\r
289 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">\r
290 <CODE>protected &nbsp;com.sun.speech.freetts.lexicon.LetterToSoundImpl.State</CODE></FONT></TD>\r
291 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/lexicon/LetterToSoundImpl.html#getState(java.lang.String)">getState</A></B>(java.lang.String&nbsp;s)</CODE>\r
292 \r
293 <BR>\r
294 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Gets the <code>State</code> based upon the <code>String</code>.</TD>\r
295 </TR>\r
296 <TR BGCOLOR="white" CLASS="TableRowColor">\r
297 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">\r
298 <CODE>protected &nbsp;com.sun.speech.freetts.lexicon.LetterToSoundImpl.State</CODE></FONT></TD>\r
299 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/lexicon/LetterToSoundImpl.html#getState(java.lang.String, java.util.StringTokenizer)">getState</A></B>(java.lang.String&nbsp;type,
300          java.util.StringTokenizer&nbsp;tokenizer)</CODE>\r
301 \r
302 <BR>\r
303 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Gets the <code>State</code> based upon the <code>type</code>
304  and <code>tokenizer<code>.</TD>\r
305 </TR>\r
306 <TR BGCOLOR="white" CLASS="TableRowColor">\r
307 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">\r
308 <CODE>static&nbsp;void</CODE></FONT></TD>\r
309 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/lexicon/LetterToSoundImpl.html#main(java.lang.String[])">main</A></B>(java.lang.String[]&nbsp;args)</CODE>\r
310 \r
311 <BR>\r
312 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Translates between text and binary forms of the CMU6 LTS rules.</TD>\r
313 </TR>\r
314 <TR BGCOLOR="white" CLASS="TableRowColor">\r
315 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">\r
316 <CODE>protected &nbsp;void</CODE></FONT></TD>\r
317 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/lexicon/LetterToSoundImpl.html#parseAndAdd(java.lang.String)">parseAndAdd</A></B>(java.lang.String&nbsp;line)</CODE>\r
318 \r
319 <BR>\r
320 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a word from the given input line and add it to the state
321  machine.  </TD>\r
322 </TR>\r
323 </TABLE>\r
324 &nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
325 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">\r
326 <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">\r
327 <TD><B>Methods inherited from class java.lang.Object</B></TD>\r
328 </TR>\r
329 <TR BGCOLOR="white" CLASS="TableRowColor">\r
330 <TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>\r
331 </TR>\r
332 </TABLE>\r
333 &nbsp;\r
334 <P>\r
335 \r
336 <!-- ============ FIELD DETAIL =========== -->\r
337 \r
338 <A NAME="field_detail"><!-- --></A>
339 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">\r
340 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">\r
341 <TD COLSPAN=1><FONT SIZE="+2">\r
342 <B>Field Detail</B></FONT></TD>\r
343 </TR>\r
344 </TABLE>\r
345 \r
346 <A NAME="tokenizeOnLoad"><!-- --></A><H3>\r
347 tokenizeOnLoad</H3>\r
348 <PRE>\r
349 protected boolean <B>tokenizeOnLoad</B></PRE>\r
350 <DL>\r
351 <DD>If true, the state string is tokenized when it is first read.
352  The side effects of this are quicker lookups, but more memory
353  usage and a longer startup time.\r
354 <P>\r
355 <DL>\r
356 </DL>\r
357 </DL>\r
358 <HR>\r
359 \r
360 <A NAME="tokenizeOnLookup"><!-- --></A><H3>\r
361 tokenizeOnLookup</H3>\r
362 <PRE>\r
363 protected boolean <B>tokenizeOnLookup</B></PRE>\r
364 <DL>\r
365 <DD>If true, the state string is tokenized the first time it is
366  referenced.  The side effects of this are quicker lookups, but
367  more memory usage.\r
368 <P>\r
369 <DL>\r
370 </DL>\r
371 </DL>\r
372 <HR>\r
373 \r
374 <A NAME="letterIndex"><!-- --></A><H3>\r
375 letterIndex</H3>\r
376 <PRE>\r
377 protected java.util.HashMap <B>letterIndex</B></PRE>\r
378 <DL>\r
379 <DD>The indexes of the starting points for letters in the state machine.\r
380 <P>\r
381 <DL>\r
382 </DL>\r
383 </DL>\r
384 \r
385 <!-- ========= CONSTRUCTOR DETAIL ======== -->\r
386 \r
387 <A NAME="constructor_detail"><!-- --></A>
388 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">\r
389 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">\r
390 <TD COLSPAN=1><FONT SIZE="+2">\r
391 <B>Constructor Detail</B></FONT></TD>\r
392 </TR>\r
393 </TABLE>\r
394 \r
395 <A NAME="LetterToSoundImpl(java.net.URL, boolean)"><!-- --></A><H3>\r
396 LetterToSoundImpl</H3>\r
397 <PRE>\r
398 public <B>LetterToSoundImpl</B>(java.net.URL&nbsp;ltsRules,
399                          boolean&nbsp;binary)
400                   throws java.io.IOException</PRE>\r
401 <DL>\r
402 <DD>Class constructor.\r
403 <P>\r
404 <DT><B>Parameters:</B><DD><CODE>ltsRules</CODE> - a URL pointing to the text
405    containing the letter to sound rules<DD><CODE>binary</CODE> - if true, the URL is a binary source
406 <DT><B>Throws:</B>
407 <DD><CODE>java.lang.NullPointerException</CODE> - if the ltsRules are null
408 <DD><CODE>java.io.IOException</CODE> - if errors are encountered while reading the
409    compiled form or the addenda</DL>\r
410 \r
411 <!-- ============ METHOD DETAIL ========== -->\r
412 \r
413 <A NAME="method_detail"><!-- --></A>
414 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">\r
415 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">\r
416 <TD COLSPAN=1><FONT SIZE="+2">\r
417 <B>Method Detail</B></FONT></TD>\r
418 </TR>\r
419 </TABLE>\r
420 \r
421 <A NAME="parseAndAdd(java.lang.String)"><!-- --></A><H3>\r
422 parseAndAdd</H3>\r
423 <PRE>\r
424 protected void <B>parseAndAdd</B>(java.lang.String&nbsp;line)</PRE>\r
425 <DL>\r
426 <DD>Creates a word from the given input line and add it to the state
427  machine.  It expects the TOTAL line to come before any of the
428  states.\r
429 <P>\r
430 <DD><DL>\r
431 </DL>\r
432 </DD>\r
433 <DD><DL>\r
434 <DT><B>Parameters:</B><DD><CODE>line</CODE> - the line of text from the input file</DL>\r
435 </DD>\r
436 </DL>\r
437 <HR>\r
438 \r
439 <A NAME="dumpBinary(java.lang.String)"><!-- --></A><H3>\r
440 dumpBinary</H3>\r
441 <PRE>\r
442 public void <B>dumpBinary</B>(java.lang.String&nbsp;path)
443                 throws java.io.IOException</PRE>\r
444 <DL>\r
445 <DD>Dumps a binary form of the letter to sound rules.
446  This method is not thread-safe.
447
448  <p>Binary format is:
449  <pre>
450    MAGIC
451    VERSION
452    NUM STATES
453    for each state ...
454  </pre>\r
455 <P>\r
456 <DD><DL>\r
457 </DL>\r
458 </DD>\r
459 <DD><DL>\r
460 <DT><B>Parameters:</B><DD><CODE>path</CODE> - the path to dump the file to
461 <DT><B>Throws:</B>
462 <DD><CODE>java.io.IOException</CODE> - if a problem occurs during the dump</DL>\r
463 </DD>\r
464 </DL>\r
465 <HR>\r
466 \r
467 <A NAME="getState(int)"><!-- --></A><H3>\r
468 getState</H3>\r
469 <PRE>\r
470 protected com.sun.speech.freetts.lexicon.LetterToSoundImpl.State <B>getState</B>(int&nbsp;i)</PRE>\r
471 <DL>\r
472 <DD>Gets the <code>State</code> at the given index.  This may
473  replace a <code>String</code> at
474  the current spot with an actual <code>State</code> instance.\r
475 <P>\r
476 <DD><DL>\r
477 </DL>\r
478 </DD>\r
479 <DD><DL>\r
480 <DT><B>Parameters:</B><DD><CODE>i</CODE> - the index into the state machine
481 <DT><B>Returns:</B><DD>the <code>State</code> at the given index.</DL>\r
482 </DD>\r
483 </DL>\r
484 <HR>\r
485 \r
486 <A NAME="getState(java.lang.String)"><!-- --></A><H3>\r
487 getState</H3>\r
488 <PRE>\r
489 protected com.sun.speech.freetts.lexicon.LetterToSoundImpl.State <B>getState</B>(java.lang.String&nbsp;s)</PRE>\r
490 <DL>\r
491 <DD>Gets the <code>State</code> based upon the <code>String</code>.\r
492 <P>\r
493 <DD><DL>\r
494 </DL>\r
495 </DD>\r
496 <DD><DL>\r
497 <DT><B>Parameters:</B><DD><CODE>s</CODE> - the string to parse
498 <DT><B>Returns:</B><DD>the parsed <code>State</code></DL>\r
499 </DD>\r
500 </DL>\r
501 <HR>\r
502 \r
503 <A NAME="getState(java.lang.String, java.util.StringTokenizer)"><!-- --></A><H3>\r
504 getState</H3>\r
505 <PRE>\r
506 protected com.sun.speech.freetts.lexicon.LetterToSoundImpl.State <B>getState</B>(java.lang.String&nbsp;type,
507                                                                           java.util.StringTokenizer&nbsp;tokenizer)</PRE>\r
508 <DL>\r
509 <DD>Gets the <code>State</code> based upon the <code>type</code>
510  and <code>tokenizer<code>.\r
511 <P>\r
512 <DD><DL>\r
513 </DL>\r
514 </DD>\r
515 <DD><DL>\r
516 <DT><B>Parameters:</B><DD><CODE>type</CODE> - one of <code>STATE</code> or <code>PHONE</code><DD><CODE>tokenizer</CODE> - a <code>StringTokenizer</code> containing the
517    <code>State</code>
518 <DT><B>Returns:</B><DD>the parsed <code>State</code></DL>\r
519 </DD>\r
520 </DL>\r
521 <HR>\r
522 \r
523 <A NAME="getFullBuff(java.lang.String)"><!-- --></A><H3>\r
524 getFullBuff</H3>\r
525 <PRE>\r
526 protected char[] <B>getFullBuff</B>(java.lang.String&nbsp;word)</PRE>\r
527 <DL>\r
528 <DD>Makes a character array that looks like "000#word#000".\r
529 <P>\r
530 <DD><DL>\r
531 </DL>\r
532 </DD>\r
533 <DD><DL>\r
534 <DT><B>Parameters:</B><DD><CODE>word</CODE> - the original word
535 <DT><B>Returns:</B><DD>the padded word</DL>\r
536 </DD>\r
537 </DL>\r
538 <HR>\r
539 \r
540 <A NAME="getPhones(java.lang.String, java.lang.String)"><!-- --></A><H3>\r
541 getPhones</H3>\r
542 <PRE>\r
543 public java.lang.String[] <B>getPhones</B>(java.lang.String&nbsp;word,
544                                     java.lang.String&nbsp;partOfSpeech)</PRE>\r
545 <DL>\r
546 <DD>Calculates the phone list for a given word.  If a phone list cannot
547  be determined, <code>null</code> is returned.  This particular
548  implementation ignores the part of speech.\r
549 <P>\r
550 <DD><DL>\r
551 <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../com/sun/speech/freetts/lexicon/LetterToSound.html#getPhones(java.lang.String, java.lang.String)">getPhones</A></CODE> in interface <CODE><A HREF="../../../../../com/sun/speech/freetts/lexicon/LetterToSound.html" title="interface in com.sun.speech.freetts.lexicon">LetterToSound</A></CODE></DL>\r
552 </DD>\r
553 <DD><DL>\r
554 <DT><B>Parameters:</B><DD><CODE>word</CODE> - the word to find<DD><CODE>partOfSpeech</CODE> - the part of speech.
555 <DT><B>Returns:</B><DD>the list of phones for word or <code>null</code></DL>\r
556 </DD>\r
557 </DL>\r
558 <HR>\r
559 \r
560 <A NAME="compare(com.sun.speech.freetts.lexicon.LetterToSoundImpl)"><!-- --></A><H3>\r
561 compare</H3>\r
562 <PRE>\r
563 public boolean <B>compare</B>(<A HREF="../../../../../com/sun/speech/freetts/lexicon/LetterToSoundImpl.html" title="class in com.sun.speech.freetts.lexicon">LetterToSoundImpl</A>&nbsp;other)</PRE>\r
564 <DL>\r
565 <DD>Compares this LTS to another for debugging purposes.\r
566 <P>\r
567 <DD><DL>\r
568 </DL>\r
569 </DD>\r
570 <DD><DL>\r
571 <DT><B>Parameters:</B><DD><CODE>other</CODE> - the other LTS to compare to
572 <DT><B>Returns:</B><DD><code>true</code> if these are equivalent</DL>\r
573 </DD>\r
574 </DL>\r
575 <HR>\r
576 \r
577 <A NAME="main(java.lang.String[])"><!-- --></A><H3>\r
578 main</H3>\r
579 <PRE>\r
580 public static void <B>main</B>(java.lang.String[]&nbsp;args)</PRE>\r
581 <DL>\r
582 <DD>Translates between text and binary forms of the CMU6 LTS rules.\r
583 <P>\r
584 <DD><DL>\r
585 </DL>\r
586 </DD>\r
587 <DD><DL>\r
588 </DL>\r
589 </DD>\r
590 </DL>\r
591 <!-- ========= END OF CLASS DATA ========= -->\r
592 <HR>\r
593 \r
594
595 <!-- ======= START OF BOTTOM NAVBAR ====== -->\r
596 <A NAME="navbar_bottom"><!-- --></A>
597 <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
598 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">\r
599 <TR>\r
600 <TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">\r
601 <A NAME="navbar_bottom_firstrow"><!-- --></A>
602 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">\r
603   <TR ALIGN="center" VALIGN="top">\r
604   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>\r
605   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>\r
606   <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>\r
607   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>\r
608   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>\r
609   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>\r
610   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>\r
611   </TR>\r
612 </TABLE>\r
613 </TD>\r
614 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>\r
615 </EM>\r
616 </TD>\r
617 </TR>\r
618 \r
619 <TR>\r
620 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">\r
621 &nbsp;PREV CLASS&nbsp;\r
622 &nbsp;<A HREF="../../../../../com/sun/speech/freetts/lexicon/LexiconImpl.html" title="class in com.sun.speech.freetts.lexicon"><B>NEXT CLASS</B></A></FONT></TD>\r
623 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">\r
624   <A HREF="../../../../../index.html" target="_top"><B>FRAMES</B></A>  &nbsp;\r
625 &nbsp;<A HREF="LetterToSoundImpl.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;\r
626 &nbsp;<SCRIPT type="text/javascript">\r
627   <!--\r
628   if(window==top) {\r
629     document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');\r
630   }\r
631   //-->\r
632 </SCRIPT>\r
633 <NOSCRIPT>\r
634   <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>\r
635 </NOSCRIPT>
636 \r
637 </FONT></TD>\r
638 </TR>\r
639 <TR>\r
640 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">\r
641   SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>\r
642 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">\r
643 DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>\r
644 </TR>\r
645 </TABLE>\r
646 <A NAME="skip-navbar_bottom"></A>
647 <!-- ======== END OF BOTTOM NAVBAR ======= -->\r
648 \r
649 <HR>\r
650 \r
651 </BODY>\r
652 </HTML>\r