/// <summary> /// Initialize DictMatch Feature Generator /// </summary> /// <returns></returns> public bool Initialize() { dictmatch = new DictMatch(); dm_r = new List <Lemma>(); dm_offsetList = new List <int>(); Dictionary <string, string> configDict; configDict = LoadConfigFile("GenerateFeatureDictMatch.ini"); if (configDict.ContainsKey(KEY_LEXICAL_DICT_FILE_NAME.ToLower()) == false || configDict.ContainsKey(KEY_BINARY_DICT_TYPE.ToLower()) == false) { return(false); } var strDictMatchFileName = configDict[KEY_LEXICAL_DICT_FILE_NAME.ToLower()]; var bBinaryDict = bool.Parse(configDict[KEY_BINARY_DICT_TYPE.ToLower()]); if (strDictMatchFileName.Length == 0) { return(true); } if (bBinaryDict == true) { dictmatch.LoadDictFromBinary(strDictMatchFileName); } else { dictmatch.LoadDictFromRawText(strDictMatchFileName); } return(true); }
public static void VerifyRawTextDict(string strTestFileName, string strRawDictFileName) { Console.WriteLine("Load raw text dictionary..."); DictMatch match = new DictMatch(); match.LoadDictFromRawText(strRawDictFileName); Console.WriteLine("Verify raw text dictionary..."); Match(strTestFileName, match); }
public static void DictMatchSequences(string inputFilePath, string outputFilePath, string dictFilePath) { Console.WriteLine("Load raw text dictionary..."); DictMatch match = new DictMatch(); match.LoadDictFromRawText(dictFilePath); Console.WriteLine("Verify raw text dictionary..."); Match(inputFilePath, outputFilePath, match); }