项目作者: HanBnrd

项目描述 :
TV series recommendation based on NLP
高级语言: Python
项目地址: git://github.com/HanBnrd/Serimantic.git
创建时间: 2017-12-15T10:21:29Z
项目社区:https://github.com/HanBnrd/Serimantic

开源协议:GNU General Public License v3.0

下载


Serimantic

Title: Serimantic
Keywords: NLP, recommendation, TV series
Version: 2.0.3
Date: September 2018
Authors: Johann Benerradi, Rachel Confiant-Duté, Justinien Ghorra, Laurine Jeannot, Quentin Pouvreau
Web site: UFR Mathématiques et Informatique
Platform: Python 3, Django
License: GNU GPL 3.0

Relies on tmdbsimple v1.7.0 modified to get keywords of TV series (stored in src/lib)

Description:
TV series recommendation based on keyword extraction through semantic analysis of overviews

Requires:

API key configuration

Run src/config.py with Python 3 and type in the key

Web interface

Installation

1) Install Django and Django Rest Framework with pip

  1. sudo apt install python3-pip
  2. sudo apt install python3-django
  3. sudo -H pip install django
  4. sudo -H pip install djangorestframework
  5. sudo -H pip install markdown # Markdown support for the browsable API
  6. sudo -H pip install django-filter

2) Install MySQL Server and the connector for Python

  1. sudo apt install mysql-server
  2. sudo mysql_secure_installation
  3. sudo apt install libmysqlclient-dev python-dev python-mysqldb
  4. sudo apt install python3-mysql.connector
  5. sudo -H pip install mysqlclient
  6. sudo -H pip install pymysql

3) Create a user to access a new database serimantic in MySQL

  1. sudo mysql -u root -p

Template:

  1. CREATE DATABASE serimantic;
  2. GRANT ALL PRIVILEGES on serimantic.* to 'user'@'localhost' IDENTIFIED BY 'password';
  3. exit

4) Add your own settings.py file in ./Serimantic/

(See template below)

5) Migrate the database

  1. python3 manage.py migrate
  2. python3 manage.py loaddata nlpdata

6) Create a superuser to access the database as admin in Django

  1. python3 manage.py createsuperuser

7) Run the server

  1. python3 manage.py runserver
You’re good to go !

Command-line interface

Keyword Extraction on the basic corpus

Run src/default.py with Python 3 (keywords are stored in data/nlpdata.txt)
Modify data/defaultseries.txt to extract keywords on a different series basis
This process might have already been done

Add a series to the corpus

Run src/add.py with Python 3 and follow the instructions (new keywords are stored in data/nlpdata.txt)

Series recommendation

Run src/recommendation.py with Python 3 and folow the instructions
A series close to that indicated will be recommended and the common keywords will be displayed


settings.py

  1. """
  2. Django settings for Serimantic project.
  3. Generated by 'django-admin startproject' using Django 2.0.3.
  4. For more information on this file, see
  5. https://docs.djangoproject.com/en/2.0/topics/settings/
  6. For the full list of settings and their values, see
  7. https://docs.djangoproject.com/en/2.0/ref/settings/
  8. """
  9. import os
  10. # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  11. BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  12. TEMPLATE_DIR = os.path.join(BASE_DIR, "spa/templates")
  13. STATIC_DIR = os.path.join(BASE_DIR, "spa/static")
  14. FIXTURE_DIR = os.path.join(BASE_DIR, "data/fixtures")
  15. # Quick-start development settings - unsuitable for production
  16. # See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/
  17. # SECURITY WARNING: keep the secret key used in production secret!
  18. SECRET_KEY = # TODO
  19. # SECURITY WARNING: don't run with debug turned on in production!
  20. DEBUG = True
  21. ALLOWED_HOSTS = []
  22. # Application definition
  23. INSTALLED_APPS = [
  24. 'data',
  25. 'rest_framework',
  26. 'api.apps.ApiConfig',
  27. 'spa.apps.SpaConfig',
  28. 'django.contrib.admin',
  29. 'django.contrib.auth',
  30. 'django.contrib.contenttypes',
  31. 'django.contrib.sessions',
  32. 'django.contrib.messages',
  33. 'django.contrib.staticfiles',
  34. ]
  35. MIDDLEWARE = [
  36. 'django.middleware.security.SecurityMiddleware',
  37. 'django.contrib.sessions.middleware.SessionMiddleware',
  38. 'django.middleware.common.CommonMiddleware',
  39. 'django.middleware.csrf.CsrfViewMiddleware',
  40. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  41. 'django.contrib.messages.middleware.MessageMiddleware',
  42. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  43. ]
  44. ROOT_URLCONF = 'Serimantic.urls'
  45. TEMPLATES = [
  46. {
  47. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  48. 'DIRS': [TEMPLATE_DIR],
  49. 'APP_DIRS': True,
  50. 'OPTIONS': {
  51. 'context_processors': [
  52. 'django.template.context_processors.debug',
  53. 'django.template.context_processors.request',
  54. 'django.contrib.auth.context_processors.auth',
  55. 'django.contrib.messages.context_processors.messages',
  56. ],
  57. },
  58. },
  59. ]
  60. WSGI_APPLICATION = 'Serimantic.wsgi.application'
  61. # Database
  62. # https://docs.djangoproject.com/en/2.0/ref/settings/#databases
  63. DATABASES = {
  64. 'default': {
  65. 'ENGINE': 'django.db.backends.mysql',
  66. 'NAME': # TODO,
  67. 'USER': # TODO,
  68. 'PASSWORD': # TODO,
  69. 'HOST': # TODO,
  70. 'PORT': # TODO,
  71. }
  72. }
  73. # Password validation
  74. # https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators
  75. AUTH_PASSWORD_VALIDATORS = [
  76. {
  77. 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
  78. },
  79. {
  80. 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  81. },
  82. {
  83. 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
  84. },
  85. {
  86. 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  87. },
  88. ]
  89. # Internationalization
  90. # https://docs.djangoproject.com/en/2.0/topics/i18n/
  91. LANGUAGE_CODE = 'en-us'
  92. TIME_ZONE = 'UTC'
  93. USE_I18N = True
  94. USE_L10N = True
  95. USE_TZ = True
  96. # Static files (CSS, JavaScript, Images)
  97. # https://docs.djangoproject.com/en/2.0/howto/static-files/
  98. STATIC_URL = '/static/'
  99. STATICFILES_DIRS = [
  100. STATIC_DIR,
  101. ]

© Université de Lorraine - Nancy