{"id":204776,"date":"2025-05-29T11:05:52","date_gmt":"2025-05-29T03:05:52","guid":{"rendered":"https:\/\/server.hk\/cnblog\/204776\/"},"modified":"2025-05-29T11:05:52","modified_gmt":"2025-05-29T03:05:52","slug":"python-%e8%af%ad%e9%9f%b3%e8%af%86%e5%88%ab%e5%ba%93%e5%93%aa%e5%ae%b6%e5%bc%ba%ef%bc%9f%e4%b8%bb%e6%b5%81%e5%ba%93%e5%af%b9%e6%af%94%e5%88%86%e6%9e%90","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/204776\/","title":{"rendered":"Python \u8bed\u97f3\u8bc6\u522b\u5e93\u54ea\u5bb6\u5f3a\uff1f\u4e3b\u6d41\u5e93\u5bf9\u6bd4\u5206\u6790"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>Python \u8bed\u97f3\u8bc6\u522b\u5e93\u54ea\u5bb6\u5f3a\uff1f\u4e3b\u6d41\u5e93\u5bf9\u6bd4\u5206\u6790<\/h1>\n<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241116\/173172585667380a20af477.jpg\" class=\"aligncenter\"><\/p>\n<p><strong>\u63a2\u7d22 python \u4e3b\u6d41\u8bed\u97f3\u8bc6\u522b\u5e93<\/strong><\/p>\n<p>\u5728\u89e3\u51b3\u8bed\u8a00\u8bc6\u522b\u65b9\u9762\u7684\u95ee\u9898\u65f6\uff0cpython \u8bed\u8a00\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u5de5\u5177\u6765\u6ee1\u8db3\u5404\u79cd\u9700\u6c42\u3002\u672c\u6587\u5c06\u63a2\u8ba8\u76ee\u524d python \u751f\u6001\u7cfb\u7edf\u4e2d\u6700\u6d41\u884c\u548c\u5b9e\u7528\u7684\u8bed\u97f3\u8bc6\u522b\u5e93\uff0c\u5e2e\u52a9\u60a8\u627e\u5230\u9002\u5408\u60a8\u9879\u76ee\u7684\u6700\u4f73\u89e3\u51b3\u65b9\u6848\u3002<\/p>\n<p><strong>\u767e\u5ea6\u98de\u6d46<\/strong><\/p>\n<p>\u767e\u5ea6\u98de\u6d46\u662f\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u7684\u8bed\u97f3\u8bc6\u522b\u5e93\uff0c\u7531\u767e\u5ea6\u4eba\u5de5\u667a\u80fd\u63d0\u4f9b\u652f\u6301\u3002\u5b83\u63d0\u4f9b\u4e00\u7cfb\u5217\u5f00\u7bb1\u5373\u7528\u7684\u6a21\u578b\uff0c\u53ef\u4ee5\u5feb\u901f\u51c6\u786e\u5730\u8bc6\u522b\u8bed\u97f3\u8f93\u5165\u3002\u6b64\u5916\uff0c\u98de\u6d46\u8fd8\u63d0\u4f9b\u4e86\u53cb\u597d\u7684\u754c\u9762\u548c\u6587\u6863\uff0c\u65b9\u4fbf\u5f00\u53d1\u4eba\u5458\u4f7f\u7528\u3002<\/p>\n<p><strong>sphinx<\/strong><\/p>\n<p>sphinx \u662f\u4e00\u6b3e\u6210\u719f\u7684\u3001\u5f00\u6e90\u8bed\u97f3\u8bc6\u522b\u5e93\uff0c\u5177\u6709\u5e7f\u6cdb\u7684\u8bed\u8a00\u652f\u6301\u548c\u8f83\u9ad8\u7684\u51c6\u786e\u6027\u3002\u5b83\u652f\u6301\u81ea\u5b9a\u4e49\u6a21\u578b\u8bad\u7ec3\uff0c\u5141\u8bb8\u5f00\u53d1\u4eba\u5458\u9488\u5bf9\u7279\u5b9a\u7528\u4f8b\u4f18\u5316\u8bc6\u522b\u6027\u80fd\u3002sphinx \u63d0\u4f9b\u4e86\u4e00\u4e2a\u6e05\u6670\u7684 api\uff0c\u4f46\u53ef\u80fd\u9700\u8981\u66f4\u591a\u7684\u6280\u672f\u77e5\u8bc6\u6765\u4f7f\u7528\u3002<\/p>\n<p><strong>\u793a\u4f8b\u4ee3\u7801<\/strong><\/p>\n<p>\u4ee5\u4e0b\u4ee3\u7801\u6f14\u793a\u4e86\u5982\u4f55\u4f7f\u7528 sphinx \u8fdb\u884c\u8bed\u97f3\u8bc6\u522b\uff1a<\/p>\n<pre>import speech_recognition as sr\n\n# \u4ece\u9ea6\u514b\u98ce\u83b7\u5f97\u97f3\u9891\nr = sr.Recognizer()\nharvard = sr.AudioFile(r\"C:\\Desktop\\start.wav\")\nwith harvard as source:\n    audio = r.record(source)\n\n# \u4f7f\u7528 Sphinx \u8bc6\u522b\u8bed\u97f3\ntry:\n    print(\"Sphinx thinks you said \" + r.recognize_sphinx(audio))\nexcept sr.UnknownValueError:\n    print(\"Sphinx could not understand audio\")\nexcept sr.RequestError as e:\n    print(\"Sphinx error; {0}\".format(e))<\/pre>\n<p><strong>\u666e\u901a\u8bdd\u8bc6\u522b<\/strong><\/p>\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0csphinx \u5bf9\u82f1\u8bed\u8bed\u97f3\u8fdb\u884c\u8bc6\u522b\u3002\u8981\u4f7f\u7528\u666e\u901a\u8bdd\uff0c\u60a8\u9700\u8981\u4e0b\u8f7d\u5b98\u65b9\u8bed\u97f3\u5305\u3002<\/p>\n<p><strong>\u5176\u4ed6\u9009\u9879<\/strong><\/p>\n<p>\u9664\u4e86\u4e0a\u8ff0\u5e93\u4e4b\u5916\uff0c\u8fd8\u6709\u5176\u4ed6\u4e00\u4e9b\u9002\u7528\u4e8e python \u7684\u8bed\u97f3\u8bc6\u522b\u9009\u9879\uff0c\u5305\u62ec\uff1a<\/p>\n<ul>\n<li>speechrecognition<\/li>\n<li>pyaudio<\/li>\n<li>deepspeech<\/li>\n<li>snowboy<\/li>\n<\/ul>\n<p>\u4eca\u5929\u5173\u4e8e\u300aPython \u8bed\u97f3\u8bc6\u522b\u5e93\u54ea\u5bb6\u5f3a\uff1f\u4e3b\u6d41\u5e93\u5bf9\u6bd4\u5206\u6790\u300b\u7684\u5185\u5bb9\u5c31\u4ecb\u7ecd\u5230\u8fd9\u91cc\u4e86\uff0c\u662f\u4e0d\u662f\u5b66\u8d77\u6765\u4e00\u76ee\u4e86\u7136\uff01\u60f3\u8981\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u7684\u5185\u5bb9\u8bf7\u5173\u6ce8\u516c\u4f17\u53f7\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python \u8bed\u97f3\u8bc6\u522b\u5e93\u54ea\u5bb6\u5f3a\uff1f&#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-204776","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/204776","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=204776"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/204776\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=204776"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=204776"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=204776"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}