public static HMMSegment GetInstance() { if (segment == null) { segment = new HMMSegment(); } return(segment); }
/// <summary> /// 执行索引程序入口 /// </summary> /// <param name="args"></param> public override void Run(object[] args) { Init(args); segment = HMMSegment.GetInstance(); DataSaver dataSaver = new DataSaver(); string rawDatafolder = GetRootFolder() + "\\RawData"; string folder = GetRootFolder() + "\\ISE"; try { string[] files = Directory.GetFiles(rawDatafolder); //if (files.Length < 2) //{ // // 如果个数小于等于1,则休眠10min // Thread.Sleep(1000 * 60 * 10); //} for (int i = 0; i < files.Length; i++) { if (!fileVisited.Contains(files[i])) { fileVisited.Add(files[i]); try { Console.WriteLine(i + "/" + files.Length); dataSaver.AnalysisData(folder, files[i]); } catch (Exception exception) { Console.WriteLine(exception); } } } } catch (Exception exception) { Console.WriteLine(exception); } }
private static void Init() { // 加载分词组件 Console.WriteLine("[1/6]正在加载分词组件..."); segment = HMMSegment.GetInstance(); // 加载文本索引文件 Console.WriteLine("[2/6]正在加载文本索引数据..."); LoadTextIndex(); // 加载数据文件 Console.WriteLine("[3/6]正在预加载文本数据..."); LoadRawData(); // 加载知识引擎数据 Console.WriteLine("[4/6]正在加载知识引擎数据..."); LoadKnowledgeData(); // 加载知识引擎索引数据 Console.WriteLine("[5/6]正在加载知识索引数据..."); LoadKnowledgeIndex(); }