The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
<html><head><title>Lingua::Interset::Trie</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" >

<style type="text/css">
 <!--/*--><![CDATA[/*><!--*/
BODY {
  background: white;
  color: black;
  font-family: arial,sans-serif;
  margin: 0;
  padding: 1ex;
}

A:link, A:visited {
  background: transparent;
  color: #006699;
}

A[href="#POD_ERRORS"] {
  background: transparent;
  color: #FF0000;
}

DIV {
  border-width: 0;
}

DT {
  margin-top: 1em;
  margin-left: 1em;
}

.pod { margin-right: 20ex; }

.pod PRE     {
  background: #eeeeee;
  border: 1px solid #888888;
  color: black;
  padding: 1em;
  white-space: pre;
}

.pod H1      {
  background: transparent;
  color: #006699;
  font-size: large;
}

.pod H1 A { text-decoration: none; }
.pod H2 A { text-decoration: none; }
.pod H3 A { text-decoration: none; }
.pod H4 A { text-decoration: none; }

.pod H2      {
  background: transparent;
  color: #006699;
  font-size: medium;
}

.pod H3      {
  background: transparent;
  color: #006699;
  font-size: medium;
  font-style: italic;
}

.pod H4      {
  background: transparent;
  color: #006699;
  font-size: medium;
  font-weight: normal;
}

.pod IMG     {
  vertical-align: top;
}

.pod .toc A  {
  text-decoration: none;
}

.pod .toc LI {
  line-height: 1.2em;
  list-style-type: none;
}

  /*]]>*/-->
</style>


</head>
<body class='pod'>
<!--
  generated by Pod::Simple::HTML v3.28,
  using Pod::Simple::PullParser v3.28,
  under Perl v5.018002 at Tue Jul 11 10:46:57 2017 GMT.

 If you want to change this HTML document, you probably shouldn't do that
   by changing it directly.  Instead, see about changing the calling options
   to Pod::Simple::HTML, and/or subclassing Pod::Simple::HTML,
   then reconverting this document from the Pod source.
   When in doubt, email the author of Pod::Simple::HTML for advice.
   See 'perldoc Pod::Simple::HTML' for more info.

-->

<!-- start doc -->
<a name='___top' class='dummyTopAnchor' ></a>

<div class='indexgroup'>
<ul   class='indexList indexList1'>
  <li class='indexItem indexItem1'><a href='#NAME'>NAME</a>
  <li class='indexItem indexItem1'><a href='#VERSION'>VERSION</a>
  <li class='indexItem indexItem1'><a href='#SYNOPSIS'>SYNOPSIS</a>
  <li class='indexItem indexItem1'><a href='#DESCRIPTION'>DESCRIPTION</a>
  <li class='indexItem indexItem1'><a href='#ATTRIBUTES'>ATTRIBUTES</a>
  <ul   class='indexList indexList2'>
    <li class='indexItem indexItem2'><a href='#features'>features</a>
    <li class='indexItem indexItem2'><a href='#root_hash'>root_hash</a>
  </ul>
  <li class='indexItem indexItem1'><a href='#METHODS'>METHODS</a>
  <ul   class='indexList indexList2'>
    <li class='indexItem indexItem2'><a href='#add_value()'>add_value()</a>
    <li class='indexItem indexItem2'><a href='#advance_pointer()'>advance_pointer()</a>
    <li class='indexItem indexItem2'><a href='#as_string()'>as_string()</a>
    <li class='indexItem indexItem2'><a href='#get_tag_example()'>get_tag_example()</a>
  </ul>
  <li class='indexItem indexItem1'><a href='#SEE_ALSO'>SEE ALSO</a>
  <li class='indexItem indexItem1'><a href='#AUTHOR'>AUTHOR</a>
  <li class='indexItem indexItem1'><a href='#COPYRIGHT_AND_LICENSE'>COPYRIGHT AND LICENSE</a>
</ul>
</div>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="NAME"
>NAME</a></h1>

<p>Lingua::Interset::Trie - A trie-like structure for DZ Interset features and their values.</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="VERSION"
>VERSION</a></h1>

<p>version 3.006</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="SYNOPSIS"
>SYNOPSIS</a></h1>

<pre>  use Lingua::Interset::Tagset::EN::Penn;

  my $ts = Lingua::Interset::Tagset::EN::Penn-&#62;new();
  # Get a Lingua::Interset::Trie object $permitted and print all feature structures
  # that the tagset en::penn can generate.
  my $permitted = $ts-&#62;permitted_structures();
  print($permitted-&#62;as_string(), &#34;----------\n&#34;);</pre>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="DESCRIPTION"
>DESCRIPTION</a></h1>

<p>The <code>Trie</code> class defines a trie-like data structure for DZ Interset features and their values. It is an auxiliary data structure that an outside user should not need to use directly.</p>

<p>It is used to describe all feature-value combinations that are permitted under a given tagset. (Example: If the prefix already traversed in the trie indicates that we have a noun, with subtype of proper noun, what are the possible values of the next feature, say, gender?)</p>

<p>The trie assumes that features are ordered according to their priority. However, the priorities are defined outside the trie, by default in the FeatureStructure class, or they may be overriden in a Tagset subclass. The trie can store features in any order.</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="ATTRIBUTES"
>ATTRIBUTES</a></h1>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="features"
>features</a></h2>

<p>An array reference. Lists the features in the order in which their values appear in the trie. This may be the default order according to <code>Lingua::Interset::FeatureStructure-&#62;priority_features()</code>, or a custom order.</p>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="root_hash"
>root_hash</a></h2>

<p>The trie structure is implemented as a tree of hashes. The root hash corresponds to the first feature. Its keys are values of the feature and each of them leads to a second-level hash. All second-level hashes correspond to the second feature, their keys are values of that feature etc. It is interpreted as a sequence of feature queries: <i>If feature F1 has value X, then if feature F2 has value Y, then...</i></p>

<p>We need a pointer when traversing the trie, and the pointer is always a reference to one of the hashes. The <code>root_hash</code> attribute is our entry pointer where we start the traversal.</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="METHODS"
>METHODS</a></h1>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="add_value()"
>add_value()</a></h2>

<pre>  $trie-&#62;add_value ($pointer, $value[, $tag_example]);</pre>

<p>Adds a feature value to the trie. It does not need to know the feature name. It takes the feature value and the pointer to the trie level corresponding to the feature (reference to an existing hash). If the hash already has a key corresponding to the value, the method only advances to the sub-hash referenced by the value, and returns the new pointer. If there is no such key, the method first creates the new sub-hash and then advances the pointer.</p>

<p>For the last feature we can optionally provide an example of a tag where this combination of feature values occurred. It may be useful for debugging, when we see a permitted feature structure but do not understand how does it come that it is permitted.</p>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="advance_pointer()"
>advance_pointer()</a></h2>

<pre>  $trie-&#62;advance_pointer ($pointer, $feature, $value);</pre>

<p>Advances a trie pointer. Normally it observes the value of the current feature; however, the features <code>tagset</code> and <code>other</code> get special treatment (any value is permitted).</p>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="as_string()"
>as_string()</a></h2>

<p>Returns permitted feature values in a form suitable for printing. This may be useful for debugging.</p>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="get_tag_example()"
>get_tag_example()</a></h2>

<pre>  $trie-&#62;get_tag_example ($feature_structure);</pre>

<p>Takes a <a href="http://search.cpan.org/perldoc?Lingua%3A%3AInterset%3A%3AFeatureStructure" class="podlinkpod"
>Lingua::Interset::FeatureStructure</a> object. If this is a permitted structure according to the trie, the method returns the tag example that has been stored in the last-level hash of the trie.</p>

<p>Otherwise it returns an error message. This is a debugging method and it will not throw exceptions on forbidden values.</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="SEE_ALSO"
>SEE ALSO</a></h1>

<p><a href="http://search.cpan.org/perldoc?Lingua%3A%3AInterset%3A%3ATagset" class="podlinkpod"
>Lingua::Interset::Tagset</a>, <a href="http://search.cpan.org/perldoc?Lingua%3A%3AInterset%3A%3AFeatureStructure" class="podlinkpod"
>Lingua::Interset::FeatureStructure</a></p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="AUTHOR"
>AUTHOR</a></h1>

<p>Dan Zeman &#60;zeman@ufal.mff.cuni.cz&#62;</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="COPYRIGHT_AND_LICENSE"
>COPYRIGHT AND LICENSE</a></h1>

<p>This software is copyright (c) 2017 by Univerzita Karlova (Charles University).</p>

<p>This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.</p>

<!-- end doc -->

</body></html>