/// <summary> /// Extract feature /// </summary> /// <param name="options"> /// b : extract feature for bayes model (default) /// s : extract feature for svm model /// all : extract all data feature (default) /// train : extract train data feature /// dev : extract develop data feature /// test : extract test data feature /// </param> private void ExtractFeature(HashSet <string> options) { if (options == null) { // set default options options = new HashSet <string>(new string[] { "bayes", "all" }); } if (options.Contains("bayes")) { // extract features for bayes model if (options.Contains("train") || options.Contains("all")) { ExtractBayesFeature((string)GlobalParameter.Get(DefaultParameter.Field.train_data_file), (string)GlobalParameter.Get(DefaultParameter.Field.train_feature_file)); } if (options.Contains("dev") || options.Contains("all")) { ExtractBayesFeature((string)GlobalParameter.Get(DefaultParameter.Field.develop_data_file), (string)GlobalParameter.Get(DefaultParameter.Field.develop_feature_file)); } if (options.Contains("test") || options.Contains("all")) { ExtractBayesFeature((string)GlobalParameter.Get(DefaultParameter.Field.test_data_file), (string)GlobalParameter.Get(DefaultParameter.Field.test_feature_file)); } } else if (options.Contains("svm")) { // extract features for svm model if (options.Contains("train") || options.Contains("all")) { var extractor = new ParallelSVMFeatureExtractor((string)GlobalParameter.Get(DefaultParameter.Field.train_data_file), (string)GlobalParameter.Get(DefaultParameter.Field.train_feature_file)); extractor.ExtractFeature(); } if (options.Contains("dev") || options.Contains("all")) { var extractor = new ParallelSVMFeatureExtractor((string)GlobalParameter.Get(DefaultParameter.Field.develop_data_file), (string)GlobalParameter.Get(DefaultParameter.Field.develop_feature_file)); extractor.ExtractFeature(); } if (options.Contains("test") || options.Contains("all")) { var extractor = new ParallelSVMFeatureExtractor((string)GlobalParameter.Get(DefaultParameter.Field.test_data_file), (string)GlobalParameter.Get(DefaultParameter.Field.test_feature_file)); extractor.ExtractFeature(); } } else if (options.Contains("me")) { // extract features for svm model if (options.Contains("train") || options.Contains("all")) { var extractor = new ParallelMaxEntFeatureExtractor((string)GlobalParameter.Get(DefaultParameter.Field.train_data_file), (string)GlobalParameter.Get(DefaultParameter.Field.train_feature_file)); extractor.ExtractFeature(); } if (options.Contains("dev") || options.Contains("all")) { var extractor = new ParallelMaxEntFeatureExtractor((string)GlobalParameter.Get(DefaultParameter.Field.develop_data_file), (string)GlobalParameter.Get(DefaultParameter.Field.develop_feature_file)); extractor.ExtractFeature(); } if (options.Contains("test") || options.Contains("all")) { var extractor = new ParallelMaxEntFeatureExtractor((string)GlobalParameter.Get(DefaultParameter.Field.test_data_file), (string)GlobalParameter.Get(DefaultParameter.Field.test_feature_file)); extractor.ExtractFeature(); } } else if (options.Contains("raw")) { // extract raw features if (options.Contains("train") || options.Contains("all")) { var extractor = new ParallelIndividualFeatureExtractor((string)GlobalParameter.Get(DefaultParameter.Field.train_data_file), (string)GlobalParameter.Get(DefaultParameter.Field.train_feature_file)); if (options.Contains("add")) { extractor.AddFeature(); } else { extractor.ExtractFeature(); } } if (options.Contains("dev") || options.Contains("all")) { var extractor = new ParallelIndividualFeatureExtractor((string)GlobalParameter.Get(DefaultParameter.Field.develop_data_file), (string)GlobalParameter.Get(DefaultParameter.Field.develop_feature_file)); if (options.Contains("add")) { extractor.AddFeature(); } else { extractor.ExtractFeature(); } } if (options.Contains("test") || options.Contains("all")) { var extractor = new ParallelIndividualFeatureExtractor((string)GlobalParameter.Get(DefaultParameter.Field.test_data_file), (string)GlobalParameter.Get(DefaultParameter.Field.test_feature_file)); if (options.Contains("add")) { extractor.AddFeature(); } else { extractor.ExtractFeature(); } } } }