Example #1
0
        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));
        }
Example #2
0
        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);
            }
        }
Example #3
0
 public CRFDependencyParser(string modelPath)
 {
     _crfModel = GlobalCache.Get(modelPath) as CRFDependencyModel;
     if (_crfModel != null)
     {
         return;
     }
     if (Load(modelPath))
     {
         GlobalCache.Put(modelPath, _crfModel);
     }
 }
Example #4
0
 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);
     }
 }
Example #5
0
 public CRFSegment(CRFSegmentModel crfModel)
 {
     this._crfModel = crfModel;
 }