Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b53c8ed

Browse files
Merge pull request avinashkranjan#2914 from smty2018/nlp1
Word Singularization and Pluralization using NLP
2 parents 17682e2 + 1eb4077 commit b53c8ed

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Word Singularization and Pluralization Script
2+
3+
This simple Python script allows you to input a word and get both its singular and plural forms. The script utilizes the `inflect` and `TextBlob` libraries for word processing.
4+
5+
Requirements:
6+
7+
pip install inflect textblob
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import inflect
2+
from textblob import Word
3+
4+
def main():
5+
u = input("Enter a word: ")
6+
7+
p = inflect.engine()
8+
pl = p.plural(u)
9+
10+
s = Word(u).singularize()
11+
12+
print(f"You entered: {u}")
13+
print(f"Singular form: {s}")
14+
print(f"Plural form: {pl}")
15+
16+
if __name__ == "__main__":
17+
main()
18+
19+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /