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 de1afa2

Browse files
style: format code with autopep8
Format code with autopep8 This commit fixes the style issues introduced in 3f7375c according to the output from Autopep8. Details: None
1 parent 6842a19 commit de1afa2

File tree

1 file changed

+9
-6
lines changed
  • Adjective Comparative and Superlative Generator using NLP

1 file changed

+9
-6
lines changed
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1+
from nltk.corpus import wordnet
12
import nltk
23
nltk.download('wordnet')
34

4-
from nltk.corpus import wordnet
55

66
def get_comp_sup(adjs):
77
comp_sup = []
8-
8+
99
for adj in adjs:
1010
synsets = wordnet.synsets(adj)
1111
if synsets:
1212
syn = synsets[0]
13-
comp_forms = [lemma.name().replace('_', ' ') for lemma in syn.lemmas()]
13+
comp_forms = [lemma.name().replace('_', ' ')
14+
for lemma in syn.lemmas()]
1415
if len(comp_forms) >= 2:
1516
comp_form = comp_forms[1]
1617
else:
@@ -20,18 +21,20 @@ def get_comp_sup(adjs):
2021
else:
2122
superl_form = adj + "est"
2223
comp_sup.append((adj, comp_form, superl_form))
23-
24+
2425
return comp_sup
2526

27+
2628
def main():
2729
adjs = input("Enter a list of adjectives (comma-separated): ").split(',')
28-
30+
2931
comp_sup = get_comp_sup(adjs)
30-
32+
3133
print("\nAdjective\tComparative\tSuperlative")
3234
print("------------------------------------------")
3335
for adj, c, s in comp_sup:
3436
print(f"{adj}\t\t{c}\t\t{s}")
3537

38+
3639
if __name__ == "__main__":
3740
main()

0 commit comments

Comments
(0)

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