<?php $isip_window_title = "ISIP Homepage"; ?>
<?php include("/data/isip/www/templates/documentation/header/header.html"); ?>

<!--#set var="isip_page_title" value="NGramParser" -->
<?php include("/data/isip/www/templates/documentation/body/index_class.html"); ?>
<?php include("/data/isip/www/templates/documentation/body/bar.html"); ?>

<a name="name">
<b>

name:
<a href="/perl/ifc_document.pl?file=$isip/class/mmedia/NGramParser/NGramParser.h">NGramParser</a>

</b>
<br><br>

<a name="synopsis">
<b>synopsis:</b>
<br><br>

<blockquote>
<pre>

g++ [flags ...] file ... -l /isip/tools/lib/$ISIP_BINARY/lib_mmedia.a

#include &lt;NGramParser.h&gt;

boolean setOrder(long order);
long getOrder() const;
boolean load(Sof& sof, HashTable&lt;Long, NGramNode&gt;& gram_hash, const Vector&lt;String&gt;& symbol_table, const long& tag, const String& name);
boolean NGramParser::store(Sof& file, const HashTable&lt;Long, NGramNode&gt;& gram_hash, const Vector&lt;String&gt;& symbol_table, const long& tag, const String& name) const;
</pre>
</blockquote>

<a name="quick_start">
<b>quick start:</b>
<br><br>

<blockquote>
<pre>

Sof tmp_sof;
String file_name;
Vector<String> symbol_table;
HashTable<Long, NGramNode> gram_hash;

file_name.assign(L"tidigits_trigram.arpa");
tmp_sof.open(file_name, File::READ_ONLY);

NGramParser np_00;

np_00.load(tmp_sof, gram_hash, symbol_table, 1, L"NGramModel");

tmp_sof.close();

</pre>
</blockquote>

<a name="description">
<b>description:</b>
<br><br>

This class manages the N-gram grammar. It can be used to convert NIST_ARPA or
other grammar format to ISIP internal format.

<br><br>

<a name="dependencies">
<b>dependencies:</b>
<br><br>

<ul>
  <li> <a href="../../dstr/HashTable/">HashTable.h</a>
  <li> <a href="../NGramNode/">NGramNode.h</a>
</ul>

<a name="constants">
<b>public constants:</b>
<br><br>

<ul>
  <li> define the class name:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/NGramParser/ngmp_00.cc&constant=CLASS_NAME">static const String CLASS_NAME;</a></pre>

  <li> define the file format choices:
       
       <pre>enum FORMAT { NGRAM_ARPA = 0, DEF_FORMAT = NGRAM_ARPA };</pre>
       
  <li> define default values and arguments:
       
       <pre>static const long DEF_ORDER = (long)0;</pre>

</ul>

<a name="error">
<b>error codes:</b>
<br><br>

<ul>
  <li> error codes indicating general errors:

       <pre><a href="/perl/ifc_document.pl?err=00050600">static const long ERR = 50600;</a></pre>

       <pre><a href="/perl/ifc_document.pl?err=00050601">static const long ERR_ORDER = 50601;</a></pre>

       <pre><a href="/perl/ifc_document.pl?err=00506012">static const long ERR_TAG = 506012;</a></pre>

       <pre><a href="/perl/ifc_document.pl?err=00050603">static const long ERR_SYMBOL = 50603;</a></pre>

       <pre><a href="/perl/ifc_document.pl?err=00050604">static const long ERR_HASH = 50604;</a></pre>

       <pre><a href="/perl/ifc_document.pl?err=00050605">static const long ERR_FORMAT = 50605;</a></pre>

       <pre><a href="/perl/ifc_document.pl?err=00050606">static const long ERR_NUM_GRAM = 50606;</a></pre>

</ul>

<a name="protected">
<b>protected data:</b>
<br><br>

<ul>
  <li> declare the order of N-gram:

       <pre>long order_d;</pre>

  <li> declare the debugging parameters:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/NGramParser/ngmp_00.cc&static=debug_level_d">static Integral::DEBUG debug_level_d;</a></pre>

  <li> declare the memory manager:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/NGramParser/ngmp_00.cc&static=mgr_d">static MemoryManager mgr_d;</a></pre>

</ul>

<a name="public">
<b>required public methods:</b>
<br><br>

<ul>
  <li> static methods:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/NGramParser/NGramParser.h&method=name&instance=0">static const String& name();</a></pre>

  <li> debug methods:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/NGramParser/ngmp_02.cc&method=diagnose&instance=0">static boolean diagnose(Integral::DEBUG debug_level);</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/NGramParser/NGramParser.h&method=debug&instance=0">boolean debug(const unichar* msg) const;</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/NGramParser/NGramParser.h&method=setDebug&instance=0">static boolean setDebug(Integral::DEBUG debug_level);</a></pre>

  <li> destructor/constructor(s):

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/NGramParser/NGramParser.h&method=destructor&instance=0">~NGramParser();</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/NGramParser/NGramParser.h&method=default+constructor&instance=0">NGramParser(long order = DEF_ORDER);</a></pre>

  <li> assign methods:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/NGramParser/NGramParser.h&method=assign&instance=0">boolean assign(const NGramParser& arg);</a></pre>

  <li> operator= method:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/NGramParser/NGramParser.h&method=operator%3D&instance=0">NGramParser& operator= (const NGramParser& arg);</a></pre>

  <li> i/o methods:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/NGramParser/NGramParser.h&method=sofSize&instance=0">long sofSize() const;</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/NGramParser/NGramParser.h&method=read&instance=0">boolean read(Sof& sof, const long& tag, const String& cname = CLASS_NAME);</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/NGramParser/NGramParser.h&method=write&instance=0">boolean write(Sof& sof, long tag, const String& cname = CLASS_NAME) const;</a></pre>

  <li> equality methods:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/NGramParser/NGramParser.h&method=eq&instance=0">boolean eq(const NGramParser& arg) const;</a></pre>

  <li> memory management methods:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/NGramParser/NGramParser.h&method=new&instance=0">static void* operator new(size_t size);</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/NGramParser/NGramParser.h&method=new\[\]&instance=0">static void* operator new[](size_t size);</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/NGramParser/NGramParser.h&method=delete&instance=0">static void operator delete(void* ptr);</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/NGramParser/NGramParser.h&method=delete\[\]&instance=0">static void operator delete[](void* ptr);</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/NGramParser/NGramParser.h&method=setGrowSize&instance=0">static boolean setGrowSize(long grow_size);</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/NGramParser/NGramParser.h&method=clear&instance=0">boolean clear(Integral::CMODE ctype = Integral::DEF_CMODE);</a></pre>

</ul>

<a name="specific">
<b>class-specific public methods:</b>
<br><br>

<ul>
  <li> declare ngram order methods:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/NGramParser/NGramParser.h&method=setOrder&instance=0">boolean setOrder(long order);</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/NGramParser/NGramParser.h&method=getOrder&instance=0">long getOrder() const;</a></pre>

  <li> declare i/o methods:
       
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/NGramParser/ngmp_05.cc&method=load&instance=0">boolean load(Sof& sof, HashTable&lt;Long, NGramNode&gt;& gram_hash, const Vector&lt;String&gt;& symbol_table, const long& tag, const String& name);</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/NGramParser/ngmp_05.cc&method=store&instance=0">boolean NGramParser::store(Sof& file, const HashTable&lt;Long, NGramNode&gt;& gram_hash, const Vector&lt;String&gt;& symbol_table, const long& tag, const String& name) const;</a></pre>

</ul>

<a name="private">
<b>private methods:</b>
<br><br>

<ul>
  <li> declare private methods:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/NGramParser/ngmp_05.cc&method=storeToHash&instance=0">boolean storeToHash(HashTable&lt;Long, NGramNode&gt;& gram_hash, SingleLinkedList&lt;NGramNode&gt;& symbol_list, NGramNode* prefix_node);</a></pre>

</ul>

<a name="examples">
<b>examples:</b>
<br><br>

<ul>
  <li> none.

<pre>
</pre>
</ul>

<a name="notes">
<b>notes:</b>
<br><br>

<ul>
  <li> none.
</ul>

<!--#include virtual="/hse/ies/templates/documentation/footer/footer.html" -->
