Returns: list[str]: The word forms for the specified word or an empty list if the IWordFormsProvider does not provide word forms for the specified word.
Example
classSimpleWordFormsProvider:defget_word_forms(self,word):result=[]lower_word=word.lower()# plural to singulariflen(word)>3andlower_word.endswith("ies"):result.append(word[:-3]+"y")iflen(word)>2andlower_word.endswith("es"):result.append(word[:-2])iflen(word)>1andlower_word.endswith("s"):result.append(word[:-1])# singular to pluraliflen(word)>1andlower_word.endswith("y"):result.append(word[:-1]+"ies")eliflower_word.endswith(("s","x","ch","sh")):result.append(word+"es")else:result.append(word+"s")returnresultprovider=SimpleWordFormsProvider()forms=provider.get_word_forms("batteries")print(forms)# ['battery', 'batteri', 'batteries', 'batteries']```### AliasesThesenamescall`get_word_forms`too,limitedtotheoverloadslisted.|Alias|Accepts||:-|:-||`get_word_forms_file`|`get_word_forms_file(word)`||`get_word_forms_string`|`get_word_forms_string(word)`|### See Also*class[`IWordFormsProvider`](/search/python-net/groupdocs.search.dictionaries/iwordformsprovider/)
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.