# # Golang GOSCWS Chinese word scws is a good Chinese word thesaurus, because the project used to SCWS participle but the go language does not have a very good binding, so he wrote Goscws, and he supports the association of the word. # # Example: According to the text content set by SendText, return a series of cut words "' GS: = Goscws. NEWSCWS () Gs. Setcharset ("UTF8") Err: = Gs. Setdict ("/usr/local/scws/etc/dict.utf8.xdb", Goscws. SCWS_XDICT_MEM) If err! = Nil {log. PRINTLN (err)}err = Gs. Setrule ("/usr/local/scws/etc/rules.utf8.ini") if err! = Nil {log. PRINTLN (err)}err = Gs. Setignore (0) If err! = Nil {log. PRINTLN (err)}text: = []byte (' Chen Sheng is not the only copyright owner of the Promise ", the whole copyright of a film is owned by the film studios. ') Gs. SendText (text, len (text)) for res: = GS. GetResult (); Res! = Nil; res = GS. GetResult () {log. Println (String (res. Word), Res. IDF, String (res. Attr))}gs. DELETESCWS () "SendText the list of the most critical words the system calculates, based on the text content set by the" GS: = Goscws. NEWSCWS () Gs. Setcharset ("UTF8") Err: = Gs. Setdict ("/usr/local/scws/etc/dict.utf8.xdb", Goscws. SCWS_XDICT_MEM) If err! = Nil {log. PRINTLN (err)}err = Gs. Setrule ("/usr/local/scws/etc/rules.utf8.ini") if err! = Nil {log. PRINTLN (err)}err = Gs. Setignore (0) If err! = Nil {log. PRINTLN (err)}text: = []byte (' Chen Kai is not the only copyright holder of the Infinite ", the whole copyright of a film is owned by the film studios. ') Gs. SendText (text, len (text)) for res: = GS. Gettops (); Res! = Nil; res = GS. Gettops () {log. Println (String (res. Word), Res. Weight, Res. Times,string (Res. Attr))}gs. DELETESCWS () "The key word" GS: = GOSCWS, according to the text content set by SendText, to return to the system in terms of part of speech. NEWSCWS () Gs. Setcharset ("UTF8") Err: = Gs. Setdict ("/usr/local/scws/etc/dict.utf8.xdb", Goscws. SCWS_XDICT_MEM) If err! = Nil {log. PRINTLN (err)}err = Gs. Setrule ("/usr/local/scws/etc/rules.utf8.ini") if err! = Nil {log. PRINTLN (err)}err = Gs. Setignore (0) If err! = Nil {log. PRINTLN (err)}text: = []byte (' Chen Sheng is not the only copyright owner of the Promise ", the whole copyright of a film is owned by the film studios. ') Gs. SendText (text, len (text)) for res: = GS. Getwords ([]byte ("n")); Res! = Nil; res = GS. Getwords ([]byte ("n")) {log. Println (String (res. Word), Res. Weight, Res. Times,string (Res. Attr))}gs. Deletescws () "# License [MIT] (HTTPS://GITHUB.COM/GEEEEEEEEEK/ELECTRONIC-WECHAT/BLOB/MASTER/LICENSE.MD) Finally like the classmate please give a start support, do not like also give a start expression 80 times click
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service