我一直在关注sklearn-crfsuite tutorial
用于训练CRF模型的特征示例如下所示。
{'+1:postag': 'Fpa',
'+1:postag[:2]': 'Fp',
'+1:word.istitle()': False,
'+1:word.isupper()': False,
'+1:word.lower()': '(',
'BOS': True,
'bias': 1.0,
'postag': 'NP',
'postag[:2]': 'NP',
'word.isdigit()': False,
'word.istitle()': True,
'word.isupper()': False,
'word.lower()': 'melbourne',
'word[-2:]': 'ne',
'word[-3:]': 'rne'}sklearn-crfsuite如何将像melbourne这样的字符串转换为浮点型,因为CRF的功能应该只是浮点型。文档中的任何地方都没有提到这一点。
发布于 2020-05-25 03:54:38
sklearn-crf特性采用python-crfsuite格式。每个字符串都被视为键:
* {"string_key": "string_value", ...} dict; that's the same as
{"string_key=string_value": 1.0, ...}
* ["string_key1", "string_key2", ...] list; that's the same as
{"string_key1": 1.0, "string_key2": 1.0, ...}你可以在这里找到更多:https://github.com/scrapinghub/python-crfsuite/blob/master/pycrfsuite/_pycrfsuite.pyx
https://stackoverflow.com/questions/58027556
复制相似问题