add_range method

add_range

Adds the specified collection of homophone groups to this instance of the HomophoneDictionary.

def add_range(self, homophones):
    ...
Parameter Type Description
homophones Iterable[list[str]] The collection of homophone groups to add to the dictionary.
Raises Description
ValueError If a group contains fewer than 2 homophones.

Example

homophone_groups = [
    ["awe", "oar", "or", "ore"],
    ["aye", "eye", "i"],
]
homophones.add_range(homophone_groups)
print("Words in the dictionary:", homophones.count)

Aliases

These names call add_range too, limited to the overloads listed.

Alias Accepts
add_range_files add_range_files(homophones)
add_range_strings add_range_strings(homophones)
add_range_ienumerable add_range_ienumerable(homophones)

See Also