Beispiel #1
0
        static void IndexMode()
        {
            if (File.Exists(strInputFile) == false ||
                File.Exists(strTemplateFile) == false)
            {
                UsageIndex();
                return;
            }

            //Load feature set from given file
            List <string> features = new List <string>();
            StreamReader  sr       = new StreamReader(strInputFile);
            string        strLine  = null;

            while ((strLine = sr.ReadLine()) != null)
            {
                string[] items = strLine.Split('\t');
                features.Add(items[0]);
            }
            sr.Close();

            //Build indexed feature set
            templateFeaturizer = new TemplateFeaturizer();
            templateFeaturizer.LoadTemplateFromFile(strTemplateFile);
            templateFeaturizer.BuildIndexedFeatureIntoFile(strFeatureFile, features);
        }
Beispiel #2
0
        private static void IndexMode()
        {
            if (File.Exists(inputFilePath) == false ||
                File.Exists(templateFilePath) == false)
            {
                UsageIndex();
                return;
            }

            //Load feature set from given file
            var    features = new List <string>();
            var    sr       = new StreamReader(inputFilePath);
            string strLine;

            while ((strLine = sr.ReadLine()) != null)
            {
                var items = strLine.Split('\t');
                features.Add(items[0]);
            }
            sr.Close();

            //Build indexed feature set
            templateFeaturizer = new TemplateFeaturizer();
            templateFeaturizer.LoadTemplateFromFile(templateFilePath);
            templateFeaturizer.BuildIndexedFeatureIntoFile(featureFilePath, features);
        }
Beispiel #3
0
        private static void BuildMode()
        {
            if (File.Exists(inputFilePath) == false ||
                File.Exists(templateFilePath) == false)
            {
                UsageBuild();
                return;
            }

            //Extract feature set from given corpus
            var feature2freq = ExtractFeatureSetFromFile();
            var features     = feature2freq.Select(pair => pair.Key).ToList();

            //Build indexed feature set
            templateFeaturizer.BuildIndexedFeatureIntoFile(featureFilePath, features);
        }
Beispiel #4
0
        static void BuildMode()
        {
            if (File.Exists(strInputFile) == false ||
                File.Exists(strTemplateFile) == false)
            {
                UsageBuild();
                return;
            }

            //Extract feature set from given corpus
            IDictionary <string, int> feature2freq = ExtractFeatureSetFromFile();
            List <string>             features     = new List <string>();

            foreach (KeyValuePair <string, int> pair in feature2freq)
            {
                features.Add(pair.Key);
            }

            //Build indexed feature set
            templateFeaturizer.BuildIndexedFeatureIntoFile(strFeatureFile, features);
        }