title: javascript - Make a word singular (singularize)
body: <p>I am currently seeking a way to "singularize" English words. I have found ways to do the <a href="https://stackoverflow.com/questions/27194359/javascript-pluralize-a-string">opposite</a>. Here's what I've come up with so far:</p>
  
  <pre><code>function singularize(word) {
    const endings = {
      ves: 'fe',
      ies: 'y',
      i: 'us',
      zes: '',
      ses: '',
      es: '',
      s: ''
    };
    return word.replace(
      new RegExp(`(${Object.keys(endings).join('|')})$`), 
      r =&gt; endings[r]
    );
  }
  </code></pre>
  
  <p>However, this is not working in many cases (e.g. analysis – analyses, phenomenon – phenomena, series – series). Is there a more accurate way to do this without embedding a whole dictionary? Is there a way to access the dictionary of the browser?</p>
  
  <p>And if there is no way without a dictionary, what would be at least a slightly more accurate solution?</p>