The use of stuttering participle in python

Source: Internet
Author: User

Stuttering participle method Encapsulation class
From __future__ import Unicode_literalsimport syssys.path.append (".. /") Import Jiebaimport jieba.possegimport jieba.analyseprint (' = ' *40) print (' 1. Word breaker ') print ('-' *40 ') seg_list = Jieba.cut (" I came to Beijing Tsinghua University ", cut_all=true) print (" Full mode: "+"/". Join (Seg_list)) # seg_list = Jieba.cut (" I came to Beijing Tsinghua University ", Cut_all=false)  Print ("default mode:" + "/". Join (Seg_list)) # default Mode seg_list = Jieba.cut ("He came to NetEase Hang Research building") print (",". Join (seg_list)) seg_list = Jieba.cut_for_search ("Xiao Ming Master graduated from the Institute of Chinese Academy of Sciences, post-graduate studies at Kyoto University in Japan") # Search engine mode print (",". Join (Seg_list)) print (' = ' *40) print (' 2. Add custom dictionary/adjust dictionary ') print ('-' *40) ' Print ('/'. Join (Jieba.cut (') error if put in post. ', Hmm=false)) #如果/put in/post//error/. Print (Jieba.suggest_freq (' Medium ', ' will '), True) #494print ('/'. Join (Jieba.cut (') error if put in post. ', Hmm=false)) #如果/Put in/post//will/error/. Print ('/') Join (Jieba.cut (' "Taichung" correctly should not be cut ', Hmm=false))) #"//Middle/"/correct/should/not/BE/cut print (Jieba.suggest_freq (' Taichung ', True) #69print ('/') Join (Jieba.cut (' "Taichung" correctly should not be cut ', Hmm=false))) #"/Taichung/"/Correct/should/not/BE/cut print (' = ' *40) print (' 3. Keyword extraction ') Print ('-' *40) print (' TF-IDF ') print ('-' *40) s = "In addition, the company intends to a wholly-owned subsidiary of Jilin Eurasia Real Estate Co., Ltd. increased capital of 430 million yuan, after the increase in capital, Jilin Eurasian property registered from 70 million yuan to 500 million yuan. The main business scope of Jilin Eurasia property is real estate development and retail business. Currently under construction in Jilin Eurasian City Commercial Complex project. 2013, the realization of revenue of 0 yuan, the realization of net profit-1.3913 million yuan. "For X, W in Jieba.analyse.extract_tags (S, withweight=true): Print ('%s%s '% (x, W)) print ('-' *40 ') print (' Textrank ') prin T ('-' *40) for X, W in Jieba.analyse.textrank (S, withweight=true): Print ('%s%s '% (x, W)) print (' = ' *40) print (' 4. Pos callout ') pr Int ('-' *40) words = Jieba.posseg.cut ("I love Beijing Cheonan") for word, flag in Words:print ('%s%s '% (word, flag)) print (' = ' *40) print ( ' 6. Tokenize: Return the word at the beginning and end of the text ') print ('-' *40 ') print (' default mode ') print ('-' *40 ') result = Jieba.tokenize (' Yonghe Costume Jewelry Co., Ltd. ') for TK in Result:print ("Word%s\t\t start:%d \t\t end:%d"% (tk[0],tk[1],tk[2])) print ('-' *40 ') print (' search mode ') print ('-' *40 ') result = Jieba.tokenize (' Yonghe Costume Ornament Co., Ltd. ', mode= ' search ') for TK in Result:print ("Word%s\t\t start:%d \t\t end:%d"% (Tk[0],tk[1] , tk[2]))
Running results of stuttering participle

The use of stuttering participle in python

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.