{"id":4940,"date":"2024-10-05T15:01:01","date_gmt":"2024-10-05T07:01:01","guid":{"rendered":""},"modified":"2024-10-05T15:01:01","modified_gmt":"2024-10-05T07:01:01","slug":"\u9690\u9a6c\u5c14\u79d1\u592b\u6a21\u578b\u7b97\u6cd5_\u4e58\u6cd5\u53e3\u8bc0","status":"publish","type":"post","link":"https:\/\/mushiming.com\/4940.html","title":{"rendered":"\u9690\u9a6c\u5c14\u79d1\u592b\u6a21\u578b\u7b97\u6cd5_\u4e58\u6cd5\u53e3\u8bc0"},"content":{"rendered":"

\u8fd9\u6bb5\u65f6\u95f4\u4e86\u89e3\u4e86\u9690\u9a6c\u5c14\u79d1\u592b\u7b97\u6cd5\uff0c\u7136\u540e\u62fc\u97f3\u8f93\u5165\u6cd5\u7684\u6838\u5fc3\u5c31\u662fHMM\uff0c\u7136\u540e\u4ecegithub\u4e0a\u627e\u4e86\u4e00\u4e2a\u8f93\u5165\u6cd5\u5b9e\u73b0\u7684\u4ee3\u7801\u6765\u66f4\u900f\u5f7b\u7684\u7406\u89e3\u7b97\u6cd5\uff0c\u672c\u6587\u4ee3\u7801\u6765\u6e90\uff1ahttps:\/\/github.com\/LiuRoy\/Pinyin_Demo\uff0c\u5982\u679c\u4fb5\u6743\uff0c\u8bf7\u8054\u7cfb\u6211\u5220\u9664\uff01\uff01!<\/p>\n

\u4e00\u3001 \u62fc\u97f3\u8f93\u5165\u6cd5\u7684\u539f\u7406\u6982\u8ff0<\/p>\n

1.\u4e3b\u8981\u539f\u7406<\/p>\n

\u52a8\u6001\u89c4\u5212\uff0c\u7528\u7684\u662f\u7ef4\u7279\u6bd4\u7b97\u6cd5\u5b9e\u73b0\u7684<\/p>\n

2. \u6a21\u578b<\/p>\n

\"\u9690\u9a6c\u5c14\u79d1\u592b\u6a21\u578b\u7b97\u6cd5_\u4e58\u6cd5\u53e3\u8bc0<\/p>\n

3.  \u7b97\u6cd5\u539f\u7406<\/p>\n

 Y1,...,Yn\u4e3a\u8f93\u5165\u7684\u62fc\u97f3\u4e32\uff0cWi1,Wi2,Win\u662f\u7b2ci\u4e2a\u97f3Yi\u7684\u5019\u9009\u6c49\u5b57\uff08\u7528Wi\u4ee3\u8868\u7b2ci\u4e2a\u62fc\u97f3\u7684\u5019\u9009\u6c49\u5b57\uff09\uff0c\u5982\u4e0a\u56fe\u6240\u793a\uff0c\u5c06\u5019\u9009\u5b57\u8fde\u63a5\u8d77\u6765\u53ef\u4ee5\u7ec4\u6210\u5f88\u591a\u5f88\u591a\u7684\u53e5\u5b50\uff0c\u6bcf\u4e2a\u53e5\u5b50\u90fd\u6709\u4e00\u6761\u8def\u5f84\u4e00\u4e00\u5bf9\u5e94\uff0c\u62fc\u97f3\u8f93\u5165\u6cd5\u5c31\u662f\u8981\u6839\u636e\u4e0a\u4e0b\u6587\u5728\u7ed9\u5b9a\u7684\u62fc\u97f3\u6761\u4ef6\u4e0b\u627e\u5230\u4e00\u4e2a\u6700\u4f18\u7684\u53e5\u5b50\uff0c\u5373\uff0c\u5bf9\u5e94\u5230\u4e0a\u56fe\u4e2d\u5c31\u662f\u5bfb\u627e\u4ece\u8d77\u70b9\u5230\u7ec8\u70b9\u7684\u4e00\u6761\u6700\u77ed\u8ddd\u79bb\uff1a<\/p>\n

     \u5229\u7528\u9690\u9a6c\u5c14\u79d1\u592b\u6a21\u578b\u7b80\u5316\u4e4b\u5f97\u5230\uff1a<\/p>\n

\"\u9690\u9a6c\u5c14\u79d1\u592b\u6a21\u578b\u7b97\u6cd5_\u4e58\u6cd5\u53e3\u8bc0<\/p>\n

 \u5b9a\u4e49\u8ddd\u79bb\uff1aD(Wi-1,Wi)=-logP(Wi|Wi-1)*P(Yi|Wi)\uff0c\u4ee5\u6b64\u4f5c\u4e3a\u4e24\u4e2a\u8282\u70b9\u95f4\u7684\u8ddd\u79bb\u8ba1\u7b97\u516c\u5f0f\uff0c\u5229\u7528\u6709\u9650\u72b6\u6001\u673a\u548c\u52a8\u6001\u89c4\u5212\u8fdb\u884c\u6c42\u89e3<\/p>\n

\u4e8c\u3001\u4ee3\u7801\u89e3\u6790<\/p>\n

 1.\u6a21\u578b\u8bad\u7ec3<\/p>\n

\u8be5\u4ee3\u7801\u4f7f\u7528sqlite\u6570\u636e\u5e93\u6765\u4fdd\u5b58\u6a21\u578b\u53c2\u6570\uff0c\u53c2\u6570\u4e3b\u8981\u6709\u521d\u59cb\u6982\u7387\u3001\u8f6c\u79fb\u6982\u7387\u548c\u53d1\u5c04\u6982\u7387\uff0c\u4e3b\u8981\u662f\u6570\u636e\u5e93\u7684\u4e00\u4e9b\u77e5\u8bc6\uff1a<\/p>\n

1.1 \u5b9a\u4e49\u6570\u636e\u8868 \uff08hmm_tables.py\uff09<\/p>\n

import os from sqlalchemy import Column, String, Integer, Float, create_engine, desc from sqlalchemy.orm import sessionmaker from pinyin.model.common import current_dir, BaseModel db_name = os.path.join(current_dir, 'hmm.sqlite') engine = create_engine('sqlite:\/\/\/{}'.format(db_name)) HMMSession = sessionmaker(bind=engine) #\u5b9a\u4e49\u8f6c\u79fb\u6982\u7387\u8868\uff0c\u5e76\u5b9a\u4e49\u4e24\u4e2a\u7c7b\u65b9\u6cd5\uff0c\u4e00\u4e2a\u662f\u6dfb\u52a0\u8f6c\u79fb\u6982\u7387\u8bb0\u5f55\uff0c\u4e00\u4e2a\u662f\u67e5\u8be2\u8f6c\u79fb\u6982\u7387\u8868+\u53d1<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"\u9690\u9a6c\u5c14\u79d1\u592b\u6a21\u578b\u7b97\u6cd5_\u4e58\u6cd5\u53e3\u8bc0\u8fd9\u6bb5\u65f6\u95f4\u4e86\u89e3\u4e86\u9690\u9a6c\u5c14\u79d1\u592b\u7b97\u6cd5\uff0c\u7136\u540e\u62fc\u97f3\u8f93\u5165\u6cd5\u7684\u6838\u5fc3\u5c31\u662fHMM\uff0c\u7136\u540e\u4ecegithub\u4e0a\u627e\u4e86\u4e00\u4e2a\u8f93\u5165\u6cd5\u5b9e...","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"_links":{"self":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/4940"}],"collection":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/comments?post=4940"}],"version-history":[{"count":0,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/4940\/revisions"}],"wp:attachment":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/media?parent=4940"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/categories?post=4940"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/tags?post=4940"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}