44def add_prefix_un (word ):
55 """Take the given word and add the 'un' prefix.
66
7- :param word: str - containing the root word.
8- :return: str - of root word prepended with 'un'.
7+ Parameters:
8+ word (str): The root word.
9+
10+ Returns:
11+ str: Root word prepended with 'un'.
912 """
1013
1114 return 'un' + word
1215
1316
1417def make_word_groups (vocab_words ):
15- """Transform a list containing a prefix and words into a string with the prefix followed by the words with prefix prepended.
18+ """Transform a list containing a prefix and words.
19+
20+ Parameters:
21+ vocab_words (list[str]): Vocabulary words with prefix at first index.
1622
17- :param vocab_words: list - of vocabulary words with prefix in first index.
18- :return: str - of prefix followed by vocabulary words with
23+ Returns:
24+ str: Prefix followed by vocabulary words with
1925 prefix applied.
2026
21- This function takes a `vocab_words` list and returns a string
27+ This function takes a `vocab_words` list of strings and returns a string
2228 with the prefix and the words with prefix applied, separated
2329 by ' :: '.
2430
25- For example: list('en', 'close', 'joy', 'lighten'),
26- produces the following string: 'en :: enclose :: enjoy :: enlighten'.
31+ Examples:
32+ >>> list('en', 'close', 'joy', 'lighten')
33+ 'en :: enclose :: enjoy :: enlighten'.
34+
2735 """
2836
2937 prefix = vocab_words [0 ]
@@ -35,10 +43,19 @@ def make_word_groups(vocab_words):
3543def remove_suffix_ness (word ):
3644 """Remove the suffix from the word while keeping spelling in mind.
3745
38- :param word: str - of word to remove suffix from.
39- :return: str - of word with suffix removed & spelling adjusted.
46+ Parameters:
47+ word (str): Word to remove suffix from.
48+
49+ Returns:
50+ str: Word with suffix removed & spelling adjusted.
51+
52+ Examples:
53+ >>> remove_suffix_ness('heaviness')
54+ 'heavy'
55+
56+ >>> remove_suffix_ness('sadness')
57+ 'sad'
4058
41- For example: "heaviness" becomes "heavy", but "sadness" becomes "sad".
4259 """
4360
4461 word = word [:- 4 ]
@@ -51,11 +68,20 @@ def remove_suffix_ness(word):
5168def adjective_to_verb (sentence , index ):
5269 """Change the adjective within the sentence to a verb.
5370
54- :param sentence: str - that uses the word in sentence.
55- :param index: int - index of the word to remove and transform.
56- :return: str - word that changes the extracted adjective to a verb.
71+ Parameters:
72+ sentence (str): The word used in a sentence as an adjective.
73+ index (int): Index of the adjective to remove and transform.
74+
75+ Returns:
76+ str: The extracted adjective in verb form.
77+
78+ Examples:
79+ >>> adjective_to_verb('It got dark as the sun set.', 2)
80+ 'darken'
81+
82+ >>> adjective_to_verb('The ink stains her fingers black.', -1)
83+ 'blacken'
5784
58- For example, ("It got dark as the sun set", 2) becomes "darken".
5985 """
6086
6187 word = sentence .split ()[index ]
0 commit comments