コード例 #1
0
        public List <string> print_highwordcount()
        {
            classif_fn = Select_text.ReadFN();
            ver.dictdata(classif_fn, fn);
            foreach (string k in ver.dict2.Keys)
            {
                string tempstr = "";
                ver.dict2.TryGetValue(k, out tempstr);
                string[] tempstrarr = tempstr.Split('|');
                templist.Add(tempstr[0] + " - " + k);
            }
            templist.Sort();
            templist.Reverse();
            int count = 0;

            foreach (string f in templist)
            {
                if ((!list_highwordcountstem.Contains(ws.Stem(f))) && count < 25)
                {
                    list_highwordcountstem.Add(ws.Stem(f));
                    list_highwordcount.Add(f);
                    count++;
                }
            }
            return(list_highwordcount);
        }
コード例 #2
0
 public List <string> printword_ver_TFSLF()
 {
     classif_fn = Select_text.ReadFN();
     strlist    = tfidf.TF_SLF_ver(classif_fn, fn, ver.dict2, ver.count_all_world);
     strlist.Sort();
     return(strlist);
 }
コード例 #3
0
 public String printorigintext()
 {
     origintext = "";
     classif_fn = Select_text.ReadFN();
     ver.word_list(classif_fn, fn);
     origintext = ver.origintext;
     return(origintext);
 }
コード例 #4
0
 public List <string> printwordsw()
 {
     Clearlistdict();
     classif_fn = Select_text.ReadFN();
     ver.word_list(classif_fn, fn);
     list_word_sw = ver.lwsw;
     return(list_word_sw);
 }
コード例 #5
0
        public List <string> printstr()
        {
            Clearlistdict();
            classif_fn = Select_text.ReadFN();
            ver.word_list(classif_fn, fn);
            list_str = ver.lstr;

            /*for (int i = 0; i < list_str.Count;i++)
             *  if(list_str[i].Trim() != "")
             *  list_str[i] = FirstUpper(list_str[i].Trim());*/
            return(list_str);
        }
コード例 #6
0
 public List <string> printword_count()
 {
     Clearlistdict();
     classif_fn = Select_text.ReadFN();
     ver.dictdata(classif_fn, fn);
     foreach (string k in ver.dict2.Keys)
     {
         string tempstr = "";
         ver.dict2.TryGetValue(k, out tempstr);
         list.Add(k + " - " + tempstr);
     }
     list.Add("All word count = " + ver.count_all_world.ToString());
     return(list);
 }
コード例 #7
0
        public float [] xdata()
        {
            string[] xdataarr;
            float[]  xdataarrfloat;

            if (!File.Exists("model.txt"))
            {
                throw new FileNotFoundException();
            }
            string data = File.ReadAllText("model.txt", Encoding.Default);

            string fn = Select_text.ReadFN();

            if (!File.Exists(fn))
            {
                throw new FileNotFoundException();
            }
            datatosum = File.ReadAllText(fn, Encoding.Default);

            string[] arr_data = data.Split('\n');
            arr_datatosum = datatosum.Split('.', '!', '?');

            string[] arr_datatosum_word = datatosum.Split(' ');
            string[] arr_data_wordsvec  = data.Split(' ');
            string[] arr_data_words     = new string[arr_data_wordsvec.Length / 101 + 1];
            int      j = 0;

            for (int i = 0; i < arr_data_wordsvec.Length; i += 101)
            {
                arr_data_words[j] = arr_data_wordsvec[i];
                j++;
            }

            j = 0;
            int k = 0, flag = 0, kk = 0;

            xdataarr = new string[arr_datatosum_word.Length * 100];

            for (int i = 0; i < arr_datatosum_word.Length; i++)
            {
                for (int jj = 0; jj < arr_data_words.Length; jj++)
                {
                    string[] arr_data_item = arr_data_words[jj].Split('\n');
                    if (arr_datatosum_word[i] == arr_data_item[arr_data_item.Length - 1])
                    {
                        for (int u = jj * 101 + 1; u < jj * 101 + 101; u++) //j
                        {
                            if (u < arr_data_wordsvec.Length)
                            {
                                if (arr_data_wordsvec[u].Trim() != "")
                                {
                                    xdataarr[k] = arr_data_wordsvec[u].Trim();
                                }
                                k++;
                                flag = 1;
                            }
                        }
                        j = 0;
                    }
                    j++;
                    if (jj == arr_data_words.Length - 1) //j
                    {
                        j = 0;
                        if (flag == 0)
                        {
                            kk = k;
                            for (int u = kk; u < kk + 100; u++)
                            {
                                xdataarr[u] = null;
                                k++;
                            }
                        }
                        flag = 0;
                    }
                }
            }

            xdataarrfloat = converttofloat(xdataarr);
            return(xdataarrfloat);
        }