{"id":204552,"date":"2025-05-29T11:59:09","date_gmt":"2025-05-29T03:59:09","guid":{"rendered":"https:\/\/server.hk\/cnblog\/204552\/"},"modified":"2025-05-29T11:59:09","modified_gmt":"2025-05-29T03:59:09","slug":"%e5%9c%a8-linux-%e6%9c%8d%e5%8a%a1%e5%99%a8%e4%b8%8a%e5%ae%89%e8%a3%85-levenshtein-%e5%ba%93%e6%97%b6%ef%bc%8c%e9%81%87%e5%88%b0%e4%ba%86-pystring_type-%e6%9c%aa%e5%a3%b0%e6%98%8e","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/204552\/","title":{"rendered":"\u5728 Linux \u670d\u52a1\u5668\u4e0a\u5b89\u88c5 Levenshtein \u5e93\u65f6\uff0c\u9047\u5230\u4e86 \u201cPyString_Type\u201d \u672a\u58f0\u660e\u7684\u9519\u8bef\uff0c\u4ee5\u53ca\u4e00\u7cfb\u5217\u5173\u4e8e\u6307\u9488\u8f6c\u6362\u7684\u8b66\u544a\uff0c\u8be5\u5982\u4f55\u89e3\u51b3\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u5728 Linux \u670d\u52a1\u5668\u4e0a\u5b89\u88c5 Levenshtein \u5e93\u65f6\uff0c\u9047\u5230\u4e86 \u201cPyString_Type\u201d \u672a\u58f0\u660e\u7684\u9519\u8bef\uff0c\u4ee5\u53ca\u4e00\u7cfb\u5217\u5173\u4e8e\u6307\u9488\u8f6c\u6362\u7684\u8b66\u544a\uff0c\u8be5\u5982\u4f55\u89e3\u51b3\uff1f<\/h1>\n<p>\u201c\u7eb5\u6709\u75be\u98ce\u6765\uff0c\u4eba\u751f\u4e0d\u8a00\u5f03\u201d\uff0c\u8fd9\u53e5\u8bdd\u9001\u7ed9\u6b63\u5728\u5b66\u4e60\u7684\u670b\u53cb\u4eec\uff0c\u4e5f\u5e0c\u671b\u5728\u9605\u8bfb\u672c\u6587<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300a\u5728 Linux \u670d\u52a1\u5668\u4e0a\u5b89\u88c5 Levenshtein \u5e93\u65f6\uff0c\u9047\u5230\u4e86 \u201cPyString_Type\u201d \u672a\u58f0\u660e\u7684\u9519\u8bef\uff0c\u4ee5\u53ca\u4e00\u7cfb\u5217\u5173\u4e8e\u6307\u9488\u8f6c\u6362\u7684\u8b66\u544a\uff0c\u8be5\u5982\u4f55\u89e3\u51b3\uff1f\u300b<\/span>\u540e\uff0c\u80fd\u591f\u771f\u7684\u5e2e\u52a9\u5230\u5927\u5bb6\u3002\u6211\u4e5f\u4f1a\u5728\u540e\u7eed\u7684\u6587\u7ae0\u4e2d\uff0c\u9646\u7eed\u66f4\u65b0<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u6587\u7ae0<\/span>\u76f8\u5173\u7684\u6280\u672f\u6587\u7ae0\uff0c\u6709\u597d\u7684\u5efa\u8bae\u6b22\u8fce\u5927\u5bb6\u5728\u8bc4\u8bba\u7559\u8a00\uff0c\u975e\u5e38\u611f\u8c22\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241110\/17312198646730519886f3b.jpg\" class=\"aligncenter\"><\/p>\n<p>\u5f53\u5728 linux \u670d\u52a1\u5668\u4e0a\u5b89\u88c5 levenshtein \u65f6\uff0c\u51fa\u73b0\u4ee5\u4e0b\u9519\u8bef\uff1a<\/p>\n<pre>\/yuwei\/anaconda3\/include\/python3.7m\/object.h:487:22: note: in definition of macro \u2018PyObject_TypeCheck\u2019\n(Py_TYPE(ob) == (tp) || PyType_IsSubtype(Py_TYPE(ob), (tp)))\n^\nLevenshtein.c:666:33: note: each undeclared identifier is reported only once for each function it appears in\nif (PyObject_TypeCheck(arg1, &amp;amp;PyString_Type)&lt;br&gt;\n^\n\/yuwei\/anaconda3\/include\/python3.7m\/object.h:487:22: note: in definition of macro \u2018PyObject_TypeCheck\u2019\n(Py_TYPE(ob) == (tp) || PyType_IsSubtype(Py_TYPE(ob), (tp)))\n^\nLevenshtein.c:670:5: warning: implicit declaration of function \u2018PyString_GET_SIZE\u2019 [-Wimplicit-function-declaration]&lt;br&gt;\nlen1 = PyString_GET_SIZE(arg1);&lt;br&gt;\n^\nLevenshtein.c:673:5: warning: implicit declaration of function \u2018PyString_AS_STRING\u2019 [-Wimplicit-function-declaration]&lt;br&gt;\nstring1 = PyString_AS_STRING(arg1);&lt;br&gt;\n^\nLevenshtein.c:673:13: warning: assignment makes pointer from integer without a cast [enabled by default]&lt;br&gt;\nstring1 = PyString_AS_STRING(arg1);&lt;br&gt;\n^\nLevenshtein.c:674:13: warning: assignment makes pointer from integer without a cast [enabled by default]&lt;br&gt;\nstring2 = PyString_AS_STRING(arg2);&lt;br&gt;\n^\nLevenshtein.c:718:3: warning: implicit declaration of function \u2018PyInt_FromLong\u2019 [-Wimplicit-function-declaration]&lt;br&gt;\nreturn PyInt_FromLong((long)ldist);&lt;br&gt;\n^\nLevenshtein.c:718:3: warning: return makes pointer from integer without a cast [enabled by default]&lt;br&gt;\nIn file included from \/yuwei\/anaconda3\/include\/python3.7m\/pytime.h:6:0,&lt;br&gt;\nfrom \/yuwei\/anaconda3\/include\/python3.7m\/Python.h:87,&lt;br&gt;\nfrom Levenshtein.c:99:&lt;br&gt;\nLevenshtein.c: In function \u2018hamming_py\u2019:&lt;br&gt;\nLevenshtein.c:747:33: error: \u2018PyString_Type\u2019 undeclared (first use in this function)&lt;br&gt;\nif (PyObject_TypeCheck(arg1, &amp;amp;PyString_Type)&lt;br&gt;\n^\n\/yuwei\/anaconda3\/include\/python3.7m\/object.h:487:22: note: in definition of macro \u2018PyObject_TypeCheck\u2019&lt;br&gt;\n(Py_TYPE(ob) == (tp) || PyType_IsSubtype(Py_TYPE(ob), (tp)))&lt;br&gt;\n^\nLevenshtein.c:758:13: warning: assignment makes pointer from integer without a cast [enabled by default]&lt;br&gt;\nstring1 = PyString_AS_STRING(arg1);&lt;br&gt;\n^\nLevenshtein.c:759:13: warning: assignment makes pointer from integer without a cast [enabled by default]&lt;br&gt;\nstring2 = PyString_AS_STRING(arg2);&lt;br&gt;\n^\nLevenshtein.c:761:5: warning: return makes pointer from integer without a cast [enabled by default]&lt;br&gt;\nreturn PyInt_FromLong(dist);&lt;br&gt;\n^\nLevenshtein.c:777:5: warning: return makes pointer from integer without a cast [enabled by default]&lt;br&gt;\nreturn PyInt_FromLong(dist);&lt;br&gt;\n^\nIn file included from \/yuwei\/anaconda3\/include\/python3.7m\/pytime.h:6:0,&lt;br&gt;\nfrom \/yuwei\/anaconda3\/include\/python3.7m\/Python.h:87,&lt;br&gt;\nfrom Levenshtein.c:99:&lt;br&gt;\nLevenshtein.c: In function \u2018jaro_py\u2019:&lt;br&gt;\nLevenshtein.c:796:33: error: \u2018PyString_Type\u2019 undeclared (first use in this function)&lt;br&gt;\nif (PyObject_TypeCheck(arg1, &amp;amp;PyString_Type)&lt;br&gt;\n^\n\/yuwei\/anaconda3\/include\/python3.7m\/object.h:487:22: note: in definition of macro \u2018PyObject_TypeCheck\u2019&lt;br&gt;\n(Py_TYPE(ob) == (tp) || PyType_IsSubtype(Py_TYPE(ob), (tp)))&lt;br&gt;\n^\nLevenshtein.c:802:13: warning: assignment makes pointer from integer without a cast [enabled by default]&lt;br&gt;\nstring1 = PyString_AS_STRING(arg1);&lt;br&gt;\n^\nLevenshtein.c:803:13: warning: assignment makes pointer from integer without a cast [enabled by default]&lt;br&gt;\nstring2 = PyString_AS_STRING(arg2);&lt;br&gt;\n^\nIn file included from \/yuwei\/anaconda3\/include\/python3.7m\/pytime.h:6:0,&lt;br&gt;\nfrom \/yuwei\/anaconda3\/include\/python3.7m\/Python.h:87,&lt;br&gt;\nfrom Levenshtein.c:99:&lt;br&gt;\nLevenshtein.c: In function \u2018jaro_winkler_py\u2019:&lt;br&gt;\nLevenshtein.c:846:33: error: \u2018PyString_Type\u2019 undeclared (first use in this function)&lt;br&gt;\nif (PyObject_TypeCheck(arg1, &amp;amp;PyString_Type)&lt;br&gt;\n^\n\/yuwei\/anaconda3\/include\/python3.7m\/object.h:487:22: note: in definition of macro \u2018PyObject_TypeCheck\u2019&lt;br&gt;\n(Py_TYPE(ob) == (tp) || PyType_IsSubtype(Py_TYPE(ob), (tp)))&lt;br&gt;\n^\nLevenshtein.c:852:13: warning: assignment makes pointer from integer without a cast [enabled by default]&lt;br&gt;\nstring1 = PyString_AS_STRING(arg1);&lt;br&gt;\n^\nLevenshtein.c:853:13: warning: assignment makes pointer from integer without a cast [enabled by default]&lt;br&gt;\nstring2 = PyString_AS_STRING(arg2);&lt;br&gt;\n^\nLevenshtein.c: In function \u2018median_common\u2019:&lt;br&gt;\nLevenshtein.c:954:7: warning: implicit declaration of function \u2018PyString_FromStringAndSize\u2019 [-Wimplicit-function-declaration]&lt;br&gt;\nresult = PyString_FromStringAndSize(medstr, len);&lt;br&gt;\n^\nLevenshtein.c:954:14: warning: assignment makes pointer from integer without a cast [enabled by default]&lt;br&gt;\nresult = PyString_FromStringAndSize(medstr, len);&lt;br&gt;\n^\nIn file included from \/yuwei\/anaconda3\/include\/python3.7m\/pytime.h:6:0,&lt;br&gt;\nfrom \/yuwei\/anaconda3\/include\/python3.7m\/Python.h:87,&lt;br&gt;\nfrom Levenshtein.c:99:&lt;br&gt;\nLevenshtein.c: In function \u2018median_improve_common\u2019:&lt;br&gt;\nLevenshtein.c:993:33: error: \u2018PyString_Type\u2019 undeclared (first use in this function)&lt;br&gt;\nif (PyObject_TypeCheck(arg1, &amp;amp;PyString_Type))&lt;br&gt;\n^\n\/yuwei\/anaconda3\/include\/python3.7m\/object.h:487:22: note: in definition of macro \u2018PyObject_TypeCheck\u2019&lt;br&gt;\n(Py_TYPE(ob) == (tp) || PyType_IsSubtype(Py_TYPE(ob), (tp)))&lt;br&gt;\n^\nLevenshtein.c:1033:19: warning: initialization makes pointer from integer without a cast [enabled by default]&lt;br&gt;\nlev_byte *s = PyString_AS_STRING(arg1);&lt;br&gt;\n^\nLevenshtein.c:1039:14: warning: assignment makes pointer from integer without a cast [enabled by default]&lt;br&gt;\nresult = PyString_FromStringAndSize(medstr, len);&lt;br&gt;\n^\nLevenshtein.c: In function \u2018extract_weightlist\u2019:&lt;br&gt;<\/pre>\n<p>\u4ee5\u4e0a\u5c31\u662f\u672c\u6587\u7684\u5168\u90e8\u5185\u5bb9\u4e86\uff0c\u662f\u5426\u6709\u987a\u5229\u5e2e\u52a9\u4f60\u89e3\u51b3\u95ee\u9898\uff1f\u82e5\u662f\u80fd\u7ed9\u4f60\u5e26\u6765\u5b66\u4e60\u4e0a\u7684\u5e2e\u52a9\uff0c\u8bf7\u5927\u5bb6\u591a\u591a\u652f\u6301\uff01\u66f4\u591a\u5173\u4e8e\u6587\u7ae0\u7684\u76f8\u5173\u77e5\u8bc6\uff0c\u4e5f\u53ef\u5173\u6ce8\u516c\u4f17\u53f7\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 Linux \u670d\u52a1\u5668\u4e0a\u5b89\u88c5 L&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-204552","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/204552","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=204552"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/204552\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=204552"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=204552"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=204552"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}