Ruby ile wordle oyununu yapmaya çalışıyorum. Sadece konsolda çalışacak. Kelimenin Türkçede olup olmadığını anlamak için şöyle bir fonksiyon yazdım:
def turkish(guess)
encoded_guess = URI.encode_www_form_component(guess.downcase)
url = URI("https://sozluk.gov.tr/gts?ara=#{encoded_guess}")
response = Net::HTTP.get(url)
response_ = response.force_encoding("UTF-8")
puts "API Yanıtı: #{response_}"
data = JSON.parse(response)
if data.is_a?(Array) && !data.empty?
check_guess(guess)
return true
elsif data['error'] == 'Sonuç bulunamadı'
return false
end
rescue JSON::ParserError => e
puts "JSON çözümleme hatası: #{e.message}. Kelimeyi tekrar girin."
end
Sadece içinde ı harfi olan kelimeleri bulamıyor. Neden olabilir?