擅长:python、mysql、java
<p>pycrfsuite文档没有提到它们对特性值和键的Unicode支持。
我也不能从示例中判断,因为我不清楚它们是python2还是python3。
另外,我对Cython的了解还不足以通过阅读资料给你一个明确的答案。在</p>
<p>无论如何,我建议你尝试两种方法:</p>
<ol>
<li><p>在你把钥匙送到图书馆之前,你自己先把钥匙编码一下。如果值也是字符串,也要对它们进行编码。也许库很乐意接受<code>bytes</code>对象。</p></li>
<li><p>如果这不起作用(因为它确实想要ASCII),那么使用一些ASCII编码,例如使用<code>urlencode</code>或在字符串上调用Python的<code>ascii()</code>内置函数。后者将使用反斜杠转义符和引号将<code>'can’t'</code>编码为<code>"'can\\u2019t'"</code>。这并不重要,因为分类器不关心特征键的外观,只要相同的输入产生相同的特征键。</p></li>
</ol>
<p>我希望这有帮助!在</p>