{"id":1033149,"date":"2024-12-31T11:39:23","date_gmt":"2024-12-31T03:39:23","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1033149.html"},"modified":"2024-12-31T11:39:26","modified_gmt":"2024-12-31T03:39:26","slug":"python%e5%a6%82%e4%bd%95%e5%81%9a%e5%86%85%e5%ae%b9%e6%9f%a5%e9%87%8d%e7%8e%87","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1033149.html","title":{"rendered":"python\u5982\u4f55\u505a\u5185\u5bb9\u67e5\u91cd\u7387"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-docs.pingcode.com\/wp-content\/uploads\/2024\/12\/74160b4f-d8ec-42bc-a2f2-83143da83644.webp?x-oss-process=image\/auto-orient,1\/format,webp\" alt=\"python\u5982\u4f55\u505a\u5185\u5bb9\u67e5\u91cd\u7387\" \/><\/p>\n<p><p> <strong>Python\u505a\u5185\u5bb9\u67e5\u91cd\u7387\u7684\u65b9\u6cd5\u6709\u4ee5\u4e0b\u51e0\u79cd\uff1a\u4f7f\u7528\u54c8\u5e0c\u7b97\u6cd5\u3001\u4f7f\u7528n-gram\u6a21\u578b\u3001\u5229\u7528\u4f59\u5f26\u76f8\u4f3c\u5ea6\u8ba1\u7b97<\/strong>\u3002\u5176\u4e2d\uff0c\u4f59\u5f26\u76f8\u4f3c\u5ea6\u8ba1\u7b97\u662f\u4e00\u79cd\u5e38\u89c1\u4e14\u6709\u6548\u7684\u65b9\u6cd5\u3002\u5b83\u901a\u8fc7\u5c06\u6587\u672c\u8f6c\u6362\u4e3a\u5411\u91cf\uff0c\u7136\u540e\u8ba1\u7b97\u5411\u91cf\u4e4b\u95f4\u7684\u5939\u89d2\u4f59\u5f26\u503c\u6765\u5224\u65ad\u76f8\u4f3c\u5ea6\u3002\u5177\u4f53\u5b9e\u73b0\u65f6\uff0c\u53ef\u4ee5\u5229\u7528Python\u7684\u76f8\u5173\u5e93\uff0c\u5982<code>sklearn<\/code>\u3001<code>nltk<\/code>\u7b49\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528\u8fd9\u4e9b\u65b9\u6cd5\u6765\u5b9e\u73b0\u5185\u5bb9\u67e5\u91cd\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u54c8\u5e0c\u7b97\u6cd5<\/p>\n<\/p>\n<p><p>\u54c8\u5e0c\u7b97\u6cd5\u662f\u4e00\u79cd\u5c06\u6587\u672c\u6570\u636e\u8f6c\u6362\u4e3a\u56fa\u5b9a\u957f\u5ea6\u7684\u5b57\u7b26\u4e32\u7684\u65b9\u6cd5\u3002\u5e38\u89c1\u7684\u54c8\u5e0c\u7b97\u6cd5\u6709MD5\u548cSHA-1\u3002\u901a\u8fc7\u5c06\u6587\u672c\u8f6c\u6362\u4e3a\u54c8\u5e0c\u503c\uff0c\u7136\u540e\u6bd4\u8f83\u54c8\u5e0c\u503c\uff0c\u53ef\u4ee5\u5224\u65ad\u4e24\u4e2a\u6587\u672c\u662f\u5426\u76f8\u540c\u3002\u8fd9\u79cd\u65b9\u6cd5\u7b80\u5355\u9ad8\u6548\uff0c\u4f46\u65e0\u6cd5\u5904\u7406\u8f7b\u5fae\u4fee\u6539\u540e\u7684\u6587\u672c\u3002<\/p>\n<\/p>\n<p><h3>1.1 \u4f7f\u7528MD5\u54c8\u5e0c\u7b97\u6cd5<\/h3>\n<\/p>\n<p><p>MD5\uff08Message-Digest Algorithm 5\uff09\u662f\u8ba1\u7b97\u673a\u5b89\u5168\u9886\u57df\u5e7f\u6cdb\u4f7f\u7528\u7684\u54c8\u5e0c\u51fd\u6570\uff0c\u53ef\u4ee5\u751f\u6210\u4e00\u4e2a128\u4f4d\u7684\u54c8\u5e0c\u503c\u3002\u4ee5\u4e0b\u662f\u4f7f\u7528Python\u5b9e\u73b0MD5\u54c8\u5e0c\u7b97\u6cd5\u7684\u4f8b\u5b50\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import hashlib<\/p>\n<p>def calculate_md5(text):<\/p>\n<p>    md5 = hashlib.md5()<\/p>\n<p>    md5.update(text.encode(&#39;utf-8&#39;))<\/p>\n<p>    return md5.hexdigest()<\/p>\n<p>text1 = &quot;This is a sample text.&quot;<\/p>\n<p>text2 = &quot;This is a sample text.&quot;<\/p>\n<p>hash1 = calculate_md5(text1)<\/p>\n<p>hash2 = calculate_md5(text2)<\/p>\n<p>if hash1 == hash2:<\/p>\n<p>    print(&quot;The texts are identical.&quot;)<\/p>\n<p>else:<\/p>\n<p>    print(&quot;The texts are different.&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>1.2 \u4f7f\u7528SHA-1\u54c8\u5e0c\u7b97\u6cd5<\/h3>\n<\/p>\n<p><p>SHA-1\uff08Secure Hash Algorithm 1\uff09\u662f\u4e00\u79cd\u5e7f\u6cdb\u4f7f\u7528\u7684\u54c8\u5e0c\u51fd\u6570\uff0c\u53ef\u4ee5\u751f\u6210\u4e00\u4e2a160\u4f4d\u7684\u54c8\u5e0c\u503c\u3002\u4ee5\u4e0b\u662f\u4f7f\u7528Python\u5b9e\u73b0SHA-1\u54c8\u5e0c\u7b97\u6cd5\u7684\u4f8b\u5b50\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import hashlib<\/p>\n<p>def calculate_sha1(text):<\/p>\n<p>    sha1 = hashlib.sha1()<\/p>\n<p>    sha1.update(text.encode(&#39;utf-8&#39;))<\/p>\n<p>    return sha1.hexdigest()<\/p>\n<p>text1 = &quot;This is a sample text.&quot;<\/p>\n<p>text2 = &quot;This is a sample text.&quot;<\/p>\n<p>hash1 = calculate_sha1(text1)<\/p>\n<p>hash2 = calculate_sha1(text2)<\/p>\n<p>if hash1 == hash2:<\/p>\n<p>    print(&quot;The texts are identical.&quot;)<\/p>\n<p>else:<\/p>\n<p>    print(&quot;The texts are different.&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e8c\u3001n-gram\u6a21\u578b<\/p>\n<\/p>\n<p><p>n-gram\u6a21\u578b\u662f\u4e00\u79cd\u57fa\u4e8e\u7edf\u8ba1\u7684\u6587\u672c\u76f8\u4f3c\u5ea6\u8ba1\u7b97\u65b9\u6cd5\u3002\u5b83\u901a\u8fc7\u5c06\u6587\u672c\u5206\u5272\u6210n\u4e2a\u8fde\u7eed\u7684\u5355\u8bcd\u6216\u5b57\u7b26\u7684\u5e8f\u5217\uff0c\u7136\u540e\u6bd4\u8f83\u8fd9\u4e9b\u5e8f\u5217\u4e4b\u95f4\u7684\u76f8\u4f3c\u5ea6\u6765\u5224\u65ad\u6587\u672c\u7684\u76f8\u4f3c\u5ea6\u3002<\/p>\n<\/p>\n<p><h3>2.1 n-gram\u6a21\u578b\u4ecb\u7ecd<\/h3>\n<\/p>\n<p><p>n-gram\u6a21\u578b\u7684\u57fa\u672c\u601d\u60f3\u662f\u5c06\u6587\u672c\u5206\u5272\u6210n\u4e2a\u8fde\u7eed\u7684\u5355\u8bcd\u6216\u5b57\u7b26\u7684\u5e8f\u5217\u3002\u4f8b\u5982\uff0c\u5bf9\u4e8e\u6587\u672c &quot;This is a sample text.&quot;\uff0c\u5f53n=2\u65f6\uff0c\u53ef\u4ee5\u5f97\u5230\u4ee5\u4e0b2-gram\u5e8f\u5217\uff1a<\/p>\n<\/p>\n<p><pre><code>[&#39;This is&#39;, &#39;is a&#39;, &#39;a sample&#39;, &#39;sample text&#39;]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u6bd4\u8f83\u8fd9\u4e9b\u5e8f\u5217\u4e4b\u95f4\u7684\u76f8\u4f3c\u5ea6\uff0c\u53ef\u4ee5\u5224\u65ad\u6587\u672c\u7684\u76f8\u4f3c\u5ea6\u3002<\/p>\n<\/p>\n<p><h3>2.2 \u4f7f\u7528Python\u5b9e\u73b0n-gram\u6a21\u578b<\/h3>\n<\/p>\n<p><p>\u4ee5\u4e0b\u662f\u4f7f\u7528Python\u5b9e\u73b0n-gram\u6a21\u578b\u7684\u4f8b\u5b50\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from collections import Counter<\/p>\n<p>def ngram(text, n):<\/p>\n<p>    words = text.split()<\/p>\n<p>    return [tuple(words[i:i+n]) for i in range(len(words)-n+1)]<\/p>\n<p>def calculate_similarity(text1, text2, n):<\/p>\n<p>    ngrams1 = ngram(text1, n)<\/p>\n<p>    ngrams2 = ngram(text2, n)<\/p>\n<p>    counter1 = Counter(ngrams1)<\/p>\n<p>    counter2 = Counter(ngrams2)<\/p>\n<p>    intersection = sum((counter1 &amp; counter2).values())<\/p>\n<p>    union = sum((counter1 | counter2).values())<\/p>\n<p>    return intersection \/ union<\/p>\n<p>text1 = &quot;This is a sample text.&quot;<\/p>\n<p>text2 = &quot;This is a sample text.&quot;<\/p>\n<p>similarity = calculate_similarity(text1, text2, 2)<\/p>\n<p>print(f&quot;Similarity: {similarity:.2f}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e09\u3001\u4f59\u5f26\u76f8\u4f3c\u5ea6\u8ba1\u7b97<\/p>\n<\/p>\n<p><p>\u4f59\u5f26\u76f8\u4f3c\u5ea6\uff08Cosine Similarity\uff09\u662f\u4e00\u79cd\u5e38\u7528\u7684\u6587\u672c\u76f8\u4f3c\u5ea6\u8ba1\u7b97\u65b9\u6cd5\u3002\u5b83\u901a\u8fc7\u5c06\u6587\u672c\u8f6c\u6362\u4e3a\u5411\u91cf\uff0c\u7136\u540e\u8ba1\u7b97\u5411\u91cf\u4e4b\u95f4\u7684\u5939\u89d2\u4f59\u5f26\u503c\u6765\u5224\u65ad\u76f8\u4f3c\u5ea6\u3002\u4f59\u5f26\u76f8\u4f3c\u5ea6\u7684\u53d6\u503c\u8303\u56f4\u57280\u52301\u4e4b\u95f4\uff0c\u503c\u8d8a\u63a5\u8fd11\uff0c\u8868\u793a\u6587\u672c\u8d8a\u76f8\u4f3c\u3002<\/p>\n<\/p>\n<p><h3>3.1 \u4f59\u5f26\u76f8\u4f3c\u5ea6\u4ecb\u7ecd<\/h3>\n<\/p>\n<p><p>\u4f59\u5f26\u76f8\u4f3c\u5ea6\u7684\u516c\u5f0f\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><pre><code>cosine_similarity = (A \u00b7 B) \/ (||A|| ||B||)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5176\u4e2d\uff0cA\u548cB\u662f\u4e24\u4e2a\u6587\u672c\u7684\u5411\u91cf\uff0cA \u00b7 B\u8868\u793a\u5411\u91cfA\u548c\u5411\u91cfB\u7684\u70b9\u79ef\uff0c||A||\u548c||B||\u5206\u522b\u8868\u793a\u5411\u91cfA\u548c\u5411\u91cfB\u7684\u6a21\u3002<\/p>\n<\/p>\n<p><h3>3.2 \u4f7f\u7528Python\u5b9e\u73b0\u4f59\u5f26\u76f8\u4f3c\u5ea6\u8ba1\u7b97<\/h3>\n<\/p>\n<p><p>\u4ee5\u4e0b\u662f\u4f7f\u7528Python\u5b9e\u73b0\u4f59\u5f26\u76f8\u4f3c\u5ea6\u8ba1\u7b97\u7684\u4f8b\u5b50\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from sklearn.feature_extraction.text import CountVectorizer<\/p>\n<p>from sklearn.metrics.p<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>rwise import cosine_similarity<\/p>\n<p>def calculate_cosine_similarity(text1, text2):<\/p>\n<p>    vectorizer = CountVectorizer().fit_transform([text1, text2])<\/p>\n<p>    vectors = vectorizer.toarray()<\/p>\n<p>    cosine_sim = cosine_similarity(vectors)<\/p>\n<p>    return cosine_sim[0][1]<\/p>\n<p>text1 = &quot;This is a sample text.&quot;<\/p>\n<p>text2 = &quot;This is a sample text.&quot;<\/p>\n<p>similarity = calculate_cosine_similarity(text1, text2)<\/p>\n<p>print(f&quot;Cosine Similarity: {similarity:.2f}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>3.3 \u4f7f\u7528TF-IDF\u6539\u8fdb\u4f59\u5f26\u76f8\u4f3c\u5ea6\u8ba1\u7b97<\/h3>\n<\/p>\n<p><p>TF-IDF\uff08Term Frequency-Inverse Document Frequency\uff09\u662f\u4e00\u79cd\u5e38\u7528\u7684\u6587\u672c\u7279\u5f81\u63d0\u53d6\u65b9\u6cd5\uff0c\u53ef\u4ee5\u63d0\u9ad8\u4f59\u5f26\u76f8\u4f3c\u5ea6\u8ba1\u7b97\u7684\u51c6\u786e\u6027\u3002\u4ee5\u4e0b\u662f\u4f7f\u7528Python\u5b9e\u73b0TF-IDF\u6539\u8fdb\u4f59\u5f26\u76f8\u4f3c\u5ea6\u8ba1\u7b97\u7684\u4f8b\u5b50\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from sklearn.feature_extraction.text import TfidfVectorizer<\/p>\n<p>from sklearn.metrics.pairwise import cosine_similarity<\/p>\n<p>def calculate_tfidf_cosine_similarity(text1, text2):<\/p>\n<p>    vectorizer = TfidfVectorizer().fit_transform([text1, text2])<\/p>\n<p>    vectors = vectorizer.toarray()<\/p>\n<p>    cosine_sim = cosine_similarity(vectors)<\/p>\n<p>    return cosine_sim[0][1]<\/p>\n<p>text1 = &quot;This is a sample text.&quot;<\/p>\n<p>text2 = &quot;This is a sample text.&quot;<\/p>\n<p>similarity = calculate_tfidf_cosine_similarity(text1, text2)<\/p>\n<p>print(f&quot;TF-IDF Cosine Similarity: {similarity:.2f}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u56db\u3001\u7efc\u5408\u5e94\u7528<\/p>\n<\/p>\n<p><p>\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u53ef\u4ee5\u5c06\u4e0a\u8ff0\u51e0\u79cd\u65b9\u6cd5\u7ed3\u5408\u4f7f\u7528\uff0c\u4ee5\u63d0\u9ad8\u67e5\u91cd\u7684\u51c6\u786e\u6027\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u5148\u4f7f\u7528\u54c8\u5e0c\u7b97\u6cd5\u8fdb\u884c\u5feb\u901f\u7b5b\u9009\uff0c\u7136\u540e\u4f7f\u7528n-gram\u6a21\u578b\u548c\u4f59\u5f26\u76f8\u4f3c\u5ea6\u8ba1\u7b97\u8fdb\u884c\u8fdb\u4e00\u6b65\u6bd4\u8f83\u3002<\/p>\n<\/p>\n<p><h3>4.1 \u7efc\u5408\u5e94\u7528\u793a\u4f8b<\/h3>\n<\/p>\n<p><p>\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7efc\u5408\u5e94\u7528\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import hashlib<\/p>\n<p>from collections import Counter<\/p>\n<p>from sklearn.feature_extraction.text import TfidfVectorizer<\/p>\n<p>from sklearn.metrics.pairwise import cosine_similarity<\/p>\n<p>def calculate_md5(text):<\/p>\n<p>    md5 = hashlib.md5()<\/p>\n<p>    md5.update(text.encode(&#39;utf-8&#39;))<\/p>\n<p>    return md5.hexdigest()<\/p>\n<p>def ngram(text, n):<\/p>\n<p>    words = text.split()<\/p>\n<p>    return [tuple(words[i:i+n]) for i in range(len(words)-n+1)]<\/p>\n<p>def calculate_ngram_similarity(text1, text2, n):<\/p>\n<p>    ngrams1 = ngram(text1, n)<\/p>\n<p>    ngrams2 = ngram(text2, n)<\/p>\n<p>    counter1 = Counter(ngrams1)<\/p>\n<p>    counter2 = Counter(ngrams2)<\/p>\n<p>    intersection = sum((counter1 &amp; counter2).values())<\/p>\n<p>    union = sum((counter1 | counter2).values())<\/p>\n<p>    return intersection \/ union<\/p>\n<p>def calculate_tfidf_cosine_similarity(text1, text2):<\/p>\n<p>    vectorizer = TfidfVectorizer().fit_transform([text1, text2])<\/p>\n<p>    vectors = vectorizer.toarray()<\/p>\n<p>    cosine_sim = cosine_similarity(vectors)<\/p>\n<p>    return cosine_sim[0][1]<\/p>\n<p>def check_similarity(text1, text2):<\/p>\n<p>    hash1 = calculate_md5(text1)<\/p>\n<p>    hash2 = calculate_md5(text2)<\/p>\n<p>    if hash1 == hash2:<\/p>\n<p>        print(&quot;The texts are identical.&quot;)<\/p>\n<p>        return<\/p>\n<p>    ngram_similarity = calculate_ngram_similarity(text1, text2, 2)<\/p>\n<p>    tfidf_cosine_similarity = calculate_tfidf_cosine_similarity(text1, text2)<\/p>\n<p>    print(f&quot;n-gram Similarity: {ngram_similarity:.2f}&quot;)<\/p>\n<p>    print(f&quot;TF-IDF Cosine Similarity: {tfidf_cosine_similarity:.2f}&quot;)<\/p>\n<p>text1 = &quot;This is a sample text.&quot;<\/p>\n<p>text2 = &quot;This is a sample text.&quot;<\/p>\n<p>check_similarity(text1, text2)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u7efc\u5408\u4f7f\u7528\u54c8\u5e0c\u7b97\u6cd5\u3001n-gram\u6a21\u578b\u548c\u4f59\u5f26\u76f8\u4f3c\u5ea6\u8ba1\u7b97\uff0c\u53ef\u4ee5\u66f4\u51c6\u786e\u5730\u5224\u65ad\u6587\u672c\u7684\u76f8\u4f3c\u5ea6\uff0c\u4ece\u800c\u5b9e\u73b0\u9ad8\u6548\u7684\u5185\u5bb9\u67e5\u91cd\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u4f7f\u7528Python\u68c0\u6d4b\u6587\u672c\u7684\u76f8\u4f3c\u6027\uff1f<\/strong><br \/>\u4f7f\u7528Python\u8fdb\u884c\u6587\u672c\u76f8\u4f3c\u6027\u68c0\u6d4b\uff0c\u901a\u5e38\u53ef\u4ee5\u5229\u7528\u591a\u79cd\u65b9\u6cd5\uff0c\u5982\u8ba1\u7b97\u4f59\u5f26\u76f8\u4f3c\u5ea6\u3001Jaccard\u76f8\u4f3c\u6027\u6216\u4f7f\u7528\u81ea\u7136\u8bed\u8a00\u5904\u7406\u5e93\uff0c\u5982spaCy\u6216NLTK\u3002\u901a\u8fc7\u5206\u8bcd\u3001\u53bb\u9664\u505c\u7528\u8bcd\u540e\uff0c\u53ef\u4ee5\u5bf9\u6587\u672c\u8fdb\u884c\u5411\u91cf\u5316\u5904\u7406\uff0c\u518d\u901a\u8fc7\u76f8\u5e94\u7684\u7b97\u6cd5\u8ba1\u7b97\u76f8\u4f3c\u5ea6\u5206\u6570\uff0c\u5224\u65ad\u6587\u672c\u662f\u5426\u5b58\u5728\u91cd\u590d\u5185\u5bb9\u3002<\/p>\n<p><strong>\u6709\u54ea\u4e9bPython\u5e93\u53ef\u4ee5\u5e2e\u52a9\u6211\u8fdb\u884c\u5185\u5bb9\u67e5\u91cd\uff1f<\/strong><br \/>\u6709\u51e0\u4e2a\u5e38\u7528\u7684Python\u5e93\u53ef\u4ee5\u5e2e\u52a9\u8fdb\u884c\u5185\u5bb9\u67e5\u91cd\uff0c\u5305\u62ec<code>difflib<\/code>\u3001<code>fuzzywuzzy<\/code>\u548c<code>sklearn<\/code>\u3002<code>difflib<\/code>\u63d0\u4f9b\u4e86\u7b80\u5355\u7684\u6587\u672c\u6bd4\u8f83\u529f\u80fd\uff0c<code>fuzzywuzzy<\/code>\u80fd\u591f\u5904\u7406\u6a21\u7cca\u5339\u914d\uff0c\u800c<code>sklearn<\/code>\u5219\u53ef\u7528\u4e8e\u66f4\u590d\u6742\u7684\u6587\u672c\u5206\u6790\u548c<a href=\"https:\/\/docs.pingcode.com\/ask\/59192.html\" target=\"_blank\">\u673a\u5668\u5b66\u4e60<\/a>\u6a21\u578b\u6784\u5efa\u3002<\/p>\n<p><strong>\u5982\u4f55\u8bc4\u4f30\u67e5\u91cd\u7ed3\u679c\u7684\u51c6\u786e\u6027\uff1f<\/strong><br \/>\u8bc4\u4f30\u67e5\u91cd\u7ed3\u679c\u7684\u51c6\u786e\u6027\u53ef\u4ee5\u901a\u8fc7\u4eba\u5de5\u62bd\u6837\u68c0\u67e5\u3001\u8ba1\u7b97\u67e5\u91cd\u7b97\u6cd5\u7684\u7cbe\u786e\u5ea6\u548c\u53ec\u56de\u7387\u7b49\u65b9\u5f0f\u8fdb\u884c\u3002\u5982\u679c\u4f7f\u7528\u673a\u5668\u5b66\u4e60\u6a21\u578b\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ea4\u53c9\u9a8c\u8bc1\u65b9\u6cd5\u8bc4\u4f30\u6a21\u578b\u7684\u6027\u80fd\uff0c\u4ee5\u786e\u4fdd\u67e5\u91cd\u7ed3\u679c\u7684\u53ef\u9760\u6027\u548c\u6709\u6548\u6027\u3002\u6b64\u5916\uff0c\u7ed3\u5408\u591a\u79cd\u67e5\u91cd\u7b97\u6cd5\u7684\u7ed3\u679c\u4e5f\u6709\u52a9\u4e8e\u63d0\u5347\u51c6\u786e\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Python\u505a\u5185\u5bb9\u67e5\u91cd\u7387\u7684\u65b9\u6cd5\u6709\u4ee5\u4e0b\u51e0\u79cd\uff1a\u4f7f\u7528\u54c8\u5e0c\u7b97\u6cd5\u3001\u4f7f\u7528n-gram\u6a21\u578b\u3001\u5229\u7528\u4f59\u5f26\u76f8\u4f3c\u5ea6\u8ba1\u7b97\u3002\u5176\u4e2d\uff0c\u4f59\u5f26\u76f8 [&hellip;]","protected":false},"author":3,"featured_media":1033158,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1033149"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=1033149"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1033149\/revisions"}],"predecessor-version":[{"id":1033161,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1033149\/revisions\/1033161"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1033158"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1033149"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1033149"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1033149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}