/usr/share/doc/festival-doc/html/Lookup-process.html is in festival-doc 1:2.5.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Lookup process (Festival Speech Synthesis System)</title>
<meta name="description" content="Lookup process (Festival Speech Synthesis System)">
<meta name="keywords" content="Lookup process (Festival Speech Synthesis System)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="index.html#Top" rel="start" title="Top">
<link href="Index.html#Index" rel="index" title="Index">
<link href="Index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Lexicons.html#Lexicons" rel="up" title="Lexicons">
<link href="Letter-to-sound-rules.html#Letter-to-sound-rules" rel="next" title="Letter to sound rules">
<link href="Defining-lexicons.html#Defining-lexicons" rel="prev" title="Defining lexicons">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Lookup-process"></a>
<div class="header">
<p>
Next: <a href="Letter-to-sound-rules.html#Letter-to-sound-rules" accesskey="n" rel="next">Letter to sound rules</a>, Previous: <a href="Defining-lexicons.html#Defining-lexicons" accesskey="p" rel="prev">Defining lexicons</a>, Up: <a href="Lexicons.html#Lexicons" accesskey="u" rel="up">Lexicons</a> [<a href="Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html#Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Lookup-process-1"></a>
<h3 class="section">13.3 Lookup process</h3>
<p>When looking up a word, either through the C++ interface, or
Lisp interface, a word is identified by its headword and part of
speech. If no part of speech is specified, <code>nil</code> is assumed
which matches any part of speech tag.
</p>
<p>The lexicon look up process first checks the addenda, if there is
a full match (head word plus part of speech) it is returned. If
there is an addenda entry whose head word matches and whose part
of speech is <code>nil</code> that entry is returned.
</p>
<p>If no match is found in the addenda, the compiled lexicon, if present,
is checked. Again a match is when both head word and part of speech tag
match, or either the word being searched for has a part of speech
<code>nil</code> or an entry has its tag as <code>nil</code>. Unlike the addenda,
if no full head word and part of speech tag match is found, the first
word in the lexicon whose head word matches is returned. The rationale
is that the letter to sound rules (the next defence) are unlikely to be
better than an given alternate pronunciation for a the word but
different part of speech. Even more so given that as there is an entry
with the head word but a different part of speech this word may have an
unusual pronunciation that the letter to sound rules will have no chance
in producing.
</p>
<p>Finally if the word is not found in the compiled lexicon it is
passed to whatever method is defined for unknown words. This
is most likely a letter to sound module. See <a href="Letter-to-sound-rules.html#Letter-to-sound-rules">Letter to sound rules</a>.
</p>
<a name="index-lexicon-hooks"></a>
<a name="index-lookup-hooks"></a>
<p>Optional pre- and post-lookup hooks can be specified for a lexicon.
As a single (or list of) Lisp functions. The pre-hooks will
be called with two arguments (word and features) and should return
a pair (word and features). The post-hooks will be given a
lexical entry and should return a lexical entry. The pre- and
post-hooks do nothing by default.
</p>
<a name="index-compiled-lexicons"></a>
<p>Compiled lexicons may be created from lists of lexical entries.
A compiled lexicon is <em>much</em> more efficient for look up than the
addenda. Compiled lexicons use a binary search method while the
addenda is searched linearly. Also it would take a prohibitively
long time to load in a typical full lexicon as an addenda. If you
have more than a few hundred entries in your addenda you should
seriously consider adding them to your compiled lexicon.
</p>
<a name="index-BEEP-lexicon"></a>
<a name="index-CMU-lexicon"></a>
<p>Because many publicly available lexicons do not have syllable markings
for entries the compilation method supports automatic syllabification.
Thus for lexicon entries for compilation, two forms for the
pronunciation field are supported: the standard full syllabified and
stressed form and a simpler linear form found in at least the BEEP and
CMU lexicons. If the pronunciation field is a flat atomic list it is
assumed syllabification is required.
</p>
<a name="index-syllabification"></a>
<p>Syllabification is done by finding the minimum sonorant position between
vowels. It is not guaranteed to be accurate but does give a solution
that is sufficient for many purposes. A little work would probably
improve this significantly. Of course syllabification requires the
entry’s phones to be in the current phone set. The sonorant values are
calculated from the <em>vc</em>, <em>ctype</em>, and <em>cvox</em> features
for the current phoneset. See
<samp>src/arch/festival/Phone.cc:ph_sonority()</samp> for actual definition.
</p>
<p>Additionally in this flat structure vowels (atoms starting with a, e, i,
o or u) may have 1 2 or 0 appended marking stress. This is again
following the form found in the BEEP and CMU lexicons.
</p>
<p>Some example entries in the flat form (taken from BEEP) are
</p><div class="lisp">
<pre class="lisp">("table" nil (t ei1 b l))
("suspicious" nil (s @ s p i1 sh @ s))
</pre></div>
<p>Also if syllabification is required there is an opportunity to run a set
of "letter-to-sound"-rules on the input (actually an arbitrary re-write
rule system). If the variable <code>lex_lts_set</code> is set, the lts
ruleset of that name is applied to the flat input before
syllabification. This allows simple predictable changes such as
conversion of final r into longer vowel for English RP from
American labelled lexicons.
</p>
<a name="index-multiple-lexical-entries"></a>
<p>A list of all matching entries in the addenda and the compiled lexicon
may be found by the function <code>lex.lookup_all</code>. This function takes
a word and returns all matching entries irrespective of part of speech.
</p>
<a name="index-pre_005fhooks"></a>
<a name="index-post_005fhooks"></a>
<p>You can optionally intercept the words as they are looked up, and after
they have been found through <code>pre_hooks</code> and <code>post_hooks</code> for
each lexicon. This allows a function or list of functions to be applied
to a word and feature before lookup or to the resulting entry after
lookup. The following example shows how to add voice specific entries
to a general lexicon without affecting other voices that use that
lexicon.
</p>
<p>For example suppose we were trying to use a Scottish English voice with
the US English (cmu) lexicon. A number of entries will be
inappropriate but we can redefine some entries thus
</p><div class="lisp">
<pre class="lisp">(set! cmu_us_awb::lexicon_addenda
'(
("edinburgh" n (((eh d) 1) ((ax n) 0) ((b r ax) 0)))
("poem" n (((p ow) 1) ((y ax m) 0)))
("usual" n (((y uw) 1) ((zh ax l) 0)))
("air" n (((ey r) 1)))
("hair" n (((hh ey r) 1)))
("fair" n (((f ey r) 1)))
("chair" n (((ch ey r) 1)))))
</pre></div>
<p>We can then define a function that checks to see if the word looked
up is in the speaker specific exception list and use that entry
instead.
</p><div class="lisp">
<pre class="lisp">(define (cmu_us_awb::cmu_lookup_post entry)
"(cmu_us_awb::cmu_lookup_post entry)
Speaker specific lexicon addeda."
(let ((ne
(assoc_string (car entry) cmu_us_awb::lexicon_addenda)))
(if ne
ne
entry)))
</pre></div>
<p>And then for the particular voice set up we need to
add both a selection part <em>and</em> a reset part. Thus following
the FestVox conventions for voice set up.
</p><div class="lisp">
<pre class="lisp">(define (cmu_us_awb::select_lexicon)
...
(lex.select "cmu")
;; Get old var for reset and to append our function to is
(set! cmu_us_awb::old_cmu_post_hooks
(lex.set.post_hooks nil))
(lex.set.post_hooks
(append cmu_us_awb::old_cmu_post_hooks
(list cmu_us_awb::cmu_lookup_post)))
...
)
...
(define (cmu_us_awb::reset_lexicon)
...
;; reset CMU's post_hooks back to original
(lex.set.post_hooks cmu_us_awb::old_cmu_post_hooks)
...
)
</pre></div>
<p>The above isn’t the most efficient way as the word is looked up first
then it is checked with the speaker specific list.
</p>
<p>The <code>pre_hooks</code> functions are called with two arguments, the
word and features, they should return a pair of word and features.
</p>
<hr>
<div class="header">
<p>
Next: <a href="Letter-to-sound-rules.html#Letter-to-sound-rules" accesskey="n" rel="next">Letter to sound rules</a>, Previous: <a href="Defining-lexicons.html#Defining-lexicons" accesskey="p" rel="prev">Defining lexicons</a>, Up: <a href="Lexicons.html#Lexicons" accesskey="u" rel="up">Lexicons</a> [<a href="Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html#Index" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>
|