Package: dutch-pluralizer
Dutch Noun Pluralizer in PythonGenerates plural and singular nouns in avery imperfect wayusingCyHunspelland OpenTaal dictionaries andword lists. Why imperfect? Because the Dutch language is full of exceptions.The algorithm is based on the document"Basismorfologie. Het meervoud in het Nederlands" (Dutch)of theUniversitÃ© catholique de Louvain.Note: I'm a .NET developer that does Python in my free time. I'mnota linguist, I just work for a Dutch company. Hence: thismustbe a very imperfect way of doing this.If you have good ideas, I welcome them, just open an issue.InstallationInstall from PIP:pip install dutch-pluralizerNote on Windows 10CyHunspellis used. To use this package onWindows 10, you might need to installBuild Tools for Visual Studio 2019and choose theWindows 10 C++ SDKoption.Note on other Linux installationsPlease checkhow you can install Hunspell on Linuxif you don't want build Hunspell.CLI usageThe project can be used as a CLI tool:usage: dutch_pluralizer [-h] [-p] [-s] [-pa] [-v] word

Generates Dutch plural and singular nouns in a very imperfect way using Hunspell     
dictionaries. Why imperfect? Because the Dutch language is full of exceptions.       

positional arguments:
  word                  The word.

optional arguments:
  -h, --help            show this help message and exit
  -p, --pluralize       pluralizes the word.
  -s, --singularize     singularizes the word.
  -pa, --pluralize_advanced
                        shows advanced pluralization output.
  -v, --verbose         Shows an error message when a word could not be processed.APIThe API can be used like this:fromdutch_pluralizerimportpluralize,singularize# pluralize will return the result or Noneassertpluralize("kaas")=="kazen"assertpluralize("kazen")==None# singularize will return the result or Noneassertsingularize("kazen")=="kaas"assertsingularize("kaas")==NoneAdvanced pluralization will give you more options:fromdutch_pluralizerimportpluralize,pluralize_advanced,singularizeadv=pluralize_advanced("album")# the pluralassertadv.plural=='albums'# what the algorithm (without Hunspell) created# is probably not correct, that's why Hunspell is# used on it. It is like a preprocessing:assertadv.algorithmic_plural=='alba'# indicates that end result was found in Hunspelladv.hunspell_spelled=True# the plural was found by replacement of# 'a' to 'ums'assertadv.switched_ending_from=='a'assertadv.switched_ending_to=='ums'# suggestions given by Hunspell when the algorithmic# result was processed:assertadv.suggestions==('Alba','aba','balba','albe','alia','alla','alma','alfa','Elba')Add custom words to the dictionary:fromdutch_pluralizerimportpluralize,singularizefromdutch_pluralizer.spellerimportensure_hunspell_nldeftest_readme_example_3():# default dictionary does not understand these words,# as they are not Dutchassertpluralize("fibulatie")==Noneassertsingularize("fibulaties")==None# add the words to the dictionaryh=ensure_hunspell_nl()h.add("fibulatie")h.add("fibulaties")# check againassertpluralize("fibulatie",speller=h)=="fibulaties"assertsingularize("fibulaties",speller=h)=="fibulatie"Help!? The result is not correctI told you it was imperfect! There is stuff this package can and cannot do:We cannot discover words that are not recognized by HunspellWe can only processnouns(Dutch: zelfstandige naamwoorden)We can only return a single result, but we know that the singular ofgravencan be eithergraaforgraf. We currently have no support for these use cases.We can add words, just open up a ticket onGitHub. Please make sure you provide some evidence on why the word should be added (like a VanDale.nl result).DevelopmentIf you want to contribute to local development, please consultthe local development page.