Imported from https://github.com/satyajitneogiju/FLDCRF-for-sequence-labeling