{"id":419196,"date":"2021-03-24T19:08:45","date_gmt":"2021-03-24T11:08:45","guid":{"rendered":"http:\/\/4563.org\/?p=419196"},"modified":"2021-03-24T19:08:45","modified_gmt":"2021-03-24T11:08:45","slug":"golang-%e8%87%aa%e7%84%b6%e8%af%ad%e8%a8%80%e5%a4%84%e7%90%86%e5%b7%a5%e5%85%b7gohanlp","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=419196","title":{"rendered":"golang \u81ea\u7136\u8bed\u8a00\u5904\u7406\u5de5\u5177(gohanlp)"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  golang \u81ea\u7136\u8bed\u8a00\u5904\u7406\u5de5\u5177(gohanlp)               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xxjwxc <\/span>  <span><i><\/i> 4<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<h2>GoHanlp<\/h2>\n<h3>\u524d\u8a00<\/h3>\n<p>Hanlp \u662f\u57fa\u4e8e PyTorch \u548c TensorFlow 2.x \u7684\u9762\u5411\u7814\u7a76\u4eba\u5458\u548c\u516c\u53f8\u7684\u591a\u8bed\u8a00 NLP \u5e93\uff0c\u7528\u4e8e\u5728\u5b66\u672f\u754c\u548c\u884c\u4e1a\u4e2d\u63a8\u5e7f\u6700\u5148\u8fdb\u7684\u6df1\u5ea6\u5b66\u4e60\u6280\u672f\u3002HanLP \u4ece\u4e00\u5f00\u59cb\u5c31\u88ab\u8bbe\u8ba1\u4e3a\u9ad8\u6548\uff0c\u7528\u6237\u53cb\u597d\u548c\u53ef\u6269\u5c55\u7684\u3002\u5b83\u5e26\u6709\u9488\u5bf9\u5404\u79cd\u4eba\u7c7b\u8bed\u8a00\u7684\u9884\u8bad\u7ec3\u6a21\u578b\uff0c\u5305\u62ec\u82f1\u8bed\uff0c\u4e2d\u6587\u548c\u8bb8\u591a\u5176\u4ed6\u8bed\u8a00\u3002 GoHanlp \u662f Hanlp \u7684 api \u63a5\u53e3 golang \u5b9e\u73b0\u7248\u672c<\/p>\n<h2>\u4f7f\u7528\u65b9\u5f0f<\/h2>\n<h3>\u5b89\u88c5 GoHanlp<\/h3>\n<pre><code>go get -u github.com\/xxjwxc\/[email&#160;protected] <\/code><\/pre>\n<h4>\u4f7f\u7528<\/h4>\n<h4>\u7533\u8bf7 auth \u8ba4\u8bc1<\/h4>\n<p>https:\/\/bbs.hanlp.com\/t\/hanlp2-1-restful-api\/53<\/p>\n<ul>\n<li>\u4e0d\u8ba4\u8bc1 <code>hanlp.WithAuth(\"\")<\/code> \u8bf7\u586b\u7a7a<\/li>\n<\/ul>\n<h4>\u6587\u672c\u5f62\u5f0f<\/h4>\n<pre><code>package main  import (  \"fmt\"  \"github.com\/xxjwxc\/gohanlp\/hanlp\" )  func main() {  client := hanlp.HanLPClient(hanlp.WithAuth(\"\")) \/\/ \u4f60\u7533\u8bf7\u5230\u7684 auth,auth \u4e0d\u586b\u5219\u533f\u540d  s, _ := client.Parse(\"2021 \u5e74 HanLPv2.1 \u4e3a\u751f\u4ea7\u73af\u5883\u5e26\u6765\u6b21\u4e16\u4ee3\u6700\u5148\u8fdb\u7684\u591a\u8bed\u79cd NLP \u6280\u672f\u3002\u963f\u5a46\u4e3b\u6765\u5230\u5317\u4eac\u7acb\u65b9\u5ead\u53c2\u89c2\u81ea\u7136\u8bed\u4e49\u79d1\u6280\u516c\u53f8\u3002\",   hanlp.WithLanguage(\"zh\"))  fmt.Println(s) } <\/code><\/pre>\n<h4>\u5bf9\u8c61\u5f62\u5f0f<\/h4>\n<pre><code>package main  import (  \"fmt\"   \"github.com\/xxjwxc\/gohanlp\/hanlp\" )  func main() {  client := hanlp.HanLPClient(hanlp.WithAuth(\"\")) \/\/ \u4f60\u7533\u8bf7\u5230\u7684 auth,auth \u4e0d\u586b\u5219\u533f\u540d  resp, _ := client.ParseObj(\"2021 \u5e74 HanLPv2.1 \u4e3a\u751f\u4ea7\u73af\u5883\u5e26\u6765\u6b21\u4e16\u4ee3\u6700\u5148\u8fdb\u7684\u591a\u8bed\u79cd NLP \u6280\u672f\u3002\u963f\u5a46\u4e3b\u6765\u5230\u5317\u4eac\u7acb\u65b9\u5ead\u53c2\u89c2\u81ea\u7136\u8bed\u4e49\u79d1\u6280\u516c\u53f8\u3002\",hanlp.WithLanguage(\"zh\"))  fmt.Println(resp) } <\/code><\/pre>\n<h4>\u63a5\u53e3\u8bf4\u660e<\/h4>\n<ul>\n<li>HanLPClient \u4e2d option \u662f\u53d8\u91cf\u53c2\u6570\uff0c\u6bcf\u6b21\u8c03\u7528\u90fd\u4f1a\u5e26\u4e0a<\/li>\n<li>Parse&#8230; \u4e2d option \u662f\u96f6\u65f6\u53c2\u6570\uff0c\u53ea\u5728\u672c\u6b21\u8c03\u7528\u6709\u6548<\/li>\n<\/ul>\n<h4>\u66f4\u591a\u8c03\u7528 API \u8bf7\u67e5\u770b<\/h4>\n<p>options<\/p>\n<h2>\u66f4\u591a\uff1a<\/h2>\n<p>xxjwxc GoHanlp options<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>0<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>golang \u81ea\u7136\u8bed\u8a00\u5904\u7406\u5de5\u5177(g&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/419196"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=419196"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/419196\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=419196"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=419196"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=419196"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}