title: How to find basic, uninflected word for searching?
body: <p>I am having trouble trying to write a search engine that treats all inflections of a word as the same basic word. </p>
  
  <ol>
  <li>So for <em>verbs</em> these are  all the same root word, <em>be</em>:
  <ul>
  <li>number/person (<strong><em>e.g.</em></strong> <em>am; is; are</em>) </li>
  <li>tense/mood like past or future tense (<strong><em>e.g.</em></strong> <em>was; were; will be</em>)</li>
  <li>past participles (<strong><em>e.g.</em></strong> <em>has been</em>; <em>had been</em>)</li>
  <li>present participles and gerunds (<strong><em>e.g.</em></strong> <em>is being</em>; <em>wasn't being</em> funny;  <em>being</em> early <em>is</em> less important than <em>being</em> correct) </li>
  <li><p>subjunctives (<strong><em>e.g.</em></strong> <em>might be</em>; critical that something <em>be</em> finished; I wish it <em>were</em>)
  ⁠  ⁠ 
  ⁠</p></li>
  </ul></li>
  <li>Then for <em>nouns</em>, both the singular form and the plural form should count as the same basic word [<em>ᴇᴅɪᴛᴏʀ's ɴᴏᴛᴇ: this is frequently referrred to as the <strong>citation form</strong> of the word.</em>]</li>
  </ol>
  
  <p>For example, with “<em>enable</em>”, I don’t want “<em>enables</em>” and “<em>enabled</em>” printed as separate entries.  All three of those should count as the same basic word, the verb <em>enable</em>.</p>
  
  <p>I can prevent printing of duplicates using a hash like:</p>
  
  <pre><code>unless ($seenmatches{ $headmatches[$l] }++)
  </code></pre>
  
  <ol>
  <li><p>Could someone explain this? Explained in comments below.</p></li>
  <li><p>This doesn’t stop the plural/past from continuing on. Is there a way to do this, or some wholely distinct approach, perhaps one involving a regex and/or substitution, then an unsub later?</p></li>
  </ol>
  
  <p>I can't modify the word with a substitution, because then the print would not print out right. Although I'm not at the stage yet, eventually I'd like to include irregular past tenses [<em>ᴇᴅɪᴛᴏʀ's ɴᴏᴛᴇ: and irregular <strong>nouns</strong>, too?</em>] as well</p>
  
  <p>Im not sure what else you need to answer my question, so please just let me know anything I’ve unintentionally left out, and I'll fill in any missing bits to help make it clearer.</p>