KCM API are also available now:API Online Version
- en: If you want to use
the English version of KCM
, please download nltk data:python3 -m nltk.downloader -d /usr/local/share/nltk_data all
- ja:
brew install mecab mecab-ipadic
- (Recommended): Use docker-compose to install
If you want to integrate kcm
into your own django project, use manually install.
pip install kcm
-
add django app
kcm
insettings.py
:-
add this:
INSTALLED_APPS=[ ... ... ... 'kcm', ]
-
-
add url patterns of kcm into
urls.py
:-
add this:
import kcm.urls urlpatterns += [ url(r'^kcm/', include(kcm.urls)) ]
-
-
use
python3 manage.py buildKcm --lang <lang, e.g., zh or en or th>
to build model of kcm. -
fire
python manage.py runserver
and go127.0.0.1:8000/
to check whether the config is all ok.
- Get correlated keywords:
/kcm
-
keyword
-
num (default=10)
-
keyFlag (default=[])
-
valueFlag (defualt=[])
-
example1:http://udiclab.cs.nchu.edu.tw/kcm?keyword=周杰倫&lang=zh
{ "PartOfSpeech": ["nr"], "similarity": 1.0, "key": "周杰倫", "value": [ ["巡迴演唱", "l", 861], ["世界", "n", 705], ["周杰倫", "nr", 424], ["專輯", "n", 286], ["歌曲", "n", 241], ["時間", "n", 234] ] }
-
example2 (with specific keyFlag and valueFlag):http://udiclab.cs.nchu.edu.tw/kcm/?keyword=周杰倫&valueFlag=n+nr&keyFlag=nr&lang=zh
{ "PartOfSpeech": ["nr"], "similarity": 1.0, "key": "周杰倫", "value": [ ["世界", "n", 705], ["周杰倫", "nr", 424], ["專輯", "n", 286], ["歌曲", "n", 241], ["時間", "n", 234], ["深圳站", "n", 146], ["演唱會", "n", 139], ["成都站", "n", 132], ["電影", "n", 119], ["蔡依林", "nr", 111] ] }
-
- Get similar keywords, not semantic similar but literally similar:
/search
-
keyword
-
lang
-
threshold (default=0)
-
num (default=10)
-
example1:http://udiclab.cs.nchu.edu.tw/kcm/search?keyword=台灣高速鐵路&lang=zh
[ [ "臺灣高速鐵路", 0.45454545454545453 ], [ "高速鐵路", 0.4 ], [ "京廣高速鐵路", 0.3333333333333333 ] ... ... ... ]
-
example2:http://udiclab.cs.nchu.edu.tw/kcm/search?keyword=台灣高速鐵路&lang=zh&threshold=0.2&num=15
[ [ "臺灣高速鐵路", 0.45454545454545453 ], [ "高速鐵路", 0.4 ], [ "京廣高速鐵路", 0.3333333333333333 ] ... ... ... ]
-
python3 manage.py test kcm
kcm
is a django-app, so depends on django project.
- python3.5
- 張泰瑋 david
This package use GPL3.0
License.
- WikiExtractor
- OpenCC-reimplement