User:Şêr/kurhymes.py
< User:Şêr
def end_sound(word):
return word[-2:]
def find_rhyming_words(file_path, target_word):
rhyming_words = []
with open(file_path, 'r', encoding='utf-8') as file:
for line in file:
word = line.strip()
if end_sound(word) == end_sound(target_word) and word != target_word:
rhyming_words.append(word)
return rhyming_words
def main():
target_word = input("Enter a Kurdish word: ")
file_path = 'kutext.txt'
rhyming_words = find_rhyming_words(file_path, target_word)[:1000]
if rhyming_words:
print(f"Rhyming words for '{target_word}: {rhyming_words}")
else:
print(f"No rhyming words found for '{target_word}'.")
if __name__ == "__main__":
main()