Ejemplo n.º 1
0
        public List <WordAndFreq> AnahtarKelimeBelirle(List <WordAndWeight> weightedKelimeler, List <WordAndFreq> kelimeFrekans)
        {
            int sinir = 0;
            List <WordAndFreq> anahtarKelimeler = new List <WordAndFreq>();

            weightedKelimeler = weightedKelimeler.OrderByDescending(x => x.Weight).ToList();

            sinir = weightedKelimeler.Count * 3 / 9;

            for (int i = 0; i < sinir; i++)
            {
                WordAndFreq anahtarKelime = new WordAndFreq();
                anahtarKelime.Word = weightedKelimeler[i].Word;
                foreach (var item in kelimeFrekans)
                {
                    if (weightedKelimeler[i].Word == item.Word)
                    {
                        anahtarKelime.Frequency = item.Frequency;
                    }
                }
                anahtarKelimeler.Add(anahtarKelime);
            }

            return(anahtarKelimeler);
        }
Ejemplo n.º 2
0
        public List <WordAndFreq> KelimeFrekansYap(List <string> kelimeler)
        {
            List <WordAndFreq> KelimeSayilari = new List <WordAndFreq>();

            for (int i = 0; i < kelimeler.Count; i++)
            {
                int kelimeFrekans = 1;
                for (int j = i + 1; j < kelimeler.Count; j++)
                {
                    if (String.Equals(kelimeler[i], kelimeler[j]))
                    {
                        kelimeFrekans++;
                        kelimeler.RemoveAt(j);
                        j -= 1;
                    }
                }
                WordAndFreq yeni = new WordAndFreq();
                yeni.Word      = kelimeler[i];
                yeni.Frequency = kelimeFrekans;
                KelimeSayilari.Add(yeni);
            }
            KelimeSayilari = KelimeSayilari.OrderByDescending(x => x.Frequency).ToList();
            return(KelimeSayilari);
        }