Skip to content

UDICatNCHU/new_kcm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Keyword Correlation Model (KCM 關鍵字相關性模型)Build Status

KCM API are also available now:API Online Version

Getting Started

Prerequisities

  • 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

Install

Manually Install

If you want to integrate kcm into your own django project, use manually install.

  • pip install kcm

Config

  1. add django app kcm in settings.py

    • add this:

      INSTALLED_APPS=[
      ...
      ...
      ...
      'kcm',
      ]
  2. add url patterns of kcm into urls.py

    • add this:

      import kcm.urls
      urlpatterns += [
          url(r'^kcm/', include(kcm.urls))
      ]
  3. use python3 manage.py buildKcm --lang <lang, e.g., zh or en or th> to build model of kcm.

  4. fire python manage.py runserver and go 127.0.0.1:8000/ to check whether the config is all ok.

API

  1. 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]
        ]
      }
  2. Get similar keywords, not semantic similar but literally similar:/search

Break down into end to end tests

python3 manage.py test kcm

Deployment

kcm is a django-app, so depends on django project.

Built With

  • python3.5

Contributors

License

This package use GPL3.0 License.

Acknowledgments

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages