private bool LoadDat(string path) { var ba = ByteArray.Create(path); if (ba == null) { return(false); } _crfModel = new CRFDependencyModel(new DoubleArrayTrie <FeatureFunction>()); return(_crfModel.LoadFromBin(ba)); }
public CRFSegment(string modelPath) { _crfModel = GlobalCache.Get(modelPath) as CRFSegmentModel; if (_crfModel == null) { //_crfModel = CRFSegmentModel.Create(modelPath); _crfModel = new CRFSegmentModel(new BinTrie <FeatureFunction>()); _crfModel.Load(modelPath); GlobalCache.Put(modelPath, _crfModel); } }
public CRFDependencyParser(string modelPath) { _crfModel = GlobalCache.Get(modelPath) as CRFDependencyModel; if (_crfModel != null) { return; } if (Load(modelPath)) { GlobalCache.Put(modelPath, _crfModel); } }
private bool Load(string path) { if (LoadDat(path + Predefine.BIN_EXT)) { return(true); } _crfModel = new CRFDependencyModel(new DoubleArrayTrie <FeatureFunction>()); try { _crfModel.LoadFromTxt(path); return(true); } catch (Exception e) { return(false); } }
public CRFSegment(CRFSegmentModel crfModel) { this._crfModel = crfModel; }