• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            隨筆 - 224  文章 - 41  trackbacks - 0
            <2008年11月>
            2627282930311
            2345678
            9101112131415
            16171819202122
            23242526272829
            30123456

            享受編程

            常用鏈接

            留言簿(11)

            隨筆分類(159)

            隨筆檔案(224)

            文章分類(2)

            文章檔案(4)

            經(jīng)典c++博客

            搜索

            •  

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

             pymmseg-cpp
            http://code.google.com/p/pymmseg-cpp/

            pymmseg-cpp is a Python port of the rmmseg-cpp project. rmmseg-cpp is a MMSEG Chinese word segmenting algorithm implemented in C++ with a Ruby interface.

            Download the binary release on the right sidebar and copy the pymmseg directory to your Python's path (e.g. /usr/lib/python2.5/site-packages/). Here's an example of usage:

            from pymmseg import mmseg

            mmseg
            .dict_load_defaults()
            text
            = # ...
            algor
            = mmseg.Algorithm(text)
            for tok in algor:
            print '%s [%d..%d]' % (tok.text, tok.start, tok.end)

            Or you can download the source tarball or check out the latest code from the git repo hosted at github. Then you'll need to build the mmseg-cpp module yourself: goto the mmseg-cpp subdirectory and run the build.py script. It will build the native module for you.

            For more information, refer to the README file.


            很多同學(xué)都會(huì)出現(xiàn)亂碼的問題。可能是mmseg支持的是utf8, windows的本地默認(rèn)編碼是cp936,也就是gbk編碼,所以在控制臺(tái)直接打印utf-8的字符串當(dāng)然是亂碼了。 
            解決方法:
            在控制臺(tái)打印的地方用一個(gè)轉(zhuǎn)碼就ok了,打印的時(shí)候這么寫:
            print myname.decode('UTF-8').encode('GBK') 


            from pymmseg import mmseg

            mmseg
            .dict_load_defaults()
            text
            = # ...
            algor
            = mmseg.Algorithm(text)
            for tok in algor:
            print '%s [%d..%d]' % (tok.text.decode('UTF-8').encode('GBK') , tok.start, tok.end)

            posted on 2011-05-03 13:27 漂漂 閱讀(1147) 評(píng)論(0)  編輯 收藏 引用

            只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            2021最新久久久视精品爱| 青青青国产精品国产精品久久久久 | 无码AV中文字幕久久专区| 久久婷婷国产麻豆91天堂| 狠狠色婷婷久久综合频道日韩| 99久久国产综合精品成人影院| 久久久久久午夜成人影院| 亚洲精品乱码久久久久久中文字幕| 性做久久久久久久久| 亚洲国产成人精品无码久久久久久综合 | 97超级碰碰碰久久久久| 少妇精品久久久一区二区三区| 狠狠综合久久综合88亚洲| 亚洲AV无码久久精品蜜桃| 日韩AV无码久久一区二区| 精品熟女少妇av免费久久| 久久国产亚洲精品麻豆| 中文字幕成人精品久久不卡| 久久久WWW成人免费精品| 香蕉久久夜色精品国产尤物| 久久久久亚洲AV无码专区首JN| 亚洲国产精品无码久久久蜜芽| 99精品国产在热久久无毒不卡 | 亚洲国产精品久久久久婷婷软件 | 久久精品中文字幕久久| 99久久国产综合精品成人影院| 国产精品一区二区久久精品无码 | 久久久人妻精品无码一区| 97视频久久久| 国产精品久久久久AV福利动漫 | 亚洲中文字幕伊人久久无码| 亚洲精品乱码久久久久久蜜桃不卡| 国产99精品久久| 狠狠色丁香婷婷久久综合| 久久午夜伦鲁片免费无码| 久久精品无码一区二区app| 日产精品久久久久久久性色| 久久九九久精品国产| 99久久精品费精品国产一区二区 | 香蕉aa三级久久毛片| 久久婷婷五月综合97色一本一本|