IEnumerator getUnityWebRequest()
    {
        UnityWebRequest www = UnityWebRequest.Get("https://api.datamuse.com/words?sl=" + Field.text + "&md=r&ipa=1");

        yield return(www.SendWebRequest());

        if (www.isNetworkError || www.isHttpError)
        {
            Debug.Log(www.error);
        }
        else
        {
            Debug.Log(www.downloadHandler.text);
            string     jsonString = fixJson(www.downloadHandler.text);
            DataMuse[] wordData   = JsonHelper.FromJson <DataMuse>(jsonString);
            TextBox.text = "";
            string        simWords       = "";
            DataMuse      last           = wordData.Last();
            List <string> similarWords   = new List <string>();
            var           countAmbiguity = -1;
            foreach (var item in wordData)
            {
                if (item.score > 90)
                {
                    countAmbiguity++;
                    similarWords.Add(item.word);
                    if (item.Equals(last))
                    {
                        simWords += item.word;
                    }
                    else
                    {
                        simWords += item.word + ", ";
                    }
                }
            }

            string   word      = wordData[0].word;
            int      score     = wordData[0].score;
            int      syllables = wordData[0].numSyllables;
            string[] pronFull  = wordData[0].tags[0].Split(':');
            string   pron      = pronFull[0];

            string[] ipaFull            = wordData[0].tags[1].Split(':');
            string   ipa                = ipaFull[1];
            int      subKategori0Result = countSubKategori0(Field.text);
            int      subKategori1Result = countSubKategori1(Field.text);
            int      subKategori2Result = countSubKategori2(Field.text);

            TextBox.text += "Word: " + word;
            TextBox.text += "\nIPA: " + ipa;
            TextBox.text += "\nSyllables: " + syllables;
            TextBox.text += "\nAmbiguity: " + countAmbiguity;
            TextBox.text += "\nSub Kategori 0: " + subKategori0Result;
            TextBox.text += "\nSub Kategori 1: " + subKategori1Result;
            TextBox.text += "\nSub Kategori 2: " + subKategori2Result;
            TextBox.text += "\nSimilar Words: " + simWords;
        }
    }
    IEnumerator getUnityWebRequest()
    {
        UnityWebRequest www = UnityWebRequest.Get("https://api.datamuse.com/words?sl=adventure");

        yield return(www.SendWebRequest());

        if (www.isNetworkError || www.isHttpError)
        {
            Debug.Log(www.error);
        }
        else
        {
            //Debug.Log(www.downloadHandler.text);
            var      jsonStr  = www.downloadHandler.text;
            DataMuse wordData = JsonUtility.FromJson <DataMuse>(jsonStr);
            Debug.Log(wordData.word);
        }
    }
    //datamuse

    IEnumerator getUnityWebRequest()
    {
        UnityWebRequest www = UnityWebRequest.Get("https://api.datamuse.com/words?sl=" + FieldAnswer.text + "&md=r&ipa=1");

        yield return(www.SendWebRequest());

        if (www.isNetworkError || www.isHttpError)
        {
            Debug.Log(www.error);
        }
        else
        {
            Debug.Log(www.downloadHandler.text);
            string     jsonString = fixJson(www.downloadHandler.text);
            DataMuse[] wordData   = JsonHelper.FromJson <DataMuse>(jsonString);
            //TextBoxAssesment.text = "";
            TextBoxAnswer.text = "";

            string        simWords       = "";
            DataMuse      last           = wordData.Last();
            List <string> similarWords   = new List <string>();
            var           countAmbiguity = -1;
            foreach (var item in wordData)
            {
                if (item.score > 90)
                {
                    countAmbiguity++;
                    if (!item.word.Equals(FieldAnswer.text))
                    {
                        if (item.Equals(last))
                        {
                            simWords += item.word;
                        }
                        else
                        {
                            simWords += item.word + ", ";
                        }
                    }
                }
            }

            string word  = wordData[0].word;
            int    score = wordData[0].score;
            sylB = wordData[0].numSyllables;
            ambB = countAmbiguity;
            string[] pronFull = wordData[0].tags[0].Split(':');
            string   pron     = pronFull[0];

            string[] ipaFull = wordData[0].tags[1].Split(':');
            ipa    = ipaFull[1];
            subK0B = countSubKategori0(FieldAnswer.text);
            subK1B = countSubKategori1(FieldAnswer.text);
            subK2B = countSubKategori2(FieldAnswer.text);

            TextBoxAnswer.text += "Word: " + word;
            TextBoxAnswer.text += "\nIPA: " + ipa;
            TextBoxAnswer.text += "\nSyllables: " + sylB;
            TextBoxAnswer.text += "\nAmbiguity: " + countAmbiguity;
            TextBoxAnswer.text += "\nSub Kategori 0: " + subK0B;
            TextBoxAnswer.text += "\nSub Kategori 1: " + subK1B;
            TextBoxAnswer.text += "\nSub Kategori 2: " + subK2B;
            TextBoxAnswer.text += "\nSimilar Words: " + simWords;

            AssesmentWord(FieldQuest.text);
            ManhattanDistance(phone, ipa);
            EuclideanDistance(phone, ipa);
            LevenshteinDistance(phone, ipa);
            keyWord();
            phoneticResult();



            TextBoxAssesment.text  = "";
            TextBoxAssesment.text += "Manhattan: " + MH;
            TextBoxAssesment.text += "\ndistance MH: " + eMH + "%";
            TextBoxAssesment.text += "\nSimilarity MH2: " + simMH + "%";
            TextBoxAssesment.text += "\nEuclidean: " + EC;
            TextBoxAssesment.text += "\ndistance EC: " + eEC + "%";
            TextBoxAssesment.text += "\nSimilarity EC2: " + simEC + "%";
            TextBoxAssesment.text += "\nLevenstein: " + distance;
            TextBoxAssesment.text += "\nSimilarity: " + sim + "%";
            TextBoxAssesment.text += "\nDamage: " + damage;


            AccesControl.ConData = false;
        }
    }