Package: ckip-classic
IntroductionA Linux Python wrapper for CKIP classic tools —CKIP Word SegmentationandCKIP Parser.Attention!Please useCKIPNLPfor structured data types and pipeline drivers.Attention!For Python 2 users, please usePyCkip 0.4.2instead.Githttps://github.com/ckiplab/ckip-classicPyPIhttps://pypi.org/project/ckip-classicDocumentationhttps://ckip-classic.readthedocs.io/ContributersMu YangatCKIP(Author & Maintainer)Yin-Hsiang LiaoatCKIP(Maintainer)Wei-Yun MaatCKIP(Maintainer)External LinksOnline DemoRequirementsPython3.6+Cython0.29+Note that one should have CKIPWS/CKIPParser for this project:CKIP Word SegmentationLinux version 20190524+Academic LicenseCommercial LicenseCKIP ParserLinux version 20190725+Academic License(Online Version)Commercial LicenseInstallationAttention!Offline version: CKIPWS (Academic/Commercial License) and CKIPParser (Commercial License).Online version: CKIPParser (Academic License).Offline VersionDownload CKIPWS and/or CKIPParser from above links. Denote<ckipws-linux-root>as the folder containing CKIPWS, and<ckipparser-linux-root>as the folder containing CKIPParser.pipinstall--force-reinstall--upgradeckip-classic\--install-option='--ws'\--install-option='--ws-dir=<ckipws-linux-root>'\--install-option='--parser'\--install-option='--parser-dir=<ckipparser-linux-root>'Ignore ws/parser options if one doesn’t have CKIPWS/CKIPParser.Attention!Please use absolute paths.Online VersionRegister an account athttp://parser.iis.sinica.edu.tw/v1/reg.exepipinstall--upgradeckip-classicInstallation OptionsOptionDetailDefault Value--[no-]wsEnable/disable CKIPWS.False--[no-]parserEnable/disable CKIPParser.False--ws-dir=<ws-dir>CKIPWS root directory.--ws-lib-dir=<ws-lib-dir>CKIPWS libraries directory<ws-dir>/lib--ws-share-dir=<ws-share-dir>CKIPWS share directory<ws-dir>--parser-dir=<parser-dir>CKIPParser root directory.--parser-lib-dir=<parser-lib-dir>CKIPParser libraries directory<parser-dir>/lib--parser-share-dir=<parser-share-dir>CKIPParser share directory<parser-dir>--data2-dir=<data2-dir>“Data2” directory<ws-share-dir>/Data2--rule-dir=<rule-dir>“Rule” directory<parser-share-dir>/Rule--rdb-dir=<rdb-dir>“RDB” directory<parser-share-dir>/RDBUsageSeehttps://ckip-classic.readthedocs.io/for API details.CKIPWSCKIP Word Segmentation offline driver.importckip_classic.wsprint(ckip_classic.__name__,ckip_classic.__version__)ws=ckip_classic.ws.CkipWs(logger=False)print(ws('中文字喔'))forlinws.apply_list(['中文字喔','啊哈哈哈']):print(l)ws.apply_file(ifile='sample/sample.txt',ofile='output/sample.tag',uwfile='output/sample.uw')withopen('output/sample.tag')asfin:print(fin.read())withopen('output/sample.uw')asfin:print(fin.read())CKIPParserCKIP Parser offline driver.importckip_classic.parserprint(ckip_classic.__name__,ckip_classic.__version__)ps=ckip_classic.parser.CkipParser(logger=False)print(ps('中文字喔'))forlinps.apply_list(['中文字喔','啊哈哈哈']):print(l)ps.apply_file(ifile='sample/sample.txt',ofile='output/sample.tree')withopen('output/sample.tree')asfin:print(fin.read())CKIPParserClientCKIP Parser online client.importckip_classic.clientprint(ckip_classic.__name__,ckip_classic.__version__)ps=ckip_classic.client.CkipParserClient(username='USERNAME',password='PASSWORD')print(ps('中文字(Na)　耶(T)　，(COMMACATEGORY)'))forlinps.apply_list(['中文字(Na)　耶(T)　，(COMMACATEGORY)','啊(I)　哈(D)　哈(D)　哈(D)　。(PERIODCATEGORY)']):print(l)FAQ!DANGER!Due to C code implementation, bothCkipWsandCkipParsercan only be instance once.WarningCKIPParser fails if input text contains special characters such as()+-:|. One may replace these characters bytext=text.replace('(','（').replace(')','）').replace('+','＋').replace('-','－').replace(':','：').replace('|','｜')Tipfatal error: Python.h: No such file or directory”. What should I do?Install Python development packagesudoapt-getinstallpython3-devTipThe CKIPWS throws “what():  locale::facet::_S_create_c_locale name not valid”. What should I do?Install locale data.apt-getinstalllocales-allTipThe CKIPParser throws “ImportError: libCKIPParser.so: cannot open shared object file: No such file or directory”. What should I do?Add below command to~/.bashrc:exportLD_LIBRARY_PATH=<ckipparser-linux-root>/lib:$LD_LIBRARY_PATHLicenseCopyright (c) 2018-2023CKIP Labunder theGPL-3.0 License.