Using CRFsharp model with CRF++

Jul 20, 2014 at 5:06 PM
thank you for this excellent project. I have been able to use CRFsharp to train CRF models with 1/3 of RAM memory consumption compared to CRF++.
Is it possible to save or convert the model files in a format that will allow me to use them with CRF++ for decoding ?
thank you for your help
Jul 21, 2014 at 4:24 AM
Yes. By some simple convert, CRFSharp model can be converted into CRF++ model format.

Actually, Both CRFSharp and CRF++ save indexed feature set as DART format and save feature weights as array serialization. So the only different file is meta-data file which is a text file and contains some parameters and templates of the model. -- You need to convert this file from CRFSharp format to CRF++ format.

The following functions are related with model saving in CRFSharp. By reading them, you will know how model saved by CRFSharp.

Saving meta-data:
public bool SaveModelMetaData(string filename)

Saving indexed feature set:
public bool BuildFeatureSetIntoIndex(string filename, double max_slot_usage_rate_threshold, int debugLevel, string strRetrainModelFileName)

Saving feature weight:
public bool SaveFeatureWeight(string filename)