コード例 #1
0
        public static List <DirectoryFileInfo> GetSubDatasets(DirectoryFolderInfo subFolder)
        {
            List <DirectoryFileInfo> result = new List <DirectoryFileInfo>();
            var zemberek = new Zemberek(new TurkiyeTurkcesi());

            try
            {
                string   path = @"" + subFolder.Path;
                string[] subFilesInCategory = GetSubFiles(path);
                foreach (string item in subFilesInCategory)
                {
                    DirectoryFileInfo fi = new DirectoryFileInfo();
                    fi.Path = item;
                    fi.Name = item.Substring(item.LastIndexOf('\\') + 1);
                    if (fi.Name.Contains("Kopya"))
                    {
                        fi.Name = fi.Name.Replace("\u008d", "");
                    }
                    fi.Category = subFolder.Name;
                    fi.Content  = "";
                    string[] txtFile = StringHelper.GetOnlyLetterAndSpace(File.ReadAllText(@"" + item, Encoding.GetEncoding("iso-8859-9"))).Split(' ');
                    foreach (string word in txtFile)
                    {
                        if (word != "")
                        {
                            string strRoot = word;
                            if (zemberek.kelimeAyristir(word).Count > 0)
                            {
                                strRoot = zemberek.kelimeAyristir(word)[0][0];
                            }
                            fi.Content += strRoot + " ";
                        }
                    }
                    result.Add(fi);
                }
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("HATA ! : " + e.Message);
                return(result);
            }
        }