Esempio n. 1
0
        public static void BuildAllLemmatizers(bool bIncludeExamples, bool bCompress, LemmatizerSettings lsett, string sNewFileMask)
        {
            DateTime dtStartAll = DateTime.Now;

            foreach (LanguagePrebuilt lp in Enum.GetValues(typeof(LanguagePrebuilt)))
            {
                DateTime dtStart = DateTime.Now;

                string sDataFileName = GetResourceFileName(sFileMask, lp);
                string sLemFileName  = GetResourceFileName(sNewFileMask, lp);

                Console.WriteLine("Building lemmatizer for {0} from {1}", lp, sDataFileName);

                LemmatizerPrebuiltData lemPrebuild = new LemmatizerPrebuiltData(lp, lsett);

                Console.WriteLine("  Building lemmatizer completed in: {0}", new TimeSpan(DateTime.Now.Ticks - dtStart.Ticks).ToString());
                dtStart = DateTime.Now;
                Console.WriteLine("  Serializing {0} lemmatizer to file {1}", (bIncludeExamples ? "full (examples included)" : "compact (examples excluded)"), sLemFileName);

                Stream binStreamOut = File.Open(sLemFileName, FileMode.Create);
                lemPrebuild.Serialize(binStreamOut, bIncludeExamples, bCompress);
                binStreamOut.Close();

                Console.WriteLine("  Successfully completed, time needed: {0}", new TimeSpan(DateTime.Now.Ticks - dtStart.Ticks).ToString());
            }
            Console.WriteLine("Time for building all lemmatizers: " + new TimeSpan(DateTime.Now.Ticks - dtStartAll.Ticks).ToString());
        }
Esempio n. 2
0
        public static void BuildAllLemmatizers(bool bIncludeExamples, bool bCompress, LemmatizerSettings lsett, string sNewFileMask)
        {
            DateTime dtStartAll = DateTime.Now;
            foreach (LanguagePrebuilt lp in Enum.GetValues(typeof(LanguagePrebuilt))) {
                DateTime dtStart = DateTime.Now;

                string sDataFileName = GetResourceFileName(sFileMask, lp);
                string sLemFileName = GetResourceFileName(sNewFileMask, lp);

                Console.WriteLine("Building lemmatizer for {0} from {1}", lp, sDataFileName);

                LemmatizerPrebuiltData lemPrebuild = new LemmatizerPrebuiltData(lp, lsett);

                Console.WriteLine("  Building lemmatizer completed in: {0}", new TimeSpan(DateTime.Now.Ticks - dtStart.Ticks).ToString());
                dtStart = DateTime.Now;
                Console.WriteLine("  Serializing {0} lemmatizer to file {1}", (bIncludeExamples ? "full (examples included)" : "compact (examples excluded)"), sLemFileName);

                Stream binStreamOut = File.Open(sLemFileName, FileMode.Create);
                lemPrebuild.Serialize(binStreamOut, bIncludeExamples, bCompress);
                binStreamOut.Close();

                Console.WriteLine("  Successfully completed, time needed: {0}", new TimeSpan(DateTime.Now.Ticks - dtStart.Ticks).ToString());
            }
            Console.WriteLine("Time for building all lemmatizers: " + new TimeSpan(DateTime.Now.Ticks - dtStartAll.Ticks).ToString());
        }