  <sect1 id='dp-manual'>
	<title><command>dp</command> <emphasis> Perform dynamic programming on label sequences</emphasis></title>

    <toc depth='1'></toc>
    <para>
    </para>
    <sect2>
      <title>Synopsis</title>
      <para>
      </para>
        <!-- /amd/projects/festival/versions/v_mpiro/speech_tools_linux/bin/dp -sgml_synopsis -->
        <para>
<cmdsynopsis><command>dp</command>Usage:<arg>-vocab <replaceable>string</replaceable></arg>
<arg>-place_holder <replaceable>string</replaceable></arg>
<arg>-show_cost </arg>
<arg>-o <replaceable>string</replaceable></arg>
<arg>-p <replaceable>int</replaceable></arg>
<arg>-i <replaceable>float</replaceable></arg>
<arg>-d <replaceable>float</replaceable></arg>
<arg>-s <replaceable>float</replaceable></arg>
<arg>-cost_matrix <replaceable>string</replaceable></arg>
</cmdsynopsis>
        </para>
        <!-- DONE /amd/projects/festival/versions/v_mpiro/speech_tools_linux/bin/dp -sgml_synopsis -->
      <para>

dp provides simple dynamic programming to find the lowest cost
alignment of two symbol sequences. Possible uses include:
<itemizedlist>
<listitem><para>Label alignment (e.g. speech recogniser output scoring) </para></listitem>
</itemizedlist>
The costs of inserting/deleting/substituting symbols can be given
either with command line options, or as a file containing a full
matrix of costs. In the former case, all insertions will have the same
cost. In the latter case, each row of the file contains the cost of
replacing a symbol in sequence 1 with each possible symbol in the
vocabulary to align with sequence 2, including a special "place
holder" symbol used for insertions/deletions. See the examples
below. The place holder can be redefined.
The output is an EST utterance with three Relations: the first two are
the input sequences, and the third shows the alignment found by
dynamic programming.
      </para>
    </sect2>
    <sect2>
      <title>Options</title>
      <para>
      </para>
        <!-- /amd/projects/festival/versions/v_mpiro/speech_tools_linux/bin/dp -sgml_options -->
        <para>
<variablelist>
<varlistentry><term>-vocab</term>
<LISTITEM><PARA>
<replaceable>string</replaceable>

file containing vocabulary 
</PARA></LISTITEM>
</varlistentry>

<varlistentry><term>-place_holder</term>
<LISTITEM><PARA>
<replaceable>string</replaceable>

which vocab item is the place holder (default is <null> ) 
</PARA></LISTITEM>
</varlistentry>

<varlistentry><term>-show_cost</term>
<LISTITEM><PARA>

show cost of matching path 
</PARA></LISTITEM>
</varlistentry>

<varlistentry><term>-o</term>
<LISTITEM><PARA>
<replaceable>string</replaceable>

output file 
</PARA></LISTITEM>
</varlistentry>

<varlistentry><term>-p</term>
<LISTITEM><PARA>
<replaceable>int</replaceable>

'beam' width 
Either: 
</PARA></LISTITEM>
</varlistentry>

<varlistentry><term>-i</term>
<LISTITEM><PARA>
<replaceable>float</replaceable>

insertion cost 
</PARA></LISTITEM>
</varlistentry>

<varlistentry><term>-d</term>
<LISTITEM><PARA>
<replaceable>float</replaceable>

deletion cost 
</PARA></LISTITEM>
</varlistentry>

<varlistentry><term>-s</term>
<LISTITEM><PARA>
<replaceable>float</replaceable>

substitution cost 
Or: 
</PARA></LISTITEM>
</varlistentry>

<varlistentry><term>-cost_matrix</term>
<LISTITEM><PARA>
<replaceable>string</replaceable>

file containing cost matrix </PARA></LISTITEM>
</varlistentry>
</variablelist>
        </para>
        <!-- DONE /amd/projects/festival/versions/v_mpiro/speech_tools_linux/bin/dp -sgml_options -->
    </sect2>
    <sect2>
      <title>Examples</title>
      <para>
<para>
Align two symbol sequences:
</para>
<para>
<screen>
$ dp -vocab vocab.file "a b c" "a b d c" -i 1 -d 2 -s 3
</screen>
</para>
<para>
where vocab.file contains "a b c d"
</para>
<para>
Or, using a full cost matrix:
</para>
<para>
<screen>
$ dp -vocab vocab2.file -cost_matrix foo "a b c" "a b d c"
</screen>
</para>
<para>
where vocab2.file contains "a b c d <null>" and the file foo contains:
</para>
<para>
<screen>
<para>0 3 3 3 2</para>
<para>3 0 3 3 2</para>
<para>3 3 0 3 2</para>
<para>3 3 3 0 2</para>
<para>1 1 1 1 0</para>
</screen>
</para>
<para> Each row of foo shows the cost of replacing an input symbol
with each symbol in the vocabulary to match an output symbol. Each row
corresponds to an item in the vocabulary (in the order they appear in
the vocabulary file). In the example, replacing 'a' with 'a' costs 0,
replacing 'a' with any of 'b' 'c' or 'd' costs 3 (a substitution), and
replacing 'a' with the place holder symbol 'null' costs 2 (a
deletion). The cost of replacing 'null' with anything other than
'null' costs 1 (an insertion).  The costs of 1,2 and 3 used here are
only for illustration. The cost matrix meed not have the form above -
for example, replacing 'a' with 'a' need not cost 0. The entries in
foo are read as floats.  </para>
      </para>
    </sect2>
  </sect1>
