├── .gitattributes ├── .idea ├── misc.xml ├── modules.xml ├── myweb.iml └── workspace.xml ├── LICENSE ├── README.md ├── db.sqlite3 ├── favicon.ico ├── log ├── predict_mysql.log ├── server_predict.log └── websit.log ├── manage.py ├── myweb ├── __init__.py ├── __pycache__ │ ├── __init__.cpython-36.pyc │ ├── settings.cpython-36.pyc │ ├── urls.cpython-36.pyc │ └── wsgi.cpython-36.pyc ├── settings.py ├── urls.py └── wsgi.py ├── requirements.txt ├── static ├── admin │ ├── css │ │ ├── autocomplete.css │ │ ├── base.css │ │ ├── changelists.css │ │ ├── dashboard.css │ │ ├── fonts.css │ │ ├── forms.css │ │ ├── login.css │ │ ├── responsive.css │ │ ├── responsive_rtl.css │ │ ├── rtl.css │ │ ├── vendor │ │ │ └── select2 │ │ │ │ ├── LICENSE-SELECT2.md │ │ │ │ ├── select2.css │ │ │ │ └── select2.min.css │ │ └── widgets.css │ ├── fonts │ │ ├── LICENSE.txt │ │ ├── README.txt │ │ ├── Roboto-Bold-webfont.woff │ │ ├── Roboto-Light-webfont.woff │ │ └── Roboto-Regular-webfont.woff │ ├── img │ │ ├── LICENSE │ │ ├── README.txt │ │ ├── calendar-icons.svg │ │ ├── gis │ │ │ ├── move_vertex_off.svg │ │ │ └── move_vertex_on.svg │ │ ├── icon-addlink.svg │ │ ├── icon-alert.svg │ │ ├── icon-calendar.svg │ │ ├── icon-changelink.svg │ │ ├── icon-clock.svg │ │ ├── icon-deletelink.svg │ │ ├── icon-no.svg │ │ ├── icon-unknown-alt.svg │ │ ├── icon-unknown.svg │ │ ├── icon-yes.svg │ │ ├── inline-delete.svg │ │ ├── search.svg │ │ ├── selector-icons.svg │ │ ├── sorting-icons.svg │ │ ├── tooltag-add.svg │ │ └── tooltag-arrowright.svg │ └── js │ │ ├── SelectBox.js │ │ ├── SelectFilter2.js │ │ ├── actions.js │ │ ├── actions.min.js │ │ ├── admin │ │ ├── DateTimeShortcuts.js │ │ └── RelatedObjectLookups.js │ │ ├── autocomplete.js │ │ ├── calendar.js │ │ ├── cancel.js │ │ ├── change_form.js │ │ ├── collapse.js │ │ ├── collapse.min.js │ │ ├── core.js │ │ ├── inlines.js │ │ ├── inlines.min.js │ │ ├── jquery.init.js │ │ ├── popup_response.js │ │ ├── prepopulate.js │ │ ├── prepopulate.min.js │ │ ├── prepopulate_init.js │ │ ├── timeparse.js │ │ ├── urlify.js │ │ └── vendor │ │ ├── jquery │ │ ├── LICENSE-JQUERY.txt │ │ ├── jquery.js │ │ └── jquery.min.js │ │ ├── select2 │ │ ├── LICENSE-SELECT2.md │ │ ├── i18n │ │ │ ├── ar.js │ │ │ ├── az.js │ │ │ ├── bg.js │ │ │ ├── ca.js │ │ │ ├── cs.js │ │ │ ├── da.js │ │ │ ├── de.js │ │ │ ├── el.js │ │ │ ├── en.js │ │ │ ├── es.js │ │ │ ├── et.js │ │ │ ├── eu.js │ │ │ ├── fa.js │ │ │ ├── fi.js │ │ │ ├── fr.js │ │ │ ├── gl.js │ │ │ ├── he.js │ │ │ ├── hi.js │ │ │ ├── hr.js │ │ │ ├── hu.js │ │ │ ├── id.js │ │ │ ├── is.js │ │ │ ├── it.js │ │ │ ├── ja.js │ │ │ ├── km.js │ │ │ ├── ko.js │ │ │ ├── lt.js │ │ │ ├── lv.js │ │ │ ├── mk.js │ │ │ ├── ms.js │ │ │ ├── nb.js │ │ │ ├── nl.js │ │ │ ├── pl.js │ │ │ ├── pt-BR.js │ │ │ ├── pt.js │ │ │ ├── ro.js │ │ │ ├── ru.js │ │ │ ├── sk.js │ │ │ ├── sr-Cyrl.js │ │ │ ├── sr.js │ │ │ ├── sv.js │ │ │ ├── th.js │ │ │ ├── tr.js │ │ │ ├── uk.js │ │ │ ├── vi.js │ │ │ ├── zh-CN.js │ │ │ └── zh-TW.js │ │ ├── select2.full.js │ │ └── select2.full.min.js │ │ └── xregexp │ │ ├── LICENSE-XREGEXP.txt │ │ ├── xregexp.js │ │ └── xregexp.min.js ├── css │ ├── aboutUS.css │ ├── articleAnalyze.css │ ├── hotNews.css │ ├── main.css │ └── main_back.css ├── favicon.ico ├── font │ └── fz.TTF └── imgs │ ├── Category.png │ ├── aboutUS.png │ ├── banner_about_us.png │ ├── banner_atricle_analyzie.png │ ├── banner_hot_news.png │ ├── button.png │ ├── line.png │ └── wenzi.png ├── templates ├── aboutUS.html ├── articleAnalyze.html └── hotNews.html ├── text_classification.sql ├── text_classification ├── .idea │ ├── dictionaries │ │ └── danda.xml │ ├── misc.xml │ ├── modules.xml │ ├── text_classification.iml │ └── workspace.xml ├── LICENSE ├── README.md ├── __pycache__ │ ├── client.cpython-36.pyc │ ├── cnn_model.cpython-36.pyc │ ├── connect_mysql.cpython-36.pyc │ └── wangyinews_crawler.cpython-36.pyc ├── checkpoints │ └── textcnn │ │ ├── best_validation.data-00000-of-00001 │ │ ├── best_validation.index │ │ ├── best_validation.meta │ │ └── checkpoint ├── client.py ├── cnn_model.py ├── connect_mysql.py ├── data │ ├── THUCNews │ │ └── README.md │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-36.pyc │ │ └── cnews_loader.cpython-36.pyc │ ├── cnews │ │ ├── README.md │ │ └── cnews.vocab.txt │ └── cnews_loader.py ├── helper │ ├── __init__.py │ └── cnews_group.py ├── images │ ├── cnn_architecture.png │ ├── news_classify.png │ └── text_analysis.png ├── predict_mysql.py ├── run_cnn.py ├── server_predict.py ├── startproject.sh ├── tensorboard │ └── textcnn │ │ └── events.out.tfevents.1523023586.dandan └── wangyinews_crawler.py └── web ├── __init__.py ├── __pycache__ ├── __init__.cpython-36.pyc ├── admin.cpython-36.pyc ├── apps.cpython-36.pyc ├── client.cpython-36.pyc ├── connect_mysql.cpython-36.pyc ├── models.cpython-36.pyc ├── selectFromDb.cpython-36.pyc └── views.cpython-36.pyc ├── admin.py ├── apps.py ├── client.py ├── connect_mysql.py ├── hotNews.css ├── migrations ├── __init__.py └── __pycache__ │ └── __init__.cpython-36.pyc ├── models.py ├── selectFromDb.py ├── static ├── css │ ├── aboutUS.css │ ├── articleAnalyze.css │ ├── hotNews.css │ ├── main.css │ └── main_back.css ├── favicon.ico ├── font │ └── fz.TTF ├── imgs │ ├── Category.png │ ├── aboutUS.png │ ├── banner_about_us.png │ ├── banner_atricle_analyzie.png │ ├── banner_hot_news.png │ ├── button.png │ ├── line.png │ └── wenzi.png └── js │ ├── aboutUS.js │ └── articleAnalyze.js ├── tests.py └── views.py /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | *.js linguist-language=Python 3 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/myweb.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 28 | 29 | 30 | 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 mlzc 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 基于卷积神经网络的中文文本分类系统 3 | text_classification_with_cnn 4 | 5 | 卷积神经网络&&爬虫实现网易新闻自动爬取并分类 6 | 7 | 采用THUCnews全部数据集进行训练,效果如下。 详细实现见./text_classification 8 | 9 | ![](http://image.i-ll.cc/18-5-13/91609560.jpg) 10 | 11 | 12 | ![](http://image.i-ll.cc/18-5-13/59403725.jpg) 13 | 14 | 15 | 16 | 17 | 部署步骤如下: 18 | 19 | --- 20 | ### 运行环境 21 | 服务器:Ubuntu 16.04 22 | 数据库:Mysql 5.6 23 | python:Anaconda 5.1 24 | Tensorflow-CPU:1.7 25 | 额外的包:参考requirements.txt,有则忽略,无则安装。 26 | ``` 27 | certifi==2018.1.18 28 | chardet==3.0.4 29 | Django==2.0.4 30 | docopt==0.6.2 31 | idna==2.6 32 | mysql-connector==2.1.6 33 | pipreqs==0.4.9 34 | pytz==2018.4 35 | requests==2.18.4 36 | SQLAlchemy==1.2.6 37 | urllib3==1.22 38 | yarg==0.1.9 39 | 40 | ``` 41 | 42 | --- 43 | 44 | 1. 首先安装mysql到数据库,执行text_classification.sql创建数据库。更改数据库配置./text_classification/connect_mysql.py 45 | 2. 服务器安装Anaconda(清华大学镜像站自行下载安装),安装TensorFlow-CPU版 46 | 3. 将本项目部署至/home/www目录下 47 | 4. 安装其他依赖包 48 | >pip install -r requirements.txt 49 | 5. 服务器部署Django环境(apache2.4) 50 | 参考:https://code.ziqiangxuetang.com/django/django-deploy.html 51 | 6. 关于本项目部署中的Django配置请看以下操作 52 | **安装 apache2 和 mod_wsgi** 53 | sudo apt-get install apache2 54 | sudo apt-get install libapache2-mod-wsgi-py3 55 | **新建网站配置文件** 56 | >vim /etc/apache2/sites-available/text_classification.conf 57 | 输入以下内容 58 | ``` 59 | 60 | ServerName classify.i-ll.cc 61 | ServerAlias classify.i-ll.cc 62 | ServerAdmin dandanv5@hotmail.com 63 | Alias /static /home/www/text_classification/static 64 | 65 | 66 | Require all granted 67 | 68 | 69 | 70 | WSGIScriptAlias / /home/www/text_classification/myweb/wsgi.py 71 | 72 | 73 | 74 | Require all granted 75 | 76 | 77 | 78 | 79 | ``` 80 | **激活新网站** 81 | >sudo a2ensite sitename.conf 82 | 7. 启动项目 83 | >cd /home/www/text_classification/text_classification && sh startproject.sh 84 | 项目运行日志在./log下 85 | 86 | - 最后本项目使用的THUCNews中文新闻数据集,可以去官网下载。我对数据集进行了整合处理,下载地址见./text_classification/data/cnews/README.md 87 | - 关于本项目中模型和爬虫部分,详见./text_classification/README.md 88 | - 代码有问题请直接提issues 89 | - 部署有疑问请直接联系: 90 | - QQ:447600334 91 | - Email:dandanv5@hotmail.com 92 | 93 | -------------------------------------------------------------------------------- /db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/db.sqlite3 -------------------------------------------------------------------------------- /favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/favicon.ico -------------------------------------------------------------------------------- /log/predict_mysql.log: -------------------------------------------------------------------------------- 1 | /root/anaconda3/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`. 2 | from ._conv import register_converters as _register_converters 3 | WARNING:tensorflow:From /root/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/datasets/base.py:198: retry (from tensorflow.contrib.learn.python.learn.datasets.base) is deprecated and will be removed in a future version. 4 | Instructions for updating: 5 | Use the retry module or similar alternatives. 6 | WARNING:tensorflow:From /root/anaconda3/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py:497: calling conv1d (from tensorflow.python.ops.nn_ops) with data_format=NHWC is deprecated and will be removed in a future version. 7 | Instructions for updating: 8 | `NHWC` for data_format is deprecated, use `NWC` instead 9 | WARNING:tensorflow:From /home/www/text_classification/text_classification/cnn_model.py:66: softmax_cross_entropy_with_logits (from tensorflow.python.ops.nn_ops) is deprecated and will be removed in a future version. 10 | Instructions for updating: 11 | 12 | Future major versions of TensorFlow will allow gradients to flow 13 | into the labels input on backprop by default. 14 | 15 | See tf.nn.softmax_cross_entropy_with_logits_v2. 16 | 17 | 2018-04-18 15:34:12.531005: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 AVX512F FMA 18 | 2018041816 Finished! 19 | 2018041817 Finished! 20 | 2018041818 Finished! 21 | 2018041819 Finished! 22 | -------------------------------------------------------------------------------- /log/server_predict.log: -------------------------------------------------------------------------------- 1 | /root/anaconda3/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`. 2 | from ._conv import register_converters as _register_converters 3 | WARNING:tensorflow:From /root/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/datasets/base.py:198: retry (from tensorflow.contrib.learn.python.learn.datasets.base) is deprecated and will be removed in a future version. 4 | Instructions for updating: 5 | Use the retry module or similar alternatives. 6 | WARNING:tensorflow:From /root/anaconda3/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py:497: calling conv1d (from tensorflow.python.ops.nn_ops) with data_format=NHWC is deprecated and will be removed in a future version. 7 | Instructions for updating: 8 | `NHWC` for data_format is deprecated, use `NWC` instead 9 | WARNING:tensorflow:From /home/www/text_classification/text_classification/cnn_model.py:66: softmax_cross_entropy_with_logits (from tensorflow.python.ops.nn_ops) is deprecated and will be removed in a future version. 10 | Instructions for updating: 11 | 12 | Future major versions of TensorFlow will allow gradients to flow 13 | into the labels input on backprop by default. 14 | 15 | See tf.nn.softmax_cross_entropy_with_logits_v2. 16 | 17 | 2018-04-18 15:34:12.524303: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 AVX512F FMA 18 | connect from: ('127.0.0.1', 43628) 19 | Accept new connection from 127.0.0.1:43628... 20 | Connection from 127.0.0.1:43628 closed. 21 | connect from: ('127.0.0.1', 43630) 22 | Accept new connection from 127.0.0.1:43630... 23 | Connection from 127.0.0.1:43630 closed. 24 | connect from: ('127.0.0.1', 43632) 25 | Accept new connection from 127.0.0.1:43632... 26 | Exception in thread Thread-3: 27 | Traceback (most recent call last): 28 | File "/root/anaconda3/lib/python3.6/threading.py", line 916, in _bootstrap_inner 29 | self.run() 30 | File "/root/anaconda3/lib/python3.6/threading.py", line 864, in run 31 | self._target(*self._args, **self._kwargs) 32 | File "/home/www/text_classification/text_classification/server_predict.py", line 65, in tcplink 33 | classified = cnn_model.predict(recvdata.decode('utf-8')) 34 | UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 8190-8191: unexpected end of data 35 | 36 | connect from: ('127.0.0.1', 43634) 37 | Accept new connection from 127.0.0.1:43634... 38 | Connection from 127.0.0.1:43634 closed. 39 | connect from: ('127.0.0.1', 43636) 40 | Accept new connection from 127.0.0.1:43636... 41 | Connection from 127.0.0.1:43636 closed. 42 | connect from: ('127.0.0.1', 43638) 43 | Accept new connection from 127.0.0.1:43638... 44 | Connection from 127.0.0.1:43638 closed. 45 | connect from: ('127.0.0.1', 43640) 46 | Accept new connection from 127.0.0.1:43640... 47 | Connection from 127.0.0.1:43640 closed. 48 | connect from: ('127.0.0.1', 43642) 49 | Accept new connection from 127.0.0.1:43642... 50 | Connection from 127.0.0.1:43642 closed. 51 | connect from: ('127.0.0.1', 43644) 52 | Accept new connection from 127.0.0.1:43644... 53 | Connection from 127.0.0.1:43644 closed. 54 | connect from: ('127.0.0.1', 43646) 55 | Accept new connection from 127.0.0.1:43646... 56 | Connection from 127.0.0.1:43646 closed. 57 | connect from: ('127.0.0.1', 43648) 58 | Accept new connection from 127.0.0.1:43648... 59 | Connection from 127.0.0.1:43648 closed. 60 | connect from: ('127.0.0.1', 43650) 61 | Accept new connection from 127.0.0.1:43650... 62 | Connection from 127.0.0.1:43650 closed. 63 | connect from: ('127.0.0.1', 43652) 64 | Accept new connection from 127.0.0.1:43652... 65 | Connection from 127.0.0.1:43652 closed. 66 | connect from: ('127.0.0.1', 43654) 67 | Accept new connection from 127.0.0.1:43654... 68 | Exception in thread Thread-14: 69 | Traceback (most recent call last): 70 | File "/root/anaconda3/lib/python3.6/threading.py", line 916, in _bootstrap_inner 71 | self.run() 72 | File "/root/anaconda3/lib/python3.6/threading.py", line 864, in run 73 | self._target(*self._args, **self._kwargs) 74 | File "/home/www/text_classification/text_classification/server_predict.py", line 65, in tcplink 75 | classified = cnn_model.predict(recvdata.decode('utf-8')) 76 | UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 8190-8191: unexpected end of data 77 | 78 | connect from: ('127.0.0.1', 43656) 79 | Accept new connection from 127.0.0.1:43656... 80 | Connection from 127.0.0.1:43656 closed. 81 | connect from: ('127.0.0.1', 43658) 82 | Accept new connection from 127.0.0.1:43658... 83 | Exception in thread Thread-16: 84 | Traceback (most recent call last): 85 | File "/root/anaconda3/lib/python3.6/threading.py", line 916, in _bootstrap_inner 86 | self.run() 87 | File "/root/anaconda3/lib/python3.6/threading.py", line 864, in run 88 | self._target(*self._args, **self._kwargs) 89 | File "/home/www/text_classification/text_classification/server_predict.py", line 65, in tcplink 90 | classified = cnn_model.predict(recvdata.decode('utf-8')) 91 | UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 8190-8191: unexpected end of data 92 | 93 | connect from: ('127.0.0.1', 43660) 94 | Accept new connection from 127.0.0.1:43660... 95 | Connection from 127.0.0.1:43660 closed. 96 | connect from: ('127.0.0.1', 43662) 97 | Accept new connection from 127.0.0.1:43662... 98 | Connection from 127.0.0.1:43662 closed. 99 | connect from: ('127.0.0.1', 43664) 100 | Accept new connection from 127.0.0.1:43664... 101 | Connection from 127.0.0.1:43664 closed. 102 | connect from: ('127.0.0.1', 43666) 103 | Accept new connection from 127.0.0.1:43666... 104 | connect from: ('127.0.0.1', 43668) 105 | Accept new connection from 127.0.0.1:43668... 106 | Connection from 127.0.0.1:43666 closed. 107 | Connection from 127.0.0.1:43668 closed. 108 | connect from: ('127.0.0.1', 43670) 109 | Accept new connection from 127.0.0.1:43670... 110 | Connection from 127.0.0.1:43670 closed. 111 | connect from: ('127.0.0.1', 43672) 112 | Accept new connection from 127.0.0.1:43672... 113 | Connection from 127.0.0.1:43672 closed. 114 | connect from: ('127.0.0.1', 43674) 115 | Accept new connection from 127.0.0.1:43674... 116 | Connection from 127.0.0.1:43674 closed. 117 | connect from: ('127.0.0.1', 43676) 118 | Accept new connection from 127.0.0.1:43676... 119 | Connection from 127.0.0.1:43676 closed. 120 | connect from: ('127.0.0.1', 43678) 121 | Accept new connection from 127.0.0.1:43678... 122 | Connection from 127.0.0.1:43678 closed. 123 | connect from: ('127.0.0.1', 43680) 124 | Accept new connection from 127.0.0.1:43680... 125 | Connection from 127.0.0.1:43680 closed. 126 | connect from: ('127.0.0.1', 43728) 127 | Accept new connection from 127.0.0.1:43728... 128 | Connection from 127.0.0.1:43728 closed. 129 | connect from: ('127.0.0.1', 43730) 130 | Accept new connection from 127.0.0.1:43730... 131 | Connection from 127.0.0.1:43730 closed. 132 | connect from: ('127.0.0.1', 43732) 133 | Accept new connection from 127.0.0.1:43732... 134 | Connection from 127.0.0.1:43732 closed. 135 | -------------------------------------------------------------------------------- /manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == "__main__": 6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myweb.settings") 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError as exc: 10 | raise ImportError( 11 | "Couldn't import Django. Are you sure it's installed and " 12 | "available on your PYTHONPATH environment variable? Did you " 13 | "forget to activate a virtual environment?" 14 | ) from exc 15 | execute_from_command_line(sys.argv) 16 | -------------------------------------------------------------------------------- /myweb/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/myweb/__init__.py -------------------------------------------------------------------------------- /myweb/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/myweb/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /myweb/__pycache__/settings.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/myweb/__pycache__/settings.cpython-36.pyc -------------------------------------------------------------------------------- /myweb/__pycache__/urls.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/myweb/__pycache__/urls.cpython-36.pyc -------------------------------------------------------------------------------- /myweb/__pycache__/wsgi.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/myweb/__pycache__/wsgi.cpython-36.pyc -------------------------------------------------------------------------------- /myweb/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for myweb project. 3 | 4 | Generated by 'django-admin startproject' using Django 2.0.4. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.0/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/2.0/ref/settings/ 11 | """ 12 | 13 | import os 14 | 15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = '#8^r7rq%5nfxdwru*7)%-fyt!!=whn9-dm6p4$-o&5py($!^+=' 24 | 25 | # SECURITY WARNING: don't run with debug turned on in production! 26 | DEBUG = True 27 | 28 | ALLOWED_HOSTS = ['*'] 29 | 30 | 31 | # Application definition 32 | 33 | INSTALLED_APPS = [ 34 | 'django.contrib.admin', 35 | 'django.contrib.auth', 36 | 'django.contrib.contenttypes', 37 | 'django.contrib.sessions', 38 | 'django.contrib.messages', 39 | 'django.contrib.staticfiles', 40 | 'web.apps.WebConfig', 41 | ] 42 | 43 | MIDDLEWARE = [ 44 | 'django.middleware.security.SecurityMiddleware', 45 | 'django.contrib.sessions.middleware.SessionMiddleware', 46 | 'django.middleware.common.CommonMiddleware', 47 | 'django.middleware.csrf.CsrfViewMiddleware', 48 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 49 | 'django.contrib.messages.middleware.MessageMiddleware', 50 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 51 | ] 52 | 53 | ROOT_URLCONF = 'myweb.urls' 54 | 55 | TEMPLATES = [ 56 | { 57 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 58 | 'DIRS': [os.path.join(BASE_DIR, 'templates')] 59 | , 60 | 'APP_DIRS': True, 61 | 'OPTIONS': { 62 | 'context_processors': [ 63 | 'django.template.context_processors.debug', 64 | 'django.template.context_processors.request', 65 | 'django.contrib.auth.context_processors.auth', 66 | 'django.contrib.messages.context_processors.messages', 67 | ], 68 | }, 69 | }, 70 | ] 71 | 72 | WSGI_APPLICATION = 'myweb.wsgi.application' 73 | 74 | 75 | # Database 76 | # https://docs.djangoproject.com/en/2.0/ref/settings/#databases 77 | 78 | DATABASES = { 79 | 'default': { 80 | 'ENGINE': 'django.db.backends.sqlite3', 81 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 82 | } 83 | } 84 | 85 | 86 | # Password validation 87 | # https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators 88 | 89 | AUTH_PASSWORD_VALIDATORS = [ 90 | { 91 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 92 | }, 93 | { 94 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 95 | }, 96 | { 97 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 98 | }, 99 | { 100 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 101 | }, 102 | ] 103 | 104 | 105 | # Internationalization 106 | # https://docs.djangoproject.com/en/2.0/topics/i18n/ 107 | 108 | LANGUAGE_CODE = 'en-us' 109 | 110 | TIME_ZONE = 'Asia/Shanghai' 111 | 112 | USE_I18N = True 113 | 114 | USE_L10N = True 115 | 116 | USE_TZ = True 117 | 118 | 119 | # Static files (CSS, JavaScript, Images) 120 | # https://docs.djangoproject.com/en/2.0/howto/static-files/ 121 | 122 | STATIC_URL = '/static/' 123 | STATIC_ROOT = os.path.join(BASE_DIR, 'static') 124 | -------------------------------------------------------------------------------- /myweb/urls.py: -------------------------------------------------------------------------------- 1 | """myweb URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.0/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path,re_path 18 | from web.views import * 19 | 20 | urlpatterns = [ 21 | path('admin/', admin.site.urls), 22 | path('', index), 23 | path('aboutUs/', about_us, name='about'), 24 | path('hotNews/', hot_news, name='hot'), 25 | path('articleAnalyze/', article_analyze, name='article'), 26 | path('getArticle/', get_article, name='getA'), 27 | ] 28 | handler404 = page_not_found 29 | -------------------------------------------------------------------------------- /myweb/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for myweb project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | from os.path import join,dirname,abspath 14 | 15 | PROJECT_DIR = dirname(dirname(abspath(__file__)))#3 16 | import sys # 4 17 | sys.path.insert(0,PROJECT_DIR) # 5 18 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myweb.settings") 19 | 20 | application = get_wsgi_application() 21 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | certifi==2018.1.18 2 | chardet==3.0.4 3 | Django==2.2.10 4 | docopt==0.6.2 5 | idna==2.6 6 | mysql-connector==2.1.6 7 | pipreqs==0.4.9 8 | pytz==2018.4 9 | requests==2.20.0 10 | SQLAlchemy>=1.3.0 11 | urllib3==1.24.2 12 | yarg==0.1.9 13 | -------------------------------------------------------------------------------- /static/admin/css/dashboard.css: -------------------------------------------------------------------------------- 1 | /* DASHBOARD */ 2 | 3 | .dashboard .module table th { 4 | width: 100%; 5 | } 6 | 7 | .dashboard .module table td { 8 | white-space: nowrap; 9 | } 10 | 11 | .dashboard .module table td a { 12 | display: block; 13 | padding-right: .6em; 14 | } 15 | 16 | /* RECENT ACTIONS MODULE */ 17 | 18 | .module ul.actionlist { 19 | margin-left: 0; 20 | } 21 | 22 | ul.actionlist li { 23 | list-style-type: none; 24 | overflow: hidden; 25 | text-overflow: ellipsis; 26 | -o-text-overflow: ellipsis; 27 | } 28 | -------------------------------------------------------------------------------- /static/admin/css/fonts.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'Roboto'; 3 | src: url('../fonts/Roboto-Bold-webfont.woff'); 4 | font-weight: 700; 5 | font-style: normal; 6 | } 7 | 8 | @font-face { 9 | font-family: 'Roboto'; 10 | src: url('../fonts/Roboto-Regular-webfont.woff'); 11 | font-weight: 400; 12 | font-style: normal; 13 | } 14 | 15 | @font-face { 16 | font-family: 'Roboto'; 17 | src: url('../fonts/Roboto-Light-webfont.woff'); 18 | font-weight: 300; 19 | font-style: normal; 20 | } 21 | -------------------------------------------------------------------------------- /static/admin/css/login.css: -------------------------------------------------------------------------------- 1 | /* LOGIN FORM */ 2 | 3 | body.login { 4 | background: #f8f8f8; 5 | } 6 | 7 | .login #header { 8 | height: auto; 9 | padding: 5px 16px; 10 | } 11 | 12 | .login #header h1 { 13 | font-size: 18px; 14 | } 15 | 16 | .login #header h1 a { 17 | color: #fff; 18 | } 19 | 20 | .login #content { 21 | padding: 20px 20px 0; 22 | } 23 | 24 | .login #container { 25 | background: #fff; 26 | border: 1px solid #eaeaea; 27 | border-radius: 4px; 28 | overflow: hidden; 29 | width: 28em; 30 | min-width: 300px; 31 | margin: 100px auto; 32 | } 33 | 34 | .login #content-main { 35 | width: 100%; 36 | } 37 | 38 | .login .form-row { 39 | padding: 4px 0; 40 | float: left; 41 | width: 100%; 42 | border-bottom: none; 43 | } 44 | 45 | .login .form-row label { 46 | padding-right: 0.5em; 47 | line-height: 2em; 48 | font-size: 1em; 49 | clear: both; 50 | color: #333; 51 | } 52 | 53 | .login .form-row #id_username, .login .form-row #id_password { 54 | clear: both; 55 | padding: 8px; 56 | width: 100%; 57 | -webkit-box-sizing: border-box; 58 | -moz-box-sizing: border-box; 59 | box-sizing: border-box; 60 | } 61 | 62 | .login span.help { 63 | font-size: 10px; 64 | display: block; 65 | } 66 | 67 | .login .submit-row { 68 | clear: both; 69 | padding: 1em 0 0 9.4em; 70 | margin: 0; 71 | border: none; 72 | background: none; 73 | text-align: left; 74 | } 75 | 76 | .login .password-reset-link { 77 | text-align: center; 78 | } 79 | -------------------------------------------------------------------------------- /static/admin/css/responsive_rtl.css: -------------------------------------------------------------------------------- 1 | /* TABLETS */ 2 | 3 | @media (max-width: 1024px) { 4 | [dir="rtl"] .colMS { 5 | margin-right: 0; 6 | } 7 | 8 | [dir="rtl"] #user-tools { 9 | text-align: right; 10 | } 11 | 12 | [dir="rtl"] #changelist .actions label { 13 | padding-left: 10px; 14 | padding-right: 0; 15 | } 16 | 17 | [dir="rtl"] #changelist .actions select { 18 | margin-left: 0; 19 | margin-right: 15px; 20 | } 21 | 22 | [dir="rtl"] .change-list .filtered .results, 23 | [dir="rtl"] .change-list .filtered .paginator, 24 | [dir="rtl"] .filtered #toolbar, 25 | [dir="rtl"] .filtered div.xfull, 26 | [dir="rtl"] .filtered .actions { 27 | margin-right: 0; 28 | margin-left: 230px; 29 | } 30 | 31 | [dir="rtl"] .inline-group ul.tools a.add, 32 | [dir="rtl"] .inline-group div.add-row a, 33 | [dir="rtl"] .inline-group .tabular tr.add-row td a { 34 | padding: 8px 26px 8px 10px; 35 | background-position: calc(100% - 8px) 9px; 36 | } 37 | 38 | [dir="rtl"] .related-widget-wrapper-link + .selector { 39 | margin-right: 0; 40 | margin-left: 15px; 41 | } 42 | 43 | [dir="rtl"] .selector .selector-filter label { 44 | margin-right: 0; 45 | margin-left: 8px; 46 | } 47 | 48 | [dir="rtl"] .object-tools li { 49 | float: right; 50 | } 51 | 52 | [dir="rtl"] .object-tools li + li { 53 | margin-left: 0; 54 | margin-right: 15px; 55 | } 56 | 57 | [dir="rtl"] .dashboard .module table td a { 58 | padding-left: 0; 59 | padding-right: 16px; 60 | } 61 | } 62 | 63 | /* MOBILE */ 64 | 65 | @media (max-width: 767px) { 66 | [dir="rtl"] .change-list .filtered .results, 67 | [dir="rtl"] .change-list .filtered .paginator, 68 | [dir="rtl"] .filtered #toolbar, 69 | [dir="rtl"] .filtered div.xfull, 70 | [dir="rtl"] .filtered .actions { 71 | margin-left: 0; 72 | } 73 | 74 | [dir="rtl"] .aligned .add-another, 75 | [dir="rtl"] .aligned .related-lookup, 76 | [dir="rtl"] .aligned .datetimeshortcuts { 77 | margin-left: 0; 78 | margin-right: 15px; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /static/admin/css/rtl.css: -------------------------------------------------------------------------------- 1 | body { 2 | direction: rtl; 3 | } 4 | 5 | /* LOGIN */ 6 | 7 | .login .form-row { 8 | float: right; 9 | } 10 | 11 | .login .form-row label { 12 | float: right; 13 | padding-left: 0.5em; 14 | padding-right: 0; 15 | text-align: left; 16 | } 17 | 18 | .login .submit-row { 19 | clear: both; 20 | padding: 1em 9.4em 0 0; 21 | } 22 | 23 | /* GLOBAL */ 24 | 25 | th { 26 | text-align: right; 27 | } 28 | 29 | .module h2, .module caption { 30 | text-align: right; 31 | } 32 | 33 | .module ul, .module ol { 34 | margin-left: 0; 35 | margin-right: 1.5em; 36 | } 37 | 38 | .addlink, .changelink { 39 | padding-left: 0; 40 | padding-right: 16px; 41 | background-position: 100% 1px; 42 | } 43 | 44 | .deletelink { 45 | padding-left: 0; 46 | padding-right: 16px; 47 | background-position: 100% 1px; 48 | } 49 | 50 | .object-tools { 51 | float: left; 52 | } 53 | 54 | thead th:first-child, 55 | tfoot td:first-child { 56 | border-left: none; 57 | } 58 | 59 | /* LAYOUT */ 60 | 61 | #user-tools { 62 | right: auto; 63 | left: 0; 64 | text-align: left; 65 | } 66 | 67 | div.breadcrumbs { 68 | text-align: right; 69 | } 70 | 71 | #content-main { 72 | float: right; 73 | } 74 | 75 | #content-related { 76 | float: left; 77 | margin-left: -300px; 78 | margin-right: auto; 79 | } 80 | 81 | .colMS { 82 | margin-left: 300px; 83 | margin-right: 0; 84 | } 85 | 86 | /* SORTABLE TABLES */ 87 | 88 | table thead th.sorted .sortoptions { 89 | float: left; 90 | } 91 | 92 | thead th.sorted .text { 93 | padding-right: 0; 94 | padding-left: 42px; 95 | } 96 | 97 | /* dashboard styles */ 98 | 99 | .dashboard .module table td a { 100 | padding-left: .6em; 101 | padding-right: 16px; 102 | } 103 | 104 | /* changelists styles */ 105 | 106 | .change-list .filtered table { 107 | border-left: none; 108 | border-right: 0px none; 109 | } 110 | 111 | #changelist-filter { 112 | right: auto; 113 | left: 0; 114 | border-left: none; 115 | border-right: none; 116 | } 117 | 118 | .change-list .filtered .results, .change-list .filtered .paginator, .filtered #toolbar, .filtered div.xfull { 119 | margin-right: 0; 120 | margin-left: 280px; 121 | } 122 | 123 | #changelist-filter li.selected { 124 | border-left: none; 125 | padding-left: 10px; 126 | margin-left: 0; 127 | border-right: 5px solid #eaeaea; 128 | padding-right: 10px; 129 | margin-right: -15px; 130 | } 131 | 132 | .filtered .actions { 133 | margin-left: 280px; 134 | margin-right: 0; 135 | } 136 | 137 | #changelist table tbody td:first-child, #changelist table tbody th:first-child { 138 | border-right: none; 139 | border-left: none; 140 | } 141 | 142 | /* FORMS */ 143 | 144 | .aligned label { 145 | padding: 0 0 3px 1em; 146 | float: right; 147 | } 148 | 149 | .submit-row { 150 | text-align: left 151 | } 152 | 153 | .submit-row p.deletelink-box { 154 | float: right; 155 | } 156 | 157 | .submit-row input.default { 158 | margin-left: 0; 159 | } 160 | 161 | .vDateField, .vTimeField { 162 | margin-left: 2px; 163 | } 164 | 165 | .aligned .form-row input { 166 | margin-left: 5px; 167 | } 168 | 169 | form .aligned p.help, form .aligned div.help { 170 | clear: right; 171 | } 172 | 173 | form ul.inline li { 174 | float: right; 175 | padding-right: 0; 176 | padding-left: 7px; 177 | } 178 | 179 | input[type=submit].default, .submit-row input.default { 180 | float: left; 181 | } 182 | 183 | fieldset .field-box { 184 | float: right; 185 | margin-left: 20px; 186 | margin-right: 0; 187 | } 188 | 189 | .errorlist li { 190 | background-position: 100% 12px; 191 | padding: 0; 192 | } 193 | 194 | .errornote { 195 | background-position: 100% 12px; 196 | padding: 10px 12px; 197 | } 198 | 199 | /* WIDGETS */ 200 | 201 | .calendarnav-previous { 202 | top: 0; 203 | left: auto; 204 | right: 10px; 205 | } 206 | 207 | .calendarnav-next { 208 | top: 0; 209 | right: auto; 210 | left: 10px; 211 | } 212 | 213 | .calendar caption, .calendarbox h2 { 214 | text-align: center; 215 | } 216 | 217 | .selector { 218 | float: right; 219 | } 220 | 221 | .selector .selector-filter { 222 | text-align: right; 223 | } 224 | 225 | .inline-deletelink { 226 | float: left; 227 | } 228 | 229 | form .form-row p.datetime { 230 | overflow: hidden; 231 | } 232 | 233 | .related-widget-wrapper { 234 | float: right; 235 | } 236 | 237 | /* MISC */ 238 | 239 | .inline-related h2, .inline-group h2 { 240 | text-align: right 241 | } 242 | 243 | .inline-related h3 span.delete { 244 | padding-right: 20px; 245 | padding-left: inherit; 246 | left: 10px; 247 | right: inherit; 248 | float:left; 249 | } 250 | 251 | .inline-related h3 span.delete label { 252 | margin-left: inherit; 253 | margin-right: 2px; 254 | } 255 | 256 | /* IE7 specific bug fixes */ 257 | 258 | div.colM { 259 | position: relative; 260 | } 261 | 262 | .submit-row input { 263 | float: left; 264 | } 265 | -------------------------------------------------------------------------------- /static/admin/css/vendor/select2/LICENSE-SELECT2.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2012-2015 Kevin Brown, Igor Vaynberg, and Select2 contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /static/admin/fonts/README.txt: -------------------------------------------------------------------------------- 1 | Roboto webfont source: https://www.google.com/fonts/specimen/Roboto 2 | Weights used in this project: Light (300), Regular (400), Bold (700) 3 | -------------------------------------------------------------------------------- /static/admin/fonts/Roboto-Bold-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/static/admin/fonts/Roboto-Bold-webfont.woff -------------------------------------------------------------------------------- /static/admin/fonts/Roboto-Light-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/static/admin/fonts/Roboto-Light-webfont.woff -------------------------------------------------------------------------------- /static/admin/fonts/Roboto-Regular-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/static/admin/fonts/Roboto-Regular-webfont.woff -------------------------------------------------------------------------------- /static/admin/img/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Code Charm Ltd 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /static/admin/img/README.txt: -------------------------------------------------------------------------------- 1 | All icons are taken from Font Awesome (http://fontawesome.io/) project. 2 | The Font Awesome font is licensed under the SIL OFL 1.1: 3 | - http://scripts.sil.org/OFL 4 | 5 | SVG icons source: https://github.com/encharm/Font-Awesome-SVG-PNG 6 | Font-Awesome-SVG-PNG is licensed under the MIT license (see file license 7 | in current folder). 8 | -------------------------------------------------------------------------------- /static/admin/img/calendar-icons.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /static/admin/img/gis/move_vertex_off.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /static/admin/img/gis/move_vertex_on.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /static/admin/img/icon-addlink.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/admin/img/icon-alert.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/admin/img/icon-calendar.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /static/admin/img/icon-changelink.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/admin/img/icon-clock.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /static/admin/img/icon-deletelink.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/admin/img/icon-no.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/admin/img/icon-unknown-alt.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/admin/img/icon-unknown.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/admin/img/icon-yes.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/admin/img/inline-delete.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/admin/img/search.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/admin/img/selector-icons.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /static/admin/img/sorting-icons.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /static/admin/img/tooltag-add.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/admin/img/tooltag-arrowright.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/admin/js/SelectBox.js: -------------------------------------------------------------------------------- 1 | (function($) { 2 | 'use strict'; 3 | var SelectBox = { 4 | cache: {}, 5 | init: function(id) { 6 | var box = document.getElementById(id); 7 | var node; 8 | SelectBox.cache[id] = []; 9 | var cache = SelectBox.cache[id]; 10 | var boxOptions = box.options; 11 | var boxOptionsLength = boxOptions.length; 12 | for (var i = 0, j = boxOptionsLength; i < j; i++) { 13 | node = boxOptions[i]; 14 | cache.push({value: node.value, text: node.text, displayed: 1}); 15 | } 16 | }, 17 | redisplay: function(id) { 18 | // Repopulate HTML select box from cache 19 | var box = document.getElementById(id); 20 | var node; 21 | $(box).empty(); // clear all options 22 | var new_options = box.outerHTML.slice(0, -9); // grab just the opening tag 23 | var cache = SelectBox.cache[id]; 24 | for (var i = 0, j = cache.length; i < j; i++) { 25 | node = cache[i]; 26 | if (node.displayed) { 27 | var new_option = new Option(node.text, node.value, false, false); 28 | // Shows a tooltip when hovering over the option 29 | new_option.setAttribute("title", node.text); 30 | new_options += new_option.outerHTML; 31 | } 32 | } 33 | new_options += ''; 34 | box.outerHTML = new_options; 35 | }, 36 | filter: function(id, text) { 37 | // Redisplay the HTML select box, displaying only the choices containing ALL 38 | // the words in text. (It's an AND search.) 39 | var tokens = text.toLowerCase().split(/\s+/); 40 | var node, token; 41 | var cache = SelectBox.cache[id]; 42 | for (var i = 0, j = cache.length; i < j; i++) { 43 | node = cache[i]; 44 | node.displayed = 1; 45 | var node_text = node.text.toLowerCase(); 46 | var numTokens = tokens.length; 47 | for (var k = 0; k < numTokens; k++) { 48 | token = tokens[k]; 49 | if (node_text.indexOf(token) === -1) { 50 | node.displayed = 0; 51 | break; // Once the first token isn't found we're done 52 | } 53 | } 54 | } 55 | SelectBox.redisplay(id); 56 | }, 57 | delete_from_cache: function(id, value) { 58 | var node, delete_index = null; 59 | var cache = SelectBox.cache[id]; 60 | for (var i = 0, j = cache.length; i < j; i++) { 61 | node = cache[i]; 62 | if (node.value === value) { 63 | delete_index = i; 64 | break; 65 | } 66 | } 67 | cache.splice(delete_index, 1); 68 | }, 69 | add_to_cache: function(id, option) { 70 | SelectBox.cache[id].push({value: option.value, text: option.text, displayed: 1}); 71 | }, 72 | cache_contains: function(id, value) { 73 | // Check if an item is contained in the cache 74 | var node; 75 | var cache = SelectBox.cache[id]; 76 | for (var i = 0, j = cache.length; i < j; i++) { 77 | node = cache[i]; 78 | if (node.value === value) { 79 | return true; 80 | } 81 | } 82 | return false; 83 | }, 84 | move: function(from, to) { 85 | var from_box = document.getElementById(from); 86 | var option; 87 | var boxOptions = from_box.options; 88 | var boxOptionsLength = boxOptions.length; 89 | for (var i = 0, j = boxOptionsLength; i < j; i++) { 90 | option = boxOptions[i]; 91 | var option_value = option.value; 92 | if (option.selected && SelectBox.cache_contains(from, option_value)) { 93 | SelectBox.add_to_cache(to, {value: option_value, text: option.text, displayed: 1}); 94 | SelectBox.delete_from_cache(from, option_value); 95 | } 96 | } 97 | SelectBox.redisplay(from); 98 | SelectBox.redisplay(to); 99 | }, 100 | move_all: function(from, to) { 101 | var from_box = document.getElementById(from); 102 | var option; 103 | var boxOptions = from_box.options; 104 | var boxOptionsLength = boxOptions.length; 105 | for (var i = 0, j = boxOptionsLength; i < j; i++) { 106 | option = boxOptions[i]; 107 | var option_value = option.value; 108 | if (SelectBox.cache_contains(from, option_value)) { 109 | SelectBox.add_to_cache(to, {value: option_value, text: option.text, displayed: 1}); 110 | SelectBox.delete_from_cache(from, option_value); 111 | } 112 | } 113 | SelectBox.redisplay(from); 114 | SelectBox.redisplay(to); 115 | }, 116 | sort: function(id) { 117 | SelectBox.cache[id].sort(function(a, b) { 118 | a = a.text.toLowerCase(); 119 | b = b.text.toLowerCase(); 120 | try { 121 | if (a > b) { 122 | return 1; 123 | } 124 | if (a < b) { 125 | return -1; 126 | } 127 | } 128 | catch (e) { 129 | // silently fail on IE 'unknown' exception 130 | } 131 | return 0; 132 | } ); 133 | }, 134 | select_all: function(id) { 135 | var box = document.getElementById(id); 136 | var boxOptions = box.options; 137 | var boxOptionsLength = boxOptions.length; 138 | for (var i = 0; i < boxOptionsLength; i++) { 139 | boxOptions[i].selected = 'selected'; 140 | } 141 | } 142 | }; 143 | window.SelectBox = SelectBox; 144 | })(django.jQuery); 145 | -------------------------------------------------------------------------------- /static/admin/js/actions.js: -------------------------------------------------------------------------------- 1 | /*global gettext, interpolate, ngettext*/ 2 | (function($) { 3 | 'use strict'; 4 | var lastChecked; 5 | 6 | $.fn.actions = function(opts) { 7 | var options = $.extend({}, $.fn.actions.defaults, opts); 8 | var actionCheckboxes = $(this); 9 | var list_editable_changed = false; 10 | var showQuestion = function() { 11 | $(options.acrossClears).hide(); 12 | $(options.acrossQuestions).show(); 13 | $(options.allContainer).hide(); 14 | }, 15 | showClear = function() { 16 | $(options.acrossClears).show(); 17 | $(options.acrossQuestions).hide(); 18 | $(options.actionContainer).toggleClass(options.selectedClass); 19 | $(options.allContainer).show(); 20 | $(options.counterContainer).hide(); 21 | }, 22 | reset = function() { 23 | $(options.acrossClears).hide(); 24 | $(options.acrossQuestions).hide(); 25 | $(options.allContainer).hide(); 26 | $(options.counterContainer).show(); 27 | }, 28 | clearAcross = function() { 29 | reset(); 30 | $(options.acrossInput).val(0); 31 | $(options.actionContainer).removeClass(options.selectedClass); 32 | }, 33 | checker = function(checked) { 34 | if (checked) { 35 | showQuestion(); 36 | } else { 37 | reset(); 38 | } 39 | $(actionCheckboxes).prop("checked", checked) 40 | .parent().parent().toggleClass(options.selectedClass, checked); 41 | }, 42 | updateCounter = function() { 43 | var sel = $(actionCheckboxes).filter(":checked").length; 44 | // data-actions-icnt is defined in the generated HTML 45 | // and contains the total amount of objects in the queryset 46 | var actions_icnt = $('.action-counter').data('actionsIcnt'); 47 | $(options.counterContainer).html(interpolate( 48 | ngettext('%(sel)s of %(cnt)s selected', '%(sel)s of %(cnt)s selected', sel), { 49 | sel: sel, 50 | cnt: actions_icnt 51 | }, true)); 52 | $(options.allToggle).prop("checked", function() { 53 | var value; 54 | if (sel === actionCheckboxes.length) { 55 | value = true; 56 | showQuestion(); 57 | } else { 58 | value = false; 59 | clearAcross(); 60 | } 61 | return value; 62 | }); 63 | }; 64 | // Show counter by default 65 | $(options.counterContainer).show(); 66 | // Check state of checkboxes and reinit state if needed 67 | $(this).filter(":checked").each(function(i) { 68 | $(this).parent().parent().toggleClass(options.selectedClass); 69 | updateCounter(); 70 | if ($(options.acrossInput).val() === 1) { 71 | showClear(); 72 | } 73 | }); 74 | $(options.allToggle).show().click(function() { 75 | checker($(this).prop("checked")); 76 | updateCounter(); 77 | }); 78 | $("a", options.acrossQuestions).click(function(event) { 79 | event.preventDefault(); 80 | $(options.acrossInput).val(1); 81 | showClear(); 82 | }); 83 | $("a", options.acrossClears).click(function(event) { 84 | event.preventDefault(); 85 | $(options.allToggle).prop("checked", false); 86 | clearAcross(); 87 | checker(0); 88 | updateCounter(); 89 | }); 90 | lastChecked = null; 91 | $(actionCheckboxes).click(function(event) { 92 | if (!event) { event = window.event; } 93 | var target = event.target ? event.target : event.srcElement; 94 | if (lastChecked && $.data(lastChecked) !== $.data(target) && event.shiftKey === true) { 95 | var inrange = false; 96 | $(lastChecked).prop("checked", target.checked) 97 | .parent().parent().toggleClass(options.selectedClass, target.checked); 98 | $(actionCheckboxes).each(function() { 99 | if ($.data(this) === $.data(lastChecked) || $.data(this) === $.data(target)) { 100 | inrange = (inrange) ? false : true; 101 | } 102 | if (inrange) { 103 | $(this).prop("checked", target.checked) 104 | .parent().parent().toggleClass(options.selectedClass, target.checked); 105 | } 106 | }); 107 | } 108 | $(target).parent().parent().toggleClass(options.selectedClass, target.checked); 109 | lastChecked = target; 110 | updateCounter(); 111 | }); 112 | $('form#changelist-form table#result_list tr').on('change', 'td:gt(0) :input', function() { 113 | list_editable_changed = true; 114 | }); 115 | $('form#changelist-form button[name="index"]').click(function(event) { 116 | if (list_editable_changed) { 117 | return confirm(gettext("You have unsaved changes on individual editable fields. If you run an action, your unsaved changes will be lost.")); 118 | } 119 | }); 120 | $('form#changelist-form input[name="_save"]').click(function(event) { 121 | var action_changed = false; 122 | $('select option:selected', options.actionContainer).each(function() { 123 | if ($(this).val()) { 124 | action_changed = true; 125 | } 126 | }); 127 | if (action_changed) { 128 | if (list_editable_changed) { 129 | return confirm(gettext("You have selected an action, but you haven't saved your changes to individual fields yet. Please click OK to save. You'll need to re-run the action.")); 130 | } else { 131 | return confirm(gettext("You have selected an action, and you haven't made any changes on individual fields. You're probably looking for the Go button rather than the Save button.")); 132 | } 133 | } 134 | }); 135 | }; 136 | /* Setup plugin defaults */ 137 | $.fn.actions.defaults = { 138 | actionContainer: "div.actions", 139 | counterContainer: "span.action-counter", 140 | allContainer: "div.actions span.all", 141 | acrossInput: "div.actions input.select-across", 142 | acrossQuestions: "div.actions span.question", 143 | acrossClears: "div.actions span.clear", 144 | allToggle: "#action-toggle", 145 | selectedClass: "selected" 146 | }; 147 | $(document).ready(function() { 148 | var $actionsEls = $('tr input.action-select'); 149 | if ($actionsEls.length > 0) { 150 | $actionsEls.actions(); 151 | } 152 | }); 153 | })(django.jQuery); 154 | -------------------------------------------------------------------------------- /static/admin/js/actions.min.js: -------------------------------------------------------------------------------- 1 | (function(a){var f;a.fn.actions=function(e){var b=a.extend({},a.fn.actions.defaults,e),g=a(this),k=!1,l=function(){a(b.acrossClears).hide();a(b.acrossQuestions).show();a(b.allContainer).hide()},m=function(){a(b.acrossClears).show();a(b.acrossQuestions).hide();a(b.actionContainer).toggleClass(b.selectedClass);a(b.allContainer).show();a(b.counterContainer).hide()},n=function(){a(b.acrossClears).hide();a(b.acrossQuestions).hide();a(b.allContainer).hide();a(b.counterContainer).show()},p=function(){n(); 2 | a(b.acrossInput).val(0);a(b.actionContainer).removeClass(b.selectedClass)},q=function(c){c?l():n();a(g).prop("checked",c).parent().parent().toggleClass(b.selectedClass,c)},h=function(){var c=a(g).filter(":checked").length,d=a(".action-counter").data("actionsIcnt");a(b.counterContainer).html(interpolate(ngettext("%(sel)s of %(cnt)s selected","%(sel)s of %(cnt)s selected",c),{sel:c,cnt:d},!0));a(b.allToggle).prop("checked",function(){var a;c===g.length?(a=!0,l()):(a=!1,p());return a})};a(b.counterContainer).show(); 3 | a(this).filter(":checked").each(function(c){a(this).parent().parent().toggleClass(b.selectedClass);h();1===a(b.acrossInput).val()&&m()});a(b.allToggle).show().click(function(){q(a(this).prop("checked"));h()});a("a",b.acrossQuestions).click(function(c){c.preventDefault();a(b.acrossInput).val(1);m()});a("a",b.acrossClears).click(function(c){c.preventDefault();a(b.allToggle).prop("checked",!1);p();q(0);h()});f=null;a(g).click(function(c){c||(c=window.event);var d=c.target?c.target:c.srcElement;if(f&& 4 | a.data(f)!==a.data(d)&&!0===c.shiftKey){var e=!1;a(f).prop("checked",d.checked).parent().parent().toggleClass(b.selectedClass,d.checked);a(g).each(function(){if(a.data(this)===a.data(f)||a.data(this)===a.data(d))e=e?!1:!0;e&&a(this).prop("checked",d.checked).parent().parent().toggleClass(b.selectedClass,d.checked)})}a(d).parent().parent().toggleClass(b.selectedClass,d.checked);f=d;h()});a("form#changelist-form table#result_list tr").on("change","td:gt(0) :input",function(){k=!0});a('form#changelist-form button[name="index"]').click(function(a){if(k)return confirm(gettext("You have unsaved changes on individual editable fields. If you run an action, your unsaved changes will be lost."))}); 5 | a('form#changelist-form input[name="_save"]').click(function(c){var d=!1;a("select option:selected",b.actionContainer).each(function(){a(this).val()&&(d=!0)});if(d)return k?confirm(gettext("You have selected an action, but you haven't saved your changes to individual fields yet. Please click OK to save. You'll need to re-run the action.")):confirm(gettext("You have selected an action, and you haven't made any changes on individual fields. You're probably looking for the Go button rather than the Save button."))})}; 6 | a.fn.actions.defaults={actionContainer:"div.actions",counterContainer:"span.action-counter",allContainer:"div.actions span.all",acrossInput:"div.actions input.select-across",acrossQuestions:"div.actions span.question",acrossClears:"div.actions span.clear",allToggle:"#action-toggle",selectedClass:"selected"};a(document).ready(function(){var e=a("tr input.action-select");0' + gettext("Show") + 11 | ')'); 12 | } 13 | }); 14 | // Add toggle to anchor tag 15 | $("fieldset.collapse a.collapse-toggle").click(function(ev) { 16 | if ($(this).closest("fieldset").hasClass("collapsed")) { 17 | // Show 18 | $(this).text(gettext("Hide")).closest("fieldset").removeClass("collapsed").trigger("show.fieldset", [$(this).attr("id")]); 19 | } else { 20 | // Hide 21 | $(this).text(gettext("Show")).closest("fieldset").addClass("collapsed").trigger("hide.fieldset", [$(this).attr("id")]); 22 | } 23 | return false; 24 | }); 25 | }); 26 | })(django.jQuery); 27 | -------------------------------------------------------------------------------- /static/admin/js/collapse.min.js: -------------------------------------------------------------------------------- 1 | var $jscomp={scope:{},findInternal:function(a,c,b){a instanceof String&&(a=String(a));for(var d=a.length,e=0;e'+gettext("Show")+")")});a("fieldset.collapse a.collapse-toggle").click(function(c){a(this).closest("fieldset").hasClass("collapsed")?a(this).text(gettext("Hide")).closest("fieldset").removeClass("collapsed").trigger("show.fieldset",[a(this).attr("id")]):a(this).text(gettext("Show")).closest("fieldset").addClass("collapsed").trigger("hide.fieldset", 5 | [a(this).attr("id")]);return!1})})})(django.jQuery); 6 | -------------------------------------------------------------------------------- /static/admin/js/inlines.min.js: -------------------------------------------------------------------------------- 1 | var $jscomp={scope:{},findInternal:function(b,c,a){b instanceof String&&(b=String(b));for(var d=b.length,e=0;e'+a.addText+""),k=c.find("tr:last a")):(d.filter(":last").after('"),k=d.filter(":last").next().find("a")));k.click(function(c){c.preventDefault();c=b("#"+a.prefix+"-empty"); 6 | var d=c.clone(!0);d.removeClass(a.emptyCssClass).addClass(a.formCssClass).attr("id",a.prefix+"-"+l);d.is("tr")?d.children(":last").append('
'+a.deleteText+"
"):d.is("ul")||d.is("ol")?d.append('
  • '+a.deleteText+"
  • "):d.children(":first").append(''+a.deleteText+"");d.find("*").each(function(){e(this,a.prefix,f.val())});d.insertBefore(b(c)); 7 | b(f).val(parseInt(f.val(),10)+1);l+=1;""!==h.val()&&0>=h.val()-f.val()&&k.parent().hide();d.find("a."+a.deleteCssClass).click(function(c){c.preventDefault();d.remove();--l;a.removed&&a.removed(d);b(document).trigger("formset:removed",[d,a.prefix]);c=b("."+a.formCssClass);b("#id_"+a.prefix+"-TOTAL_FORMS").val(c.length);(""===h.val()||0 tr").tabularFormset(a.options)}})})})(django.jQuery); 14 | -------------------------------------------------------------------------------- /static/admin/js/jquery.init.js: -------------------------------------------------------------------------------- 1 | /*global django:true, jQuery:false*/ 2 | /* Puts the included jQuery into our own namespace using noConflict and passing 3 | * it 'true'. This ensures that the included jQuery doesn't pollute the global 4 | * namespace (i.e. this preserves pre-existing values for both window.$ and 5 | * window.jQuery). 6 | */ 7 | var django = django || {}; 8 | django.jQuery = jQuery.noConflict(true); 9 | -------------------------------------------------------------------------------- /static/admin/js/popup_response.js: -------------------------------------------------------------------------------- 1 | /*global opener */ 2 | (function() { 3 | 'use strict'; 4 | var initData = JSON.parse(document.getElementById('django-admin-popup-response-constants').dataset.popupResponse); 5 | switch(initData.action) { 6 | case 'change': 7 | opener.dismissChangeRelatedObjectPopup(window, initData.value, initData.obj, initData.new_value); 8 | break; 9 | case 'delete': 10 | opener.dismissDeleteRelatedObjectPopup(window, initData.value); 11 | break; 12 | default: 13 | opener.dismissAddRelatedObjectPopup(window, initData.value, initData.obj); 14 | break; 15 | } 16 | })(); 17 | -------------------------------------------------------------------------------- /static/admin/js/prepopulate.js: -------------------------------------------------------------------------------- 1 | /*global URLify*/ 2 | (function($) { 3 | 'use strict'; 4 | $.fn.prepopulate = function(dependencies, maxLength, allowUnicode) { 5 | /* 6 | Depends on urlify.js 7 | Populates a selected field with the values of the dependent fields, 8 | URLifies and shortens the string. 9 | dependencies - array of dependent fields ids 10 | maxLength - maximum length of the URLify'd string 11 | allowUnicode - Unicode support of the URLify'd string 12 | */ 13 | return this.each(function() { 14 | var prepopulatedField = $(this); 15 | 16 | var populate = function() { 17 | // Bail if the field's value has been changed by the user 18 | if (prepopulatedField.data('_changed')) { 19 | return; 20 | } 21 | 22 | var values = []; 23 | $.each(dependencies, function(i, field) { 24 | field = $(field); 25 | if (field.val().length > 0) { 26 | values.push(field.val()); 27 | } 28 | }); 29 | prepopulatedField.val(URLify(values.join(' '), maxLength, allowUnicode)); 30 | }; 31 | 32 | prepopulatedField.data('_changed', false); 33 | prepopulatedField.change(function() { 34 | prepopulatedField.data('_changed', true); 35 | }); 36 | 37 | if (!prepopulatedField.val()) { 38 | $(dependencies.join(',')).keyup(populate).change(populate).focus(populate); 39 | } 40 | }); 41 | }; 42 | })(django.jQuery); 43 | -------------------------------------------------------------------------------- /static/admin/js/prepopulate.min.js: -------------------------------------------------------------------------------- 1 | (function(c){c.fn.prepopulate=function(e,f,g){return this.each(function(){var a=c(this),b=function(){if(!a.data("_changed")){var b=[];c.each(e,function(a,d){d=c(d);01&&(n+="a"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Моля въведете още "+t+" символ";return t>1&&(n+="a"),n},loadingMore:function(){return"Зареждат се още…"},maximumSelected:function(e){var t="Можете да направите до "+e.maximum+" ";return e.maximum>1?t+="избора":t+="избор",t},noResults:function(){return"Няма намерени съвпадения"},searching:function(){return"Търсене…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/ca.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ca",[],function(){return{errorLoading:function(){return"La càrrega ha fallat"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Si us plau, elimina "+t+" car";return t==1?n+="àcter":n+="àcters",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Si us plau, introdueix "+t+" car";return t==1?n+="àcter":n+="àcters",n},loadingMore:function(){return"Carregant més resultats…"},maximumSelected:function(e){var t="Només es pot seleccionar "+e.maximum+" element";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No s'han trobat resultats"},searching:function(){return"Cercant…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/cs.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/cs",[],function(){function e(e,t){switch(e){case 2:return t?"dva":"dvě";case 3:return"tři";case 4:return"čtyři"}return""}return{errorLoading:function(){return"Výsledky nemohly být načteny."},inputTooLong:function(t){var n=t.input.length-t.maximum;return n==1?"Prosím zadejte o jeden znak méně":n<=4?"Prosím zadejte o "+e(n,!0)+" znaky méně":"Prosím zadejte o "+n+" znaků méně"},inputTooShort:function(t){var n=t.minimum-t.input.length;return n==1?"Prosím zadejte ještě jeden znak":n<=4?"Prosím zadejte ještě další "+e(n,!0)+" znaky":"Prosím zadejte ještě dalších "+n+" znaků"},loadingMore:function(){return"Načítají se další výsledky…"},maximumSelected:function(t){var n=t.maximum;return n==1?"Můžete zvolit jen jednu položku":n<=4?"Můžete zvolit maximálně "+e(n,!1)+" položky":"Můžete zvolit maximálně "+n+" položek"},noResults:function(){return"Nenalezeny žádné položky"},searching:function(){return"Vyhledávání…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/da.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/da",[],function(){return{errorLoading:function(){return"Resultaterne kunne ikke indlæses."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Angiv venligst "+t+" tegn mindre";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Angiv venligst "+t+" tegn mere";return n},loadingMore:function(){return"Indlæser flere resultater…"},maximumSelected:function(e){var t="Du kan kun vælge "+e.maximum+" emne";return e.maximum!=1&&(t+="r"),t},noResults:function(){return"Ingen resultater fundet"},searching:function(){return"Søger…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/de.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/de",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return"Bitte "+t+" Zeichen weniger eingeben"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Bitte "+t+" Zeichen mehr eingeben"},loadingMore:function(){return"Lade mehr Ergebnisse…"},maximumSelected:function(e){var t="Sie können nur "+e.maximum+" Eintr";return e.maximum===1?t+="ag":t+="äge",t+=" auswählen",t},noResults:function(){return"Keine Übereinstimmungen gefunden"},searching:function(){return"Suche…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/el.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/el",[],function(){return{errorLoading:function(){return"Τα αποτελέσματα δεν μπόρεσαν να φορτώσουν."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Παρακαλώ διαγράψτε "+t+" χαρακτήρ";return t==1&&(n+="α"),t!=1&&(n+="ες"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Παρακαλώ συμπληρώστε "+t+" ή περισσότερους χαρακτήρες";return n},loadingMore:function(){return"Φόρτωση περισσότερων αποτελεσμάτων…"},maximumSelected:function(e){var t="Μπορείτε να επιλέξετε μόνο "+e.maximum+" επιλογ";return e.maximum==1&&(t+="ή"),e.maximum!=1&&(t+="ές"),t},noResults:function(){return"Δεν βρέθηκαν αποτελέσματα"},searching:function(){return"Αναζήτηση…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/en.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Please delete "+t+" character";return t!=1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Please enter "+t+" or more characters";return n},loadingMore:function(){return"Loading more results…"},maximumSelected:function(e){var t="You can only select "+e.maximum+" item";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/es.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/es",[],function(){return{errorLoading:function(){return"La carga falló"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Por favor, elimine "+t+" car";return t==1?n+="ácter":n+="acteres",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Por favor, introduzca "+t+" car";return t==1?n+="ácter":n+="acteres",n},loadingMore:function(){return"Cargando más resultados…"},maximumSelected:function(e){var t="Sólo puede seleccionar "+e.maximum+" elemento";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No se encontraron resultados"},searching:function(){return"Buscando…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/et.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/et",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Sisesta "+t+" täht";return t!=1&&(n+="e"),n+=" vähem",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Sisesta "+t+" täht";return t!=1&&(n+="e"),n+=" rohkem",n},loadingMore:function(){return"Laen tulemusi…"},maximumSelected:function(e){var t="Saad vaid "+e.maximum+" tulemus";return e.maximum==1?t+="e":t+="t",t+=" valida",t},noResults:function(){return"Tulemused puuduvad"},searching:function(){return"Otsin…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/eu.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/eu",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Idatzi ";return t==1?n+="karaktere bat":n+=t+" karaktere",n+=" gutxiago",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Idatzi ";return t==1?n+="karaktere bat":n+=t+" karaktere",n+=" gehiago",n},loadingMore:function(){return"Emaitza gehiago kargatzen…"},maximumSelected:function(e){return e.maximum===1?"Elementu bakarra hauta dezakezu":e.maximum+" elementu hauta ditzakezu soilik"},noResults:function(){return"Ez da bat datorrenik aurkitu"},searching:function(){return"Bilatzen…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/fa.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fa",[],function(){return{errorLoading:function(){return"امکان بارگذاری نتایج وجود ندارد."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="لطفاً "+t+" کاراکتر را حذف نمایید";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="لطفاً تعداد "+t+" کاراکتر یا بیشتر وارد نمایید";return n},loadingMore:function(){return"در حال بارگذاری نتایج بیشتر..."},maximumSelected:function(e){var t="شما تنها می‌توانید "+e.maximum+" آیتم را انتخاب نمایید";return t},noResults:function(){return"هیچ نتیجه‌ای یافت نشد"},searching:function(){return"در حال جستجو..."}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/fi.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fi",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return"Ole hyvä ja anna "+t+" merkkiä vähemmän"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Ole hyvä ja anna "+t+" merkkiä lisää"},loadingMore:function(){return"Ladataan lisää tuloksia…"},maximumSelected:function(e){return"Voit valita ainoastaan "+e.maximum+" kpl"},noResults:function(){return"Ei tuloksia"},searching:function(){}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/fr.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fr",[],function(){return{errorLoading:function(){return"Les résultats ne peuvent pas être chargés."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Supprimez "+t+" caractère";return t!==1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Saisissez "+t+" caractère";return t!==1&&(n+="s"),n},loadingMore:function(){return"Chargement de résultats supplémentaires…"},maximumSelected:function(e){var t="Vous pouvez seulement sélectionner "+e.maximum+" élément";return e.maximum!==1&&(t+="s"),t},noResults:function(){return"Aucun résultat trouvé"},searching:function(){return"Recherche en cours…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/gl.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/gl",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Elimine ";return t===1?n+="un carácter":n+=t+" caracteres",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Engada ";return t===1?n+="un carácter":n+=t+" caracteres",n},loadingMore:function(){return"Cargando máis resultados…"},maximumSelected:function(e){var t="Só pode ";return e.maximum===1?t+="un elemento":t+=e.maximum+" elementos",t},noResults:function(){return"Non se atoparon resultados"},searching:function(){return"Buscando…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/he.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/he",[],function(){return{errorLoading:function(){return"שגיאה בטעינת התוצאות"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="נא למחוק ";return t===1?n+="תו אחד":n+=t+" תווים",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="נא להכניס ";return t===1?n+="תו אחד":n+=t+" תווים",n+=" או יותר",n},loadingMore:function(){return"טוען תוצאות נוספות…"},maximumSelected:function(e){var t="באפשרותך לבחור עד ";return e.maximum===1?t+="פריט אחד":t+=e.maximum+" פריטים",t},noResults:function(){return"לא נמצאו תוצאות"},searching:function(){return"מחפש…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/hi.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hi",[],function(){return{errorLoading:function(){return"परिणामों को लोड नहीं किया जा सका।"},inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" अक्षर को हटा दें";return t>1&&(n=t+" अक्षरों को हटा दें "),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="कृपया "+t+" या अधिक अक्षर दर्ज करें";return n},loadingMore:function(){return"अधिक परिणाम लोड हो रहे है..."},maximumSelected:function(e){var t="आप केवल "+e.maximum+" आइटम का चयन कर सकते हैं";return t},noResults:function(){return"कोई परिणाम नहीं मिला"},searching:function(){return"खोज रहा है..."}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/hr.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hr",[],function(){function e(e){var t=" "+e+" znak";return e%10<5&&e%10>0&&(e%100<5||e%100>19)?e%10>1&&(t+="a"):t+="ova",t}return{errorLoading:function(){return"Preuzimanje nije uspjelo."},inputTooLong:function(t){var n=t.input.length-t.maximum;return"Unesite "+e(n)},inputTooShort:function(t){var n=t.minimum-t.input.length;return"Unesite još "+e(n)},loadingMore:function(){return"Učitavanje rezultata…"},maximumSelected:function(e){return"Maksimalan broj odabranih stavki je "+e.maximum},noResults:function(){return"Nema rezultata"},searching:function(){return"Pretraga…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/hu.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hu",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return"Túl hosszú. "+t+" karakterrel több, mint kellene."},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Túl rövid. Még "+t+" karakter hiányzik."},loadingMore:function(){return"Töltés…"},maximumSelected:function(e){return"Csak "+e.maximum+" elemet lehet kiválasztani."},noResults:function(){return"Nincs találat."},searching:function(){return"Keresés…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/id.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/id",[],function(){return{errorLoading:function(){return"Data tidak boleh diambil."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Hapuskan "+t+" huruf"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Masukkan "+t+" huruf lagi"},loadingMore:function(){return"Mengambil data…"},maximumSelected:function(e){return"Anda hanya dapat memilih "+e.maximum+" pilihan"},noResults:function(){return"Tidak ada data yang sesuai"},searching:function(){return"Mencari…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/is.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/is",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vinsamlegast styttið texta um "+t+" staf";return t<=1?n:n+"i"},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vinsamlegast skrifið "+t+" staf";return t>1&&(n+="i"),n+=" í viðbót",n},loadingMore:function(){return"Sæki fleiri niðurstöður…"},maximumSelected:function(e){return"Þú getur aðeins valið "+e.maximum+" atriði"},noResults:function(){return"Ekkert fannst"},searching:function(){return"Leita…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/it.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/it",[],function(){return{errorLoading:function(){return"I risultati non possono essere caricati."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Per favore cancella "+t+" caratter";return t!==1?n+="i":n+="e",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Per favore inserisci "+t+" o più caratteri";return n},loadingMore:function(){return"Caricando più risultati…"},maximumSelected:function(e){var t="Puoi selezionare solo "+e.maximum+" element";return e.maximum!==1?t+="i":t+="o",t},noResults:function(){return"Nessun risultato trovato"},searching:function(){return"Sto cercando…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/ja.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ja",[],function(){return{errorLoading:function(){return"結果が読み込まれませんでした"},inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" 文字を削除してください";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="少なくとも "+t+" 文字を入力してください";return n},loadingMore:function(){return"読み込み中…"},maximumSelected:function(e){var t=e.maximum+" 件しか選択できません";return t},noResults:function(){return"対象が見つかりません"},searching:function(){return"検索しています…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/km.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/km",[],function(){return{errorLoading:function(){return"មិនអាចទាញយកទិន្នន័យ"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="សូមលុបចេញ "+t+" អក្សរ";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="សូមបញ្ចូល"+t+" អក្សរ រឺ ច្រើនជាងនេះ";return n},loadingMore:function(){return"កំពុងទាញយកទិន្នន័យបន្ថែម..."},maximumSelected:function(e){var t="អ្នកអាចជ្រើសរើសបានតែ "+e.maximum+" ជម្រើសប៉ុណ្ណោះ";return t},noResults:function(){return"មិនមានលទ្ធផល"},searching:function(){return"កំពុងស្វែងរក..."}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/ko.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ko",[],function(){return{errorLoading:function(){return"결과를 불러올 수 없습니다."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="너무 깁니다. "+t+" 글자 지워주세요.";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="너무 짧습니다. "+t+" 글자 더 입력해주세요.";return n},loadingMore:function(){return"불러오는 중…"},maximumSelected:function(e){var t="최대 "+e.maximum+"개까지만 선택 가능합니다.";return t},noResults:function(){return"결과가 없습니다."},searching:function(){return"검색 중…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/lt.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/lt",[],function(){function e(e,t,n,r){return e%10===1&&(e%100<11||e%100>19)?t:e%10>=2&&e%10<=9&&(e%100<11||e%100>19)?n:r}return{inputTooLong:function(t){var n=t.input.length-t.maximum,r="Pašalinkite "+n+" simbol";return r+=e(n,"į","ius","ių"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Įrašykite dar "+n+" simbol";return r+=e(n,"į","ius","ių"),r},loadingMore:function(){return"Kraunama daugiau rezultatų…"},maximumSelected:function(t){var n="Jūs galite pasirinkti tik "+t.maximum+" element";return n+=e(t.maximum,"ą","us","ų"),n},noResults:function(){return"Atitikmenų nerasta"},searching:function(){return"Ieškoma…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/lv.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/lv",[],function(){function e(e,t,n,r){return e===11?t:e%10===1?n:r}return{inputTooLong:function(t){var n=t.input.length-t.maximum,r="Lūdzu ievadiet par "+n;return r+=" simbol"+e(n,"iem","u","iem"),r+" mazāk"},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Lūdzu ievadiet vēl "+n;return r+=" simbol"+e(n,"us","u","us"),r},loadingMore:function(){return"Datu ielāde…"},maximumSelected:function(t){var n="Jūs varat izvēlēties ne vairāk kā "+t.maximum;return n+=" element"+e(t.maximum,"us","u","us"),n},noResults:function(){return"Sakritību nav"},searching:function(){return"Meklēšana…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/mk.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/mk",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Ве молиме внесете "+e.maximum+" помалку карактер";return e.maximum!==1&&(n+="и"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Ве молиме внесете уште "+e.maximum+" карактер";return e.maximum!==1&&(n+="и"),n},loadingMore:function(){return"Вчитување резултати…"},maximumSelected:function(e){var t="Можете да изберете само "+e.maximum+" ставк";return e.maximum===1?t+="а":t+="и",t},noResults:function(){return"Нема пронајдено совпаѓања"},searching:function(){return"Пребарување…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/ms.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ms",[],function(){return{errorLoading:function(){return"Keputusan tidak berjaya dimuatkan."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Sila hapuskan "+t+" aksara"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Sila masukkan "+t+" atau lebih aksara"},loadingMore:function(){return"Sedang memuatkan keputusan…"},maximumSelected:function(e){return"Anda hanya boleh memilih "+e.maximum+" pilihan"},noResults:function(){return"Tiada padanan yang ditemui"},searching:function(){return"Mencari…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/nb.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/nb",[],function(){return{errorLoading:function(){return"Kunne ikke hente resultater."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Vennligst fjern "+t+" tegn"},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vennligst skriv inn ";return t>1?n+=" flere tegn":n+=" tegn til",n},loadingMore:function(){return"Laster flere resultater…"},maximumSelected:function(e){return"Du kan velge maks "+e.maximum+" elementer"},noResults:function(){return"Ingen treff"},searching:function(){return"Søker…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/nl.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/nl",[],function(){return{errorLoading:function(){return"De resultaten konden niet worden geladen."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Gelieve "+t+" karakters te verwijderen";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Gelieve "+t+" of meer karakters in te voeren";return n},loadingMore:function(){return"Meer resultaten laden…"},maximumSelected:function(e){var t=e.maximum==1?"kan":"kunnen",n="Er "+t+" maar "+e.maximum+" item";return e.maximum!=1&&(n+="s"),n+=" worden geselecteerd",n},noResults:function(){return"Geen resultaten gevonden…"},searching:function(){return"Zoeken…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/pl.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/pl",[],function(){var e=["znak","znaki","znaków"],t=["element","elementy","elementów"],n=function(t,n){if(t===1)return n[0];if(t>1&&t<=4)return n[1];if(t>=5)return n[2]};return{errorLoading:function(){return"Nie można załadować wyników."},inputTooLong:function(t){var r=t.input.length-t.maximum;return"Usuń "+r+" "+n(r,e)},inputTooShort:function(t){var r=t.minimum-t.input.length;return"Podaj przynajmniej "+r+" "+n(r,e)},loadingMore:function(){return"Trwa ładowanie…"},maximumSelected:function(e){return"Możesz zaznaczyć tylko "+e.maximum+" "+n(e.maximum,t)},noResults:function(){return"Brak wyników"},searching:function(){return"Trwa wyszukiwanie…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/pt-BR.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/pt-BR",[],function(){return{errorLoading:function(){return"Os resultados não puderam ser carregados."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Apague "+t+" caracter";return t!=1&&(n+="es"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Digite "+t+" ou mais caracteres";return n},loadingMore:function(){return"Carregando mais resultados…"},maximumSelected:function(e){var t="Você só pode selecionar "+e.maximum+" ite";return e.maximum==1?t+="m":t+="ns",t},noResults:function(){return"Nenhum resultado encontrado"},searching:function(){return"Buscando…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/pt.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/pt",[],function(){return{errorLoading:function(){return"Os resultados não puderam ser carregados."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Por favor apague "+t+" ";return n+=t!=1?"caracteres":"carácter",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Introduza "+t+" ou mais caracteres";return n},loadingMore:function(){return"A carregar mais resultados…"},maximumSelected:function(e){var t="Apenas pode seleccionar "+e.maximum+" ";return t+=e.maximum!=1?"itens":"item",t},noResults:function(){return"Sem resultados"},searching:function(){return"A procurar…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/ro.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ro",[],function(){return{errorLoading:function(){return"Rezultatele nu au putut fi incărcate."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vă rugăm să ștergeți"+t+" caracter";return t!==1&&(n+="e"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vă rugăm să introduceți "+t+"sau mai multe caractere";return n},loadingMore:function(){return"Se încarcă mai multe rezultate…"},maximumSelected:function(e){var t="Aveți voie să selectați cel mult "+e.maximum;return t+=" element",e.maximum!==1&&(t+="e"),t},noResults:function(){return"Nu au fost găsite rezultate"},searching:function(){return"Căutare…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/ru.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ru",[],function(){function e(e,t,n,r){return e%10<5&&e%10>0&&e%100<5||e%100>20?e%10>1?n:t:r}return{errorLoading:function(){return"Невозможно загрузить результаты"},inputTooLong:function(t){var n=t.input.length-t.maximum,r="Пожалуйста, введите на "+n+" символ";return r+=e(n,"","a","ов"),r+=" меньше",r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Пожалуйста, введите еще хотя бы "+n+" символ";return r+=e(n,"","a","ов"),r},loadingMore:function(){return"Загрузка данных…"},maximumSelected:function(t){var n="Вы можете выбрать не более "+t.maximum+" элемент";return n+=e(t.maximum,"","a","ов"),n},noResults:function(){return"Совпадений не найдено"},searching:function(){return"Поиск…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/sk.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sk",[],function(){var e={2:function(e){return e?"dva":"dve"},3:function(){return"tri"},4:function(){return"štyri"}};return{inputTooLong:function(t){var n=t.input.length-t.maximum;return n==1?"Prosím, zadajte o jeden znak menej":n>=2&&n<=4?"Prosím, zadajte o "+e[n](!0)+" znaky menej":"Prosím, zadajte o "+n+" znakov menej"},inputTooShort:function(t){var n=t.minimum-t.input.length;return n==1?"Prosím, zadajte ešte jeden znak":n<=4?"Prosím, zadajte ešte ďalšie "+e[n](!0)+" znaky":"Prosím, zadajte ešte ďalších "+n+" znakov"},loadingMore:function(){return"Loading more results…"},maximumSelected:function(t){return t.maximum==1?"Môžete zvoliť len jednu položku":t.maximum>=2&&t.maximum<=4?"Môžete zvoliť najviac "+e[t.maximum](!1)+" položky":"Môžete zvoliť najviac "+t.maximum+" položiek"},noResults:function(){return"Nenašli sa žiadne položky"},searching:function(){return"Vyhľadávanie…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/sr-Cyrl.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sr-Cyrl",[],function(){function e(e,t,n,r){return e%10==1&&e%100!=11?t:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?n:r}return{errorLoading:function(){return"Преузимање није успело."},inputTooLong:function(t){var n=t.input.length-t.maximum,r="Обришите "+n+" симбол";return r+=e(n,"","а","а"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Укуцајте бар још "+n+" симбол";return r+=e(n,"","а","а"),r},loadingMore:function(){return"Преузимање још резултата…"},maximumSelected:function(t){var n="Можете изабрати само "+t.maximum+" ставк";return n+=e(t.maximum,"у","е","и"),n},noResults:function(){return"Ништа није пронађено"},searching:function(){return"Претрага…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/sr.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sr",[],function(){function e(e,t,n,r){return e%10==1&&e%100!=11?t:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?n:r}return{errorLoading:function(){return"Preuzimanje nije uspelo."},inputTooLong:function(t){var n=t.input.length-t.maximum,r="Obrišite "+n+" simbol";return r+=e(n,"","a","a"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Ukucajte bar još "+n+" simbol";return r+=e(n,"","a","a"),r},loadingMore:function(){return"Preuzimanje još rezultata…"},maximumSelected:function(t){var n="Možete izabrati samo "+t.maximum+" stavk";return n+=e(t.maximum,"u","e","i"),n},noResults:function(){return"Ništa nije pronađeno"},searching:function(){return"Pretraga…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/sv.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sv",[],function(){return{errorLoading:function(){return"Resultat kunde inte laddas."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vänligen sudda ut "+t+" tecken";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vänligen skriv in "+t+" eller fler tecken";return n},loadingMore:function(){return"Laddar fler resultat…"},maximumSelected:function(e){var t="Du kan max välja "+e.maximum+" element";return t},noResults:function(){return"Inga träffar"},searching:function(){return"Söker…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/th.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/th",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="โปรดลบออก "+t+" ตัวอักษร";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="โปรดพิมพ์เพิ่มอีก "+t+" ตัวอักษร";return n},loadingMore:function(){return"กำลังค้นข้อมูลเพิ่ม…"},maximumSelected:function(e){var t="คุณสามารถเลือกได้ไม่เกิน "+e.maximum+" รายการ";return t},noResults:function(){return"ไม่พบข้อมูล"},searching:function(){return"กำลังค้นข้อมูล…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/tr.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/tr",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" karakter daha girmelisiniz";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="En az "+t+" karakter daha girmelisiniz";return n},loadingMore:function(){return"Daha fazla…"},maximumSelected:function(e){var t="Sadece "+e.maximum+" seçim yapabilirsiniz";return t},noResults:function(){return"Sonuç bulunamadı"},searching:function(){return"Aranıyor…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/uk.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/uk",[],function(){function e(e,t,n,r){return e%100>10&&e%100<15?r:e%10===1?t:e%10>1&&e%10<5?n:r}return{errorLoading:function(){return"Неможливо завантажити результати"},inputTooLong:function(t){var n=t.input.length-t.maximum;return"Будь ласка, видаліть "+n+" "+e(t.maximum,"літеру","літери","літер")},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Будь ласка, введіть "+t+" або більше літер"},loadingMore:function(){return"Завантаження інших результатів…"},maximumSelected:function(t){return"Ви можете вибрати лише "+t.maximum+" "+e(t.maximum,"пункт","пункти","пунктів")},noResults:function(){return"Нічого не знайдено"},searching:function(){return"Пошук…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/vi.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/vi",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vui lòng nhập ít hơn "+t+" ký tự";return t!=1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vui lòng nhập nhiều hơn "+t+' ký tự"';return n},loadingMore:function(){return"Đang lấy thêm kết quả…"},maximumSelected:function(e){var t="Chỉ có thể chọn được "+e.maximum+" lựa chọn";return t},noResults:function(){return"Không tìm thấy kết quả"},searching:function(){return"Đang tìm…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/zh-CN.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/zh-CN",[],function(){return{errorLoading:function(){return"无法载入结果。"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="请删除"+t+"个字符";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="请再输入至少"+t+"个字符";return n},loadingMore:function(){return"载入更多结果…"},maximumSelected:function(e){var t="最多只能选择"+e.maximum+"个项目";return t},noResults:function(){return"未找到结果"},searching:function(){return"搜索中…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/zh-TW.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/zh-TW",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="請刪掉"+t+"個字元";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="請再輸入"+t+"個字元";return n},loadingMore:function(){return"載入中…"},maximumSelected:function(e){var t="你只能選擇最多"+e.maximum+"項";return t},noResults:function(){return"沒有找到相符的項目"},searching:function(){return"搜尋中…"}}}),{define:e.define,require:e.require}})(); -------------------------------------------------------------------------------- /static/admin/js/vendor/xregexp/LICENSE-XREGEXP.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2007-2012 Steven Levithan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /static/css/aboutUS.css: -------------------------------------------------------------------------------- 1 | @font-face 2 | { 3 | font-family: spFont; 4 | src: url(../font/fz.TTF); 5 | } 6 | .main{ 7 | /*box-shadow: 5px 5px 2px 0px rgba(29,42,114,0.15);*/ 8 | background-size: 100% 100%; 9 | background-repeat: no-repeat; 10 | } 11 | 12 | .main_title{ 13 | width: 74px; 14 | height: 57px; 15 | /* margin-top: 94px; */ 16 | padding-top: 14px; 17 | margin: auto; 18 | text-align: center; 19 | } 20 | -------------------------------------------------------------------------------- /static/css/articleAnalyze.css: -------------------------------------------------------------------------------- 1 | 2 | .main{ 3 | background-size: 100% 100%; 4 | background-repeat: no-repeat; 5 | } 6 | @font-face 7 | { 8 | font-family: spFont; 9 | src: url(../font/fz.TTF); 10 | } 11 | 12 | .textarea{ 13 | padding-top: 50px; 14 | } 15 | textarea{ 16 | height: 310px; 17 | width:86%; 18 | margin-left: 7%; 19 | resize: none; 20 | outline: none; 21 | border: none; 22 | } 23 | 24 | .button{ 25 | height: 31px; 26 | width: 112px; 27 | border: none; 28 | margin-top: 70px; 29 | margin-left: 87px; 30 | } 31 | 32 | .tag{ 33 | margin-top: 50px; 34 | margin-left: 135px; 35 | } 36 | .tag ul li{ 37 | list-style: none; 38 | float: left; 39 | font-size: 30px; 40 | margin-left: 25px; 41 | font-family: spFont; 42 | color: #282c80; 43 | font-weight: bold; 44 | } -------------------------------------------------------------------------------- /static/css/hotNews.css: -------------------------------------------------------------------------------- 1 | @font-face 2 | { 3 | font-family: spFont; 4 | src: url(../font/fz.TTF); 5 | } 6 | .main .info_list li{ 7 | list-style: none; 8 | width: 80%; 9 | } 10 | .page{ 11 | float: left; 12 | width: 15px; 13 | margin-left: 5px; 14 | 15 | } 16 | .page a{ 17 | text-decoration: none; 18 | } 19 | 20 | .main_window_top{ 21 | padding-top: 35px; 22 | width: 98%;; 23 | font-family: spFont; 24 | } 25 | .news_title{ 26 | margin-left: 50px; 27 | font-size: 25px; 28 | color: red; 29 | } 30 | .classify{ 31 | margin-left: 40%; 32 | font-size: 25px; 33 | color: blue; 34 | } 35 | .info_classify { 36 | /*float: right;*/ 37 | margin-left: 18%; 38 | } 39 | .line{ 40 | width: 100%; 41 | background-repeat: no-repeat; 42 | background-size: 100% 100%; 43 | clip: rect(0, 0 ,50px, 50px); 44 | } 45 | 46 | .info_list{ 47 | margin-top: 50px; 48 | width: 98%; 49 | } 50 | .info_list li{ 51 | margin-top: 18px; 52 | font-size: 18px; 53 | width: 1608px; 54 | font-family: spFont; 55 | } 56 | 57 | .info_list li a{ 58 | margin-left: 40px; 59 | display:inline-block; 60 | width:500px; 61 | } 62 | 63 | .main{ 64 | margin-top: 80px; 65 | margin-left: 5%; 66 | height: 640px; 67 | width: 91%; 68 | 69 | } 70 | 71 | .pagination{ 72 | padding: 0px; 73 | list-style: none; 74 | width: 270px; 75 | height: 30px; 76 | margin:0 auto; 77 | } 78 | 79 | .pagination li a{ 80 | font-size: 18px; 81 | } 82 | /*.info_block {*/ 83 | /*text-align: center;*/ 84 | /*width: 600px;*/ 85 | /*margin: 45px auto;*/ 86 | /*}*/ 87 | 88 | 89 | .pageone{ 90 | width:100%; 91 | height: 30px; 92 | } 93 | 94 | .time{ 95 | margin-left: 300px; 96 | font-size: 25px; 97 | color: blue; 98 | } 99 | .info_time{ 100 | margin-left: 290px; 101 | } -------------------------------------------------------------------------------- /static/css/main.css: -------------------------------------------------------------------------------- 1 | body{ 2 | margin-top: 0px; 3 | background-color: #ebebeb; 4 | margin: auto; 5 | width: 100%; 6 | max-width: 1920px; 7 | min-width: 1600px; 8 | } 9 | 10 | .banner{ 11 | margin: auto; 12 | height: 640px; 13 | width: 100%; 14 | background-repeat: no-repeat; 15 | background-position:center top; 16 | } 17 | 18 | .logo{ 19 | font-size: 24px; 20 | color: white; 21 | font-family: Gadugi; 22 | margin-left: 2.604%; 23 | padding-top: 5px; 24 | } 25 | .address{ 26 | margin-top: -25px; 27 | margin-left: 92.7%; 28 | font-size: 16px; 29 | color: white; 30 | font-family: Gadugi; 31 | } 32 | 33 | .Category{ 34 | margin-top: 25px; 35 | margin-left: 2.604%; 36 | height: 24px; 37 | width: 26px; 38 | background-size: 24px 26px; 39 | } 40 | .nav{ 41 | float: left; 42 | margin-top: -39px; 43 | } 44 | .nav ul li{ 45 | font-family: 微软雅黑; 46 | list-style: none; 47 | float: left; 48 | color: white; 49 | font-size: 22px; 50 | margin-left: 70px; 51 | } 52 | 53 | .nav ul li a{ 54 | color: white; 55 | text-decoration: none; 56 | } 57 | .nav ul li a:hover { 58 | color: #c8c8c8; 59 | } 60 | 61 | .navigationBar2{ 62 | margin-top: 453px; 63 | width: 1000px; 64 | height: 200px; 65 | margin: 453px auto; 66 | } 67 | 68 | .nav2_1{ 69 | float: left; 70 | margin-left: 65px; 71 | } 72 | .nav2_2{ 73 | float: left; 74 | margin-left: 132px; 75 | } 76 | 77 | .nav2_3{ 78 | float: left; 79 | margin-left: 117px; 80 | } 81 | .nav_2_1_1{ 82 | font-size: 24px; 83 | color: #fff; 84 | font-family: 微软雅黑; 85 | } 86 | .nav_2_1_2{ 87 | margin-top: -17px; 88 | font-size: 16px; 89 | color: #fff; 90 | font-family: 黑体; 91 | } 92 | .main{ 93 | margin: 80px auto; 94 | height: 640px; 95 | width: 91%; 96 | background-color: white; 97 | box-shadow: 5px 5px 2px 0px rgba(29,42,114,0.15); 98 | } 99 | .foot{ 100 | margin-top: 80px; 101 | height: 150px; 102 | /*border:1px solid red;*/ 103 | width: 800px; 104 | margin: auto; 105 | } 106 | 107 | 108 | 109 | .foot p{ 110 | text-align: center; 111 | } 112 | 113 | .foot_1{ 114 | margin-top: 50px; 115 | text-align: center; 116 | 117 | } 118 | 119 | .foot_1 a{ 120 | text-decoration: none; 121 | } -------------------------------------------------------------------------------- /static/css/main_back.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/static/css/main_back.css -------------------------------------------------------------------------------- /static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/static/favicon.ico -------------------------------------------------------------------------------- /static/font/fz.TTF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/static/font/fz.TTF -------------------------------------------------------------------------------- /static/imgs/Category.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/static/imgs/Category.png -------------------------------------------------------------------------------- /static/imgs/aboutUS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/static/imgs/aboutUS.png -------------------------------------------------------------------------------- /static/imgs/banner_about_us.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/static/imgs/banner_about_us.png -------------------------------------------------------------------------------- /static/imgs/banner_atricle_analyzie.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/static/imgs/banner_atricle_analyzie.png -------------------------------------------------------------------------------- /static/imgs/banner_hot_news.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/static/imgs/banner_hot_news.png -------------------------------------------------------------------------------- /static/imgs/button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/static/imgs/button.png -------------------------------------------------------------------------------- /static/imgs/line.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/static/imgs/line.png -------------------------------------------------------------------------------- /static/imgs/wenzi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/static/imgs/wenzi.png -------------------------------------------------------------------------------- /templates/aboutUS.html: -------------------------------------------------------------------------------- 1 | 2 | {% load static %} 3 | 4 | 5 | 6 | {% block title %} About Us {% endblock %} 7 | 8 | 10 | 40 | 41 | 42 | 43 | {% block mycss %} 44 | 45 | {% endblock %} 46 | 47 | 48 | {% block banner %} 49 | 80 | {% endblock %} 81 |
    82 | {% block window %} 83 |
    84 |
    85 |

    关于我们

    86 |

    ABOUT US

    87 |
    88 |
    89 |

    团队简介:延安大学三人组是一支由拥有UI、前段、后台开发组等能力的同学组成的创新创业团队,三名同学均来自于延安大学数学与计算机科学学院,我们在专业素养和思想素养上都对自己有着严格的要求。本次参赛目标旨在锻炼自我,培养团队创业精神。

    90 |

    团队意义:发扬延安精神,努力拼搏向上,结合所学知识,进行实践创新,不断储备知识技能,不断丰富人生阅历。

    91 |
    92 |
    93 |

    项目简介:关于NLP(自然语言处理)技术的新闻分类系统和文字分析系统项目是为了提高新闻 质量和减少新闻重复率而创立的项目。项目主要技术采用神经网络,其算法具有学习规则简单及强大的学习能力的优点,从而使系统具有良好的稳定性和准确性。系统分为两个子功能——新闻热点和洞悉文字,新闻热点主要为用户提供简单明了的新闻浏览品台,用户按照系统分类来选择当前的热点新闻;洞悉文字做为模型的扩展功能,用户可自行输入文字,系统将会分析出文字的内容分类,并呈现给用户。

    94 |
    95 | 96 |
    97 | {% endblock %} 98 |
    99 | 100 | 101 | 117 | 118 | 119 | 120 | {% block myjs %} 121 | 122 | {% endblock %} -------------------------------------------------------------------------------- /templates/articleAnalyze.html: -------------------------------------------------------------------------------- 1 | {% extends 'aboutUS.html' %} 2 | {% load static %} 3 | {% block title %} Article Analyze{% endblock %} 4 | {% block mycss %} 5 | 6 | {% endblock %} 7 | 8 | {% block banner %} 9 | 42 | {% endblock %} 43 | 44 | {% block window %} 45 |
    46 |
    47 |
    48 | 55 |
    56 | {% csrf_token %} 57 | 58 |
    59 |
    60 |
      61 |
    • 62 | 范文1 63 | 范文2 64 | 范文3 65 | 范文4 66 | 范文5 67 | 范文6 68 | 范文7 69 |
    • 70 |
    71 |
    72 |
    73 | {# 这里循环输出先调整好#} 74 |
      75 | 76 | {% for foo in classify %} 77 |
    • {{ foo }}
    • 78 | {% endfor %} 79 | 80 | 81 |
    82 |
    83 |
    84 | 85 | {% endblock %} 86 | {% block myjs %} 87 | 89 | {% endblock %} -------------------------------------------------------------------------------- /templates/hotNews.html: -------------------------------------------------------------------------------- 1 | {% extends 'aboutUS.html' %} 2 | {% load static %} 3 | {% block title %} Hot News{% endblock %} 4 | {% block mycss %} 5 | 6 | {% endblock %} 7 | {% block banner %} 8 | 40 | {% endblock %} 41 | 42 | {% block window %} 43 |
    44 |
    45 |
    新闻热点 类别时间
    46 |
      47 | {% for item in cus_list %} 48 |
    • {{ item.title }}{{ item.classify }}{{ item.time }}
    • 49 |
      50 | {% endfor %} 51 |
    52 |
    53 |
    54 |
      55 | 56 | {% if cus_list.has_previous %} 57 |
    • 58 | 59 | 60 | 61 |
    • 62 | {% endif %} 63 | {% for pg in cus_list.paginator.page_range %} 64 | {% if cus_list.number == pg %} 65 |
    • 66 | {{ pg }} 67 |
    • 68 | {% else %} 69 |
    • {{ pg }}
    • 70 | {% endif %} 71 | 72 | {% endfor %} 73 | {% if cus_list.has_next %} 74 | 75 |
    • 76 | 77 | 78 | 79 |
    • 80 | {% endif %} 81 | 82 |
    83 |
    84 | 85 |
    86 | {% endblock %} 87 | -------------------------------------------------------------------------------- /text_classification.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Navicat MySQL Data Transfer 3 | 4 | Source Server : classification 5 | Source Server Version : 50721 6 | Source Host : 47.98.96.189:3306 7 | Source Database : text_classification 8 | 9 | Target Server Type : MYSQL 10 | Target Server Version : 50721 11 | File Encoding : 65001 12 | 13 | Date:UTC+3 2020-05-11 09:01:19 14 | */ 15 | 16 | SET FOREIGN_KEY_CHECKS=0; 17 | 18 | -- ---------------------------- 19 | -- Table structure for news_classify 20 | -- ---------------------------- 21 | DROP TABLE IF EXISTS `news_classify`; 22 | CREATE TABLE `news_classify` ( 23 | `classify_id` int(11) NOT NULL AUTO_INCREMENT, 24 | `classify` varchar(10) CHARACTER SET utf8 DEFAULT NULL, 25 | PRIMARY KEY (`classify_id`) 26 | ) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1; 27 | 28 | -- insert classified_dictionary 29 | INSERT INTO `text_classification`.`news_classify` (`classify_id`, `classify`) VALUES ('1', '体育'),('2', '财经'),('3', '房产'),('4','家居'),('5','教育'),('6','科技'),('7','时尚'),('8','时政'),('9','游戏'),('10','娱乐'),('11','股票'),('12','彩票'),('13','社会') 30 | ,('14','星座'); 31 | 32 | -- ---------------------------- 33 | -- Table structure for wangyi_news 34 | -- ---------------------------- 35 | DROP TABLE IF EXISTS `wangyi_news`; 36 | CREATE TABLE `wangyi_news` ( 37 | `news_id` int(11) NOT NULL AUTO_INCREMENT, 38 | `news_title` varchar(600) CHARACTER SET utf8 DEFAULT NULL, 39 | `news_url` varchar(600) DEFAULT NULL, 40 | `news_article` longtext CHARACTER SET utf8, 41 | `insert_time` varchar(11) DEFAULT NULL, 42 | PRIMARY KEY (`news_id`) 43 | ) ENGINE=InnoDB AUTO_INCREMENT=2627 DEFAULT CHARSET=latin1; 44 | 45 | -- ---------------------------- 46 | -- Table structure for wangyi_news_classify 47 | -- ---------------------------- 48 | DROP TABLE IF EXISTS `wangyi_news_classify`; 49 | CREATE TABLE `wangyi_news_classify` ( 50 | `id` int(11) NOT NULL AUTO_INCREMENT, 51 | `news_id` int(11) DEFAULT NULL, 52 | `classify_id` int(11) DEFAULT NULL, 53 | PRIMARY KEY (`id`), 54 | KEY `wangyi_news_classify_ibfk_1` (`news_id`), 55 | KEY `wangyi_news_classify_ibfk_2` (`classify_id`), 56 | CONSTRAINT `wangyi_news_classify_ibfk_1` FOREIGN KEY (`news_id`) REFERENCES `wangyi_news` (`news_id`), 57 | CONSTRAINT `wangyi_news_classify_ibfk_2` FOREIGN KEY (`classify_id`) REFERENCES `news_classify` (`classify_id`) 58 | ) ENGINE=InnoDB AUTO_INCREMENT=2776 DEFAULT CHARSET=latin1; 59 | 60 | -- ---------------------------- 61 | -- View structure for view_news_classify 62 | -- ---------------------------- 63 | DROP VIEW IF EXISTS `view_news_classify`; 64 | CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `view_news_classify` AS select `wangyi_news_classify`.`news_id` AS `news_id`,`wangyi_news`.`news_title` AS `news_title`,`wangyi_news`.`news_url` AS `news_url`,`wangyi_news`.`insert_time` AS `insert_time`,`news_classify`.`classify` AS `classify` from ((`wangyi_news` join `news_classify`) join `wangyi_news_classify`) where ((`wangyi_news`.`news_id` = `wangyi_news_classify`.`news_id`) and (`news_classify`.`classify_id` = `wangyi_news_classify`.`classify_id`)) order by `wangyi_news`.`insert_time` desc ; 65 | -------------------------------------------------------------------------------- /text_classification/.idea/dictionaries/danda.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /text_classification/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | -------------------------------------------------------------------------------- /text_classification/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /text_classification/.idea/text_classification.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 12 | -------------------------------------------------------------------------------- /text_classification/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 dzkang 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /text_classification/__pycache__/client.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/text_classification/__pycache__/client.cpython-36.pyc -------------------------------------------------------------------------------- /text_classification/__pycache__/cnn_model.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/text_classification/__pycache__/cnn_model.cpython-36.pyc -------------------------------------------------------------------------------- /text_classification/__pycache__/connect_mysql.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/text_classification/__pycache__/connect_mysql.cpython-36.pyc -------------------------------------------------------------------------------- /text_classification/__pycache__/wangyinews_crawler.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/text_classification/__pycache__/wangyinews_crawler.cpython-36.pyc -------------------------------------------------------------------------------- /text_classification/checkpoints/textcnn/best_validation.data-00000-of-00001: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/text_classification/checkpoints/textcnn/best_validation.data-00000-of-00001 -------------------------------------------------------------------------------- /text_classification/checkpoints/textcnn/best_validation.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/text_classification/checkpoints/textcnn/best_validation.index -------------------------------------------------------------------------------- /text_classification/checkpoints/textcnn/best_validation.meta: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/text_classification/checkpoints/textcnn/best_validation.meta -------------------------------------------------------------------------------- /text_classification/checkpoints/textcnn/checkpoint: -------------------------------------------------------------------------------- 1 | model_checkpoint_path: "best_validation" 2 | all_model_checkpoint_paths: "best_validation" 3 | -------------------------------------------------------------------------------- /text_classification/client.py: -------------------------------------------------------------------------------- 1 | from socket import * 2 | 3 | 4 | def send_info(senddata): 5 | address='127.0.0.1' #服务器的ip地址 6 | port=12345 #服务器的端口号 7 | buffsize=8192 #接收数据的缓存大小 8 | s = socket(AF_INET, SOCK_STREAM) 9 | s.connect((address,port)) 10 | s.send(senddata.encode()) 11 | recvdata=s.recv(buffsize).decode('utf-8') 12 | s.close() 13 | return recvdata 14 | -------------------------------------------------------------------------------- /text_classification/cnn_model.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | import tensorflow as tf 4 | 5 | 6 | class TCNNConfig(object): 7 | """CNN配置参数""" 8 | 9 | embedding_dim = 64 # 词向量维度 10 | seq_length = 600 # 序列长度 11 | num_classes = 14 # 类别数 12 | num_filters = 512 # 卷积核数目 13 | kernel_size = 9 # 卷积核尺寸 14 | vocab_size = 6000 # 词汇表达小 15 | 16 | hidden_dim = 128 # 全连接层神经元 17 | 18 | dropout_keep_prob = 0.6 # dropout保留比例 19 | learning_rate = 1e-3 # 学习率 20 | 21 | batch_size = 128 # 每批训练大小 22 | num_epochs = 10 # 总迭代轮次 23 | 24 | print_per_batch = 1000 # 每多少轮输出一次结果 25 | save_per_batch = 10 # 每多少轮存入tensorboard 26 | 27 | 28 | class TextCNN(object): 29 | """文本分类,CNN模型""" 30 | 31 | def __init__(self, config): 32 | self.config = config 33 | 34 | # 三个待输入的数据 35 | self.input_x = tf.placeholder(tf.int32, [None, self.config.seq_length], name='input_x') 36 | self.input_y = tf.placeholder(tf.float32, [None, self.config.num_classes], name='input_y') 37 | self.keep_prob = tf.placeholder(tf.float32, name='keep_prob') 38 | 39 | self.cnn() 40 | 41 | def cnn(self): 42 | """CNN模型""" 43 | # 词向量映射 44 | with tf.device('/cpu:0'): 45 | embedding = tf.get_variable('embedding', [self.config.vocab_size, self.config.embedding_dim]) 46 | embedding_inputs = tf.nn.embedding_lookup(embedding, self.input_x) 47 | 48 | with tf.name_scope("cnn"): 49 | # CNN layer 50 | conv = tf.layers.conv1d(embedding_inputs, self.config.num_filters, self.config.kernel_size, name='conv') 51 | # global max pooling layer 52 | gmp = tf.reduce_max(conv, reduction_indices=[1], name='gmp') 53 | 54 | with tf.name_scope("score"): 55 | # 全连接层,后面接dropout以及relu激活 56 | fc = tf.layers.dense(gmp, self.config.hidden_dim, name='fc1') 57 | fc = tf.contrib.layers.dropout(fc, self.keep_prob) 58 | fc = tf.nn.relu(fc) 59 | 60 | # 分类器 61 | self.logits = tf.layers.dense(fc, self.config.num_classes, name='fc2') 62 | self.y_pred_cls = tf.argmax(tf.nn.softmax(self.logits), 1) # 预测类别 63 | 64 | with tf.name_scope("optimize"): 65 | # 损失函数,交叉熵 66 | cross_entropy = tf.nn.softmax_cross_entropy_with_logits(logits=self.logits, labels=self.input_y) 67 | self.loss = tf.reduce_mean(cross_entropy) 68 | # 优化器 69 | self.optim = tf.train.AdamOptimizer(learning_rate=self.config.learning_rate).minimize(self.loss) 70 | 71 | with tf.name_scope("accuracy"): 72 | # 准确率 73 | correct_pred = tf.equal(tf.argmax(self.input_y, 1), self.y_pred_cls) 74 | self.acc = tf.reduce_mean(tf.cast(correct_pred, tf.float32)) 75 | -------------------------------------------------------------------------------- /text_classification/connect_mysql.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # encoding: utf-8 4 | 5 | ''' 6 | 7 | @author: Zhao Chi 8 | 9 | @contact: Vectors@aliyun.com 10 | 11 | @software: PyCharm 12 | 13 | @file: connect_mysql.py 14 | 15 | @time: 2018/4/10 0:13 16 | 17 | @desc: 18 | 19 | ''' 20 | # 导入: 21 | from sqlalchemy import Column, create_engine, ForeignKey 22 | from sqlalchemy.types import String,Integer,VARCHAR,TEXT 23 | from sqlalchemy.orm import sessionmaker 24 | from sqlalchemy.ext.declarative import declarative_base 25 | # 创建对象的基类: 26 | Base = declarative_base() 27 | 28 | 29 | # 定义表对象: 30 | class wangyi_news(Base): 31 | ''' 32 | wangyi_news:存放爬虫爬取的数据 33 | ''' 34 | # 表的名字: 35 | __tablename__ = 'wangyi_news' 36 | # 表的结构: 37 | news_id = Column(Integer, primary_key=True) 38 | news_title = Column(VARCHAR(600)) 39 | news_url = Column(VARCHAR(600)) 40 | news_article = Column(TEXT) 41 | insert_time = Column(VARCHAR(11)) 42 | 43 | 44 | class news_classify(Base): 45 | ''' 46 | news_classify:存放新闻的种类以及新闻id,固定的,不更新 47 | ''' 48 | # 表的名字 49 | __tablename__ = 'news_classify' 50 | # 表的结构 51 | classify_id = Column(Integer, primary_key=True) 52 | classify = Column(VARCHAR(10)) 53 | 54 | 55 | class wangyi_news_classify(Base): 56 | ''' 57 | wangyi_news_classify:存放经过程序分类后的结果 58 | ''' 59 | __tablename__ = 'wangyi_news_classify' 60 | id = Column(Integer, primary_key=True) 61 | news_id = Column(Integer, ForeignKey(wangyi_news.news_id)) # 外键 62 | classify_id = Column(Integer, ForeignKey(news_classify.classify_id)) # 外键 63 | 64 | 65 | # 定义视图 66 | class view_news_classify(Base): 67 | ''' 68 | view_news_classify:通过以下sql语句 69 | create view view_news_classify AS 70 | select wangyi_news_classify.news_id,news_title,news_url,insert_time,classify 71 | from wangyi_news,news_classify,wangyi_news_classify 72 | where wangyi_news.news_id = wangyi_news_classify.news_id 73 | and news_classify.classify_id = wangyi_news_classify.classify_id 74 | order by insert_time desc 75 | 创建的视图 76 | ''' 77 | # 视图名字 78 | __tablename__ = 'view_news_classify' 79 | # 视图结构 80 | news_id = Column(Integer, primary_key=True) 81 | news_title = Column(VARCHAR(600)) 82 | insert_time = Column(VARCHAR(11)) 83 | classify = Column(VARCHAR(10)) 84 | news_url = Column(VARCHAR(600)) 85 | 86 | 87 | 88 | # 定义字典 加快读取速度 89 | classify_dict = { 90 | 91 | '体育': 1, 92 | '财经': 2, 93 | '房产': 3, 94 | '家居': 4, 95 | '教育': 5, 96 | '科技': 6, 97 | '时尚': 7, 98 | '时政': 8, 99 | '游戏': 9, 100 | '娱乐': 10, 101 | '股票': 11, 102 | '彩票': 12, 103 | '社会': 13, 104 | '星座': 14 105 | } 106 | 107 | engine = create_engine('mysql+mysqlconnector://root:password@xx.xx.xx.xx/text_classification') 108 | # 创建DBSession类型: 109 | DBSession = sessionmaker(bind=engine) 110 | 111 | def insert_wangyinews_into_mysql(table_name, news_title, news_url, news_article, insert_time): 112 | ''' 113 | 114 | :param table_name:表名 115 | :param news_title:新闻标题 116 | :param news_url:新闻地址 117 | :param news_article:新闻文章内容 118 | :param insert_time:将新闻插入数据库的时间 119 | :return: 120 | ''' 121 | # 创建session对象: 122 | session = DBSession() 123 | # 创建新new_object对象: 124 | new_object = table_name(news_title=news_title, news_url=news_url, news_article=news_article,insert_time=insert_time) 125 | # 添加到session: 126 | session.add(new_object) 127 | # 提交即保存到数据库: 128 | session.commit() 129 | # 关闭session: 130 | session.close() 131 | def insert_wangyinews_classify_into_mysql(table_name, news_id, classify_id): 132 | ''' 133 | :param table_name:表名 134 | :param news_id:新闻id 135 | :param classify_id:分类id 136 | :return: 137 | ''' 138 | # 创建session对象: 139 | session = DBSession() 140 | # 创建新new_object对象: 141 | new_object = table_name(news_id=news_id, classify_id=classify_id) 142 | # 添加到session: 143 | session.add(new_object) 144 | # 提交即保存到数据库: 145 | session.commit() 146 | # 关闭session: 147 | session.close() 148 | def select_from_mysql(table_name): 149 | ''' 150 | 从表中查询,返回一个query对象 151 | :param table_name: 152 | :return: 153 | ''' 154 | # 创建session对象: 155 | session = DBSession() 156 | query1 = session.query(table_name) 157 | # article_list = [] 158 | # for i in query1.order_by(table_name.news_id.asc()).all(): 159 | # article_list.append(i.news_article) 160 | # session.close() 161 | return query1 162 | 163 | 164 | 165 | 166 | 167 | -------------------------------------------------------------------------------- /text_classification/data/THUCNews/README.md: -------------------------------------------------------------------------------- 1 | **关于数据集** 2 | THUCTC: 一个高效的中文文本分类工具包 3 | 可以去官网下载:(我已经跑完了所有数据集并且已经保存为txt,下载地址见../cnews/readme.md) 4 | http://thuctc.thunlp.org/ -------------------------------------------------------------------------------- /text_classification/data/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/text_classification/data/__init__.py -------------------------------------------------------------------------------- /text_classification/data/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/text_classification/data/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /text_classification/data/__pycache__/cnews_loader.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/text_classification/data/__pycache__/cnews_loader.cpython-36.pyc -------------------------------------------------------------------------------- /text_classification/data/cnews/README.md: -------------------------------------------------------------------------------- 1 | **关于数据集** 2 | - 数据集采用清华大学THUCNews全部数据集 3 | - 链接:https://pan.baidu.com/s/1O8yoF15C6qdzRihvHUUNXQ 密码:0nh3 -------------------------------------------------------------------------------- /text_classification/data/cnews_loader.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | import sys 4 | from collections import Counter 5 | 6 | import numpy as np 7 | import tensorflow.contrib.keras as kr 8 | 9 | if sys.version_info[0] > 2: 10 | is_py3 = True 11 | else: 12 | reload(sys) 13 | sys.setdefaultencoding("utf-8") 14 | is_py3 = False 15 | 16 | 17 | def native_word(word, encoding='utf-8'): 18 | """如果在python2下面使用python3训练的模型,可考虑调用此函数转化一下字符编码""" 19 | if not is_py3: 20 | return word.encode(encoding) 21 | else: 22 | return word 23 | 24 | 25 | def native_content(content): 26 | if not is_py3: 27 | return content.decode('utf-8') 28 | else: 29 | return content 30 | 31 | 32 | def open_file(filename, mode='r'): 33 | """ 34 | 常用文件操作,可在python2和python3间切换. 35 | mode: 'r' or 'w' for read or write 36 | """ 37 | if is_py3: 38 | return open(filename, mode, encoding='utf-8', errors='ignore') 39 | else: 40 | return open(filename, mode) 41 | 42 | 43 | def read_file(filename): 44 | """读取文件数据""" 45 | contents, labels = [], [] 46 | with open_file(filename) as f: 47 | for line in f: 48 | try: 49 | label, content = line.strip().split('\t') 50 | if content: 51 | contents.append(list(native_content(content))) 52 | labels.append(native_content(label)) 53 | except: 54 | pass 55 | return contents, labels 56 | 57 | 58 | def build_vocab(train_dir, vocab_dir, vocab_size=5000): 59 | """根据训练集构建词汇表,存储""" 60 | data_train, _ = read_file(train_dir) 61 | 62 | all_data = [] 63 | for content in data_train: 64 | all_data.extend(content) 65 | 66 | counter = Counter(all_data) 67 | count_pairs = counter.most_common(vocab_size - 1) 68 | words, _ = list(zip(*count_pairs)) 69 | # 添加一个 来将所有文本pad为同一长度 70 | words = [''] + list(words) 71 | open_file(vocab_dir, mode='w').write('\n'.join(words) + '\n') 72 | 73 | 74 | def read_vocab(vocab_dir): 75 | """读取词汇表""" 76 | # words = open_file(vocab_dir).read().strip().split('\n') 77 | with open_file(vocab_dir) as fp: 78 | # 如果是py2 则每个值都转化为unicode 79 | words = [native_content(_.strip()) for _ in fp.readlines()] 80 | word_to_id = dict(zip(words, range(len(words)))) 81 | return words, word_to_id 82 | 83 | 84 | def read_category(): 85 | """读取分类目录,固定""" 86 | categories = ['体育', '财经', '房产', '家居', '教育', '科技', '时尚', '时政', '游戏', '娱乐','股票','彩票','社会','星座'] 87 | 88 | categories = [native_content(x) for x in categories] 89 | 90 | cat_to_id = dict(zip(categories, range(len(categories)))) 91 | 92 | return categories, cat_to_id 93 | 94 | 95 | def to_words(content, words): 96 | """将id表示的内容转换为文字""" 97 | return ''.join(words[x] for x in content) 98 | 99 | 100 | def process_file(filename, word_to_id, cat_to_id, max_length=600): 101 | """将文件转换为id表示""" 102 | contents, labels = read_file(filename) 103 | 104 | data_id, label_id = [], [] 105 | for i in range(len(contents)): 106 | data_id.append([word_to_id[x] for x in contents[i] if x in word_to_id]) 107 | label_id.append(cat_to_id[labels[i]]) 108 | 109 | # 使用keras提供的pad_sequences来将文本pad为固定长度 110 | x_pad = kr.preprocessing.sequence.pad_sequences(data_id, max_length) 111 | y_pad = kr.utils.to_categorical(label_id, num_classes=len(cat_to_id)) # 将标签转换为one-hot表示 112 | 113 | return x_pad, y_pad 114 | 115 | 116 | def batch_iter(x, y, batch_size=64): 117 | """生成批次数据""" 118 | data_len = len(x) 119 | num_batch = int((data_len - 1) / batch_size) + 1 120 | 121 | indices = np.random.permutation(np.arange(data_len)) 122 | x_shuffle = x[indices] 123 | y_shuffle = y[indices] 124 | 125 | for i in range(num_batch): 126 | start_id = i * batch_size 127 | end_id = min((i + 1) * batch_size, data_len) 128 | yield x_shuffle[start_id:end_id], y_shuffle[start_id:end_id] 129 | -------------------------------------------------------------------------------- /text_classification/helper/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/text_classification/helper/__init__.py -------------------------------------------------------------------------------- /text_classification/helper/cnews_group.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | """ 5 | 将文本整合到 train、test、val 三个文件中 6 | """ 7 | 8 | import os 9 | from pathlib import Path #python3自带 10 | 11 | def _read_file(filename): 12 | """读取一个文件并转换为一行""" 13 | with open(filename, 'r', encoding='utf-8') as f: 14 | return f.read().replace('\n', '').replace('\t', '').replace('\u3000', '') 15 | 16 | def save_file(dirname): 17 | """ 18 | 将多个文件整合并存到3个文件中 19 | dirname: 原数据目录 20 | 文件内容格式: 类别\t内容 21 | """ 22 | f_train = open('data/cnews/cnews.train.txt', 'w', encoding='utf-8') 23 | f_test = open('data/cnews/cnews.test.txt', 'w', encoding='utf-8') 24 | f_val = open('data/cnews/cnews.val.txt', 'w', encoding='utf-8') 25 | for category in os.listdir(dirname): # 分类目录 26 | cat_dir = os.path.join(dirname, category) 27 | if not os.path.isdir(cat_dir): 28 | continue 29 | files = os.listdir(cat_dir) 30 | count = 0 31 | data_num = len(list(Path(cat_dir).iterdir())) #读取当前目录下的文件总数 32 | for cur_file in files: 33 | filename = os.path.join(cat_dir, cur_file) 34 | content = _read_file(filename) 35 | if count < int(data_num*0.7): 36 | f_train.write(category + '\t' + content + '\n') 37 | elif count < int(data_num*0.85): 38 | f_test.write(category + '\t' + content + '\n') 39 | else: 40 | f_val.write(category + '\t' + content + '\n') 41 | count += 1 42 | 43 | print('Finished:', category) 44 | 45 | f_train.close() 46 | f_test.close() 47 | f_val.close() 48 | 49 | 50 | if __name__ == '__main__': 51 | save_file('data/thucnews') 52 | print(len(open('data/cnews/cnews.train.txt', 'r', encoding='utf-8').readlines())) 53 | print(len(open('data/cnews/cnews.test.txt', 'r', encoding='utf-8').readlines())) 54 | print(len(open('data/cnews/cnews.val.txt', 'r', encoding='utf-8').readlines())) 55 | -------------------------------------------------------------------------------- /text_classification/images/cnn_architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/text_classification/images/cnn_architecture.png -------------------------------------------------------------------------------- /text_classification/images/news_classify.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/text_classification/images/news_classify.png -------------------------------------------------------------------------------- /text_classification/images/text_analysis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/text_classification/images/text_analysis.png -------------------------------------------------------------------------------- /text_classification/predict_mysql.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # encoding: utf-8 4 | 5 | ''' 6 | 7 | @author: Zhao Chi 8 | 9 | @contact: Vectors@aliyun.com 10 | 11 | @software: PyCharm 12 | 13 | @file: predict_mysql.py 14 | 15 | @time: 2018/4/10 9:45 16 | 17 | @desc: 18 | 19 | ''' 20 | 21 | 22 | from __future__ import print_function 23 | 24 | import os 25 | import tensorflow as tf 26 | import tensorflow.contrib.keras as kr 27 | from cnn_model import TCNNConfig, TextCNN 28 | from data.cnews_loader import read_category, read_vocab 29 | import time as time1 30 | from connect_mysql import * 31 | from wangyinews_crawler import * 32 | try: 33 | bool(type(unicode)) 34 | except NameError: 35 | unicode = str 36 | 37 | base_dir = 'data/cnews' 38 | vocab_dir = os.path.join(base_dir, 'cnews.vocab.txt') 39 | 40 | save_dir = 'checkpoints/textcnn' 41 | save_path = os.path.join(save_dir, 'best_validation') # 最佳验证结果保存路径 42 | 43 | 44 | class CnnModel: 45 | def __init__(self): 46 | self.config = TCNNConfig() 47 | self.categories, self.cat_to_id = read_category() 48 | self.words, self.word_to_id = read_vocab(vocab_dir) 49 | self.config.vocab_size = len(self.words) 50 | self.model = TextCNN(self.config) 51 | 52 | self.session = tf.Session() 53 | self.session.run(tf.global_variables_initializer()) 54 | saver = tf.train.Saver() 55 | saver.restore(sess=self.session, save_path=save_path) # 读取保存的模型 56 | 57 | def predict(self, message): 58 | # 支持不论在python2还是python3下训练的模型都可以在2或者3的环境下运行 59 | content = unicode(message) 60 | data = [self.word_to_id[x] for x in content if x in self.word_to_id] 61 | 62 | feed_dict = { 63 | self.model.input_x: kr.preprocessing.sequence.pad_sequences([data], self.config.seq_length), 64 | self.model.keep_prob: 1.0 65 | } 66 | 67 | y_pred_cls = self.session.run(self.model.y_pred_cls, feed_dict=feed_dict) 68 | return self.categories[y_pred_cls[0]] 69 | 70 | 71 | if __name__ == '__main__': 72 | cnn_model = CnnModel() 73 | # 程序整点执行 74 | time1.sleep((int(time1.time() / 3600) + 1) * 3600 - time1.time()) 75 | while True: 76 | 77 | # 获取程序执行时间 78 | start_time = time1.time() 79 | time = wangyinews_crawler() # 爬虫爬取时间 80 | # 获取当前时间格式为2018041018 81 | query1 = select_from_mysql(wangyi_news) # 从wangyi_news中读取对象 82 | # time和爬虫插入的时间同步 暂未定义 83 | for i in query1.order_by(wangyi_news.news_id.asc()).filter(wangyi_news.insert_time==time): 84 | insert_wangyinews_classify_into_mysql(wangyi_news_classify, i.news_id, classify_dict[cnn_model.predict(i.news_article)]) 85 | query2 = select_from_mysql(view_news_classify) # 从视图中读取对象 86 | # 打印分析的内容 部署完成之后注释 87 | # for i in query2.filter(view_news_classify.insert_time==time): 88 | # print(i.news_title, '\t', i.classify, '\t', i.insert_time, '\t', i.news_url) 89 | print(time, "Finished!") 90 | # 获取程序结束时间 91 | end_time = time1.time() 92 | # 每小时爬取一次 93 | time1.sleep(3600-(end_time-start_time)) 94 | -------------------------------------------------------------------------------- /text_classification/server_predict.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # encoding: utf-8 4 | 5 | ''' 6 | 7 | @author: Zhao Chi 8 | 9 | @contact: Vectors@aliyun.com 10 | 11 | @software: PyCharm 12 | 13 | @file: predit_mysql.py 14 | 15 | @time: 2018/4/10 9:45 16 | 17 | @desc: 18 | 19 | ''' 20 | 21 | 22 | from __future__ import print_function 23 | import os 24 | import tensorflow as tf 25 | import tensorflow.contrib.keras as kr 26 | from cnn_model import TCNNConfig, TextCNN 27 | from data.cnews_loader import read_category, read_vocab 28 | from connect_mysql import * 29 | from wangyinews_crawler import * 30 | from socket import * 31 | import threading 32 | import time 33 | try: 34 | bool(type(unicode)) 35 | except NameError: 36 | unicode = str 37 | 38 | 39 | # 配置训练好的模型信息 40 | base_dir = 'data/cnews' 41 | vocab_dir = os.path.join(base_dir, 'cnews.vocab.txt') 42 | 43 | save_dir = 'checkpoints/textcnn' 44 | save_path = os.path.join(save_dir, 'best_validation') # 最佳验证结果保存路径 45 | 46 | # 配置服务器信息 47 | address='127.0.0.1' #监听哪些网络 127.0.0.1是监听本机 0.0.0.0是监听整个网络 48 | port=12345 #监听自己的哪个端口 49 | buffsize=8192 #接收从客户端发来的数据的缓存区大小 50 | s = socket(AF_INET, SOCK_STREAM) 51 | s.bind((address,port)) 52 | s.listen(5) # 最大连接数 53 | 54 | def tcplink(sock,addr): 55 | ''' 56 | 创建tcp链接 57 | :param sock: 58 | :param addr: 59 | :return: 60 | ''' 61 | print('Accept new connection from %s:%s...' % addr) 62 | #sock.send(b'Welcome!') 63 | while True: 64 | recvdata = sock.recv(buffsize) 65 | classified = cnn_model.predict(recvdata.decode('utf-8')) 66 | 67 | time.sleep(1) 68 | if recvdata.decode('utf-8')=='exit' or not recvdata: 69 | break 70 | sock.send(classified.encode('utf-8')) 71 | sock.close() 72 | print('Connection from %s:%s closed.' % addr) 73 | 74 | 75 | class CnnModel: 76 | def __init__(self): 77 | self.config = TCNNConfig() 78 | self.categories, self.cat_to_id = read_category() 79 | self.words, self.word_to_id = read_vocab(vocab_dir) 80 | self.config.vocab_size = len(self.words) 81 | self.model = TextCNN(self.config) 82 | 83 | self.session = tf.Session() 84 | self.session.run(tf.global_variables_initializer()) 85 | saver = tf.train.Saver() 86 | saver.restore(sess=self.session, save_path=save_path) # 读取保存的模型 87 | 88 | def predict(self, message): 89 | # 支持不论在python2还是python3下训练的模型都可以在2或者3的环境下运行 90 | content = unicode(message) 91 | data = [self.word_to_id[x] for x in content if x in self.word_to_id] 92 | 93 | feed_dict = { 94 | self.model.input_x: kr.preprocessing.sequence.pad_sequences([data], self.config.seq_length), 95 | self.model.keep_prob: 1.0 96 | } 97 | 98 | y_pred_cls = self.session.run(self.model.y_pred_cls, feed_dict=feed_dict) 99 | return self.categories[y_pred_cls[0]] 100 | 101 | 102 | if __name__ == '__main__': 103 | cnn_model = CnnModel() 104 | while True: 105 | sock, addr = s.accept() 106 | print('connect from:', addr) 107 | t = threading.Thread(target=tcplink, args=(sock, addr)) # t为新创建的线程 108 | t.start() 109 | 110 | -------------------------------------------------------------------------------- /text_classification/startproject.sh: -------------------------------------------------------------------------------- 1 | nohup python -u /home/www/text_classification/text_classification/predict_mysql.py > /home/www/text_classification/log/predict_mysql.log 2>&1 & 2 | nohup python -u /home/www/text_classification/text_classification/server_predict.py > /home/www/text_classification/log/server_predict.log 2>&1 & 3 | nohup python -u /home/www/text_classification/manage.py runserver 0.0.0.0:80 > /home/www/text_classification/log/websit.log 2>&1 & 4 | -------------------------------------------------------------------------------- /text_classification/tensorboard/textcnn/events.out.tfevents.1523023586.dandan: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/text_classification/tensorboard/textcnn/events.out.tfevents.1523023586.dandan -------------------------------------------------------------------------------- /text_classification/wangyinews_crawler.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # encoding: utf-8 4 | 5 | ''' 6 | 7 | @author: Zhao Chi 8 | 9 | @contact: Vectors@aliyun.com 10 | 11 | @software: PyCharm 12 | 13 | @file: wangyinews_crawler.py 14 | 15 | @time: 2018/4/10 11:19 16 | 17 | @desc: 18 | 19 | ''' 20 | from bs4 import BeautifulSoup 21 | import requests 22 | import re 23 | import datetime 24 | from connect_mysql import * 25 | 26 | 27 | def wangyinews_crawler(): 28 | # 获取当前时间格式为2018041018 29 | time = datetime.datetime.now().strftime("%Y%m%d%H") 30 | url = r'http://news.163.com/special/0001386F/rank_news.html' 31 | # 模拟真实浏览器进行访问 32 | headers = {'User-Agent': 33 | 'Mozilla/5.0 (Windows NT 10.0; WOW64) ' 34 | 'AppleWebKit/537.36 (KHTML, like Gecko) ' 35 | 'Chrome/55.0.2883.87 Safari/537.36'} 36 | response = requests.get(url, headers=headers) 37 | page_html = response.text 38 | 39 | # 将获取到的内容转换成BeautifulSoup格式,并将html.parser作为解析器 40 | soup = BeautifulSoup(page_html, 'html.parser') 41 | 42 | #获取一小时前点击率最高的前20个新闻标题和链接 43 | titles = soup.find('div', 'area-half left').find('div', 'tabContents active').find_all('a', limit=20) 44 | for title in titles: 45 | # 打印爬取到的title和url 46 | #print(str(title.string)) 47 | #print(title.get('href')) 48 | 49 | ''' 50 | news_url:新闻链接 51 | news_html:新闻页网页源代码 52 | ''' 53 | news_url = (str(title.get('href'))) 54 | news_response = requests.get(news_url, headers=headers) 55 | news_html = news_response.text 56 | # 将获取到的内容转换成BeautifulSoup格式,并将html.parser作为解析器 57 | news_soup = BeautifulSoup(news_html, 'html.parser') 58 | # 从网页源代码中找到属于post_text类的div,并将所有p标签内容存入列表news_contents 59 | if news_soup.find('div', 'post_text') is None: # 如果网页丢失,跳出本次循环 60 | continue 61 | news_title = news_soup.find('h1') 62 | contents = news_soup.find('div', 'post_text').find_all('p') 63 | news_contents = [] 64 | for content in contents: 65 | if content.string is not None: 66 | #去掉特殊字符 67 | news_contents.append(re.sub('[\r\n\t ]', '', str(content.string))) 68 | #字符串拼接 69 | news_contents = ''.join(news_contents) 70 | # print(news_contents) 71 | # print(type(news_contents)) 72 | # 将爬取到的数据存入数据库 73 | insert_wangyinews_into_mysql(wangyi_news, str(news_title.string), news_url, news_contents, time) 74 | # print('Finished') 75 | # 返回当前爬取时间 76 | return time -------------------------------------------------------------------------------- /web/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/web/__init__.py -------------------------------------------------------------------------------- /web/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/web/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /web/__pycache__/admin.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/web/__pycache__/admin.cpython-36.pyc -------------------------------------------------------------------------------- /web/__pycache__/apps.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/web/__pycache__/apps.cpython-36.pyc -------------------------------------------------------------------------------- /web/__pycache__/client.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/web/__pycache__/client.cpython-36.pyc -------------------------------------------------------------------------------- /web/__pycache__/connect_mysql.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/web/__pycache__/connect_mysql.cpython-36.pyc -------------------------------------------------------------------------------- /web/__pycache__/models.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/web/__pycache__/models.cpython-36.pyc -------------------------------------------------------------------------------- /web/__pycache__/selectFromDb.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/web/__pycache__/selectFromDb.cpython-36.pyc -------------------------------------------------------------------------------- /web/__pycache__/views.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/web/__pycache__/views.cpython-36.pyc -------------------------------------------------------------------------------- /web/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /web/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class WebConfig(AppConfig): 5 | name = 'web' 6 | -------------------------------------------------------------------------------- /web/client.py: -------------------------------------------------------------------------------- 1 | from socket import * 2 | def sen_info(info): 3 | address='127.0.0.1' #服务器的ip地址 4 | port=12345 #服务器的端口号 5 | buffsize=4096 #接收数据的缓存大小 6 | s = socket(AF_INET, SOCK_STREAM) 7 | s.connect((address,port)) 8 | s.send(info.encode()) 9 | recvdata=s.recv(buffsize).decode('utf-8') 10 | s.close() 11 | return recvdata 12 | -------------------------------------------------------------------------------- /web/connect_mysql.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # encoding: utf-8 4 | 5 | ''' 6 | 7 | @author: Zhao Chi 8 | 9 | @contact: Vectors@aliyun.com 10 | 11 | @software: PyCharm 12 | 13 | @file: connect_mysql.py 14 | 15 | @time: 2018/4/10 0:13 16 | 17 | @desc: 18 | 19 | ''' 20 | # 导入: 21 | from sqlalchemy import Column, create_engine, ForeignKey 22 | from sqlalchemy.types import String,Integer,VARCHAR,TEXT 23 | from sqlalchemy.orm import sessionmaker 24 | from sqlalchemy.ext.declarative import declarative_base 25 | # 创建对象的基类: 26 | Base = declarative_base() 27 | 28 | 29 | # 定义表对象: 30 | class wangyi_news(Base): 31 | ''' 32 | wangyi_news:存放爬虫爬取的数据 33 | ''' 34 | # 表的名字: 35 | __tablename__ = 'wangyi_news' 36 | # 表的结构: 37 | news_id = Column(Integer, primary_key=True) 38 | news_title = Column(VARCHAR(600)) 39 | news_url = Column(VARCHAR(600)) 40 | news_article = Column(TEXT) 41 | insert_time = Column(VARCHAR(11)) 42 | 43 | 44 | class news_classify(Base): 45 | ''' 46 | news_classify:存放新闻的种类以及新闻id,固定的,不更新 47 | ''' 48 | # 表的名字 49 | __tablename__ = 'news_classify' 50 | # 表的结构 51 | classify_id = Column(Integer, primary_key=True) 52 | classify = Column(VARCHAR(10)) 53 | 54 | 55 | class wangyi_news_classify(Base): 56 | ''' 57 | wangyi_news_classify:存放经过程序分类后的结果 58 | ''' 59 | __tablename__ = 'wangyi_news_classify' 60 | id = Column(Integer, primary_key=True) 61 | news_id = Column(Integer, ForeignKey(wangyi_news.news_id)) # 外键 62 | classify_id = Column(Integer, ForeignKey(news_classify.classify_id)) # 外键 63 | 64 | 65 | # 定义视图 66 | class view_news_classify(Base): 67 | ''' 68 | view_news_classify:通过以下sql语句 69 | select wangyi_news_classify.news_id,news_title,news_url,insert_time,classify 70 | from wangyi_news,news_classify,wangyi_news_classify 71 | where wangyi_news.news_id = wangyi_news_classify.news_id 72 | and news_classify.classify_id = wangyi_news_classify.classify_id 73 | order by wangyi_news_classify.news_id asc 74 | 创建的视图 75 | ''' 76 | # 视图名字 77 | __tablename__ = 'view_news_classify' 78 | # 视图结构 79 | news_id = Column(Integer, primary_key=True) 80 | news_title = Column(VARCHAR(600)) 81 | insert_time = Column(VARCHAR(11)) 82 | classify = Column(VARCHAR(10)) 83 | news_url = Column(VARCHAR(600)) 84 | 85 | 86 | 87 | # 定义字典 加快读取速度 88 | classify_dict = { 89 | 90 | '体育': 1, 91 | '财经': 2, 92 | '房产': 3, 93 | '家居': 4, 94 | '教育': 5, 95 | '科技': 6, 96 | '时尚': 7, 97 | '时政': 8, 98 | '游戏': 9, 99 | '娱乐': 10, 100 | '股票': 11, 101 | '彩票': 12, 102 | '社会': 13, 103 | '星座': 14 104 | } 105 | 106 | engine = create_engine('mysql+mysqlconnector://root:159357@127.0.0.1:3306/text_classification') 107 | # 创建DBSession类型: 108 | DBSession = sessionmaker(bind=engine) 109 | 110 | def insert_wangyinews_into_mysql(table_name, news_title, news_url, news_article, insert_time): 111 | ''' 112 | 113 | :param table_name:表名 114 | :param news_title:新闻标题 115 | :param news_url:新闻地址 116 | :param news_article:新闻文章内容 117 | :param insert_time:将新闻插入数据库的时间 118 | :return: 119 | ''' 120 | # 创建session对象: 121 | session = DBSession() 122 | # 创建新new_object对象: 123 | new_object = table_name(news_title=news_title, news_url=news_url, news_article=news_article,insert_time=insert_time) 124 | # 添加到session: 125 | session.add(new_object) 126 | # 提交即保存到数据库: 127 | session.commit() 128 | # 关闭session: 129 | session.close() 130 | def insert_wangyinews_classify_into_mysql(table_name, news_id, classify_id): 131 | ''' 132 | :param table_name:表名 133 | :param news_id:新闻id 134 | :param classify_id:分类id 135 | :return: 136 | ''' 137 | # 创建session对象: 138 | session = DBSession() 139 | # 创建新new_object对象: 140 | new_object = table_name(news_id=news_id, classify_id=classify_id) 141 | # 添加到session: 142 | session.add(new_object) 143 | # 提交即保存到数据库: 144 | session.commit() 145 | # 关闭session: 146 | session.close() 147 | def select_from_mysql(table_name): 148 | ''' 149 | 从表中查询,返回一个query对象 150 | :param table_name: 151 | :return: 152 | ''' 153 | # 创建session对象: 154 | session = DBSession() 155 | query1 = session.query(table_name) 156 | # article_list = [] 157 | # for i in query1.order_by(table_name.news_id.asc()).all(): 158 | # article_list.append(i.news_article) 159 | # session.close() 160 | return query1 161 | 162 | 163 | 164 | 165 | 166 | -------------------------------------------------------------------------------- /web/hotNews.css: -------------------------------------------------------------------------------- 1 | @font-face 2 | { 3 | font-family: spFont; 4 | src: url(../font/fz.TTF); 5 | } 6 | .main .info_list li{ 7 | list-style: none; 8 | width: 100%; 9 | } 10 | .page{ 11 | float: left; 12 | width: 15px; 13 | margin-left: 5px; 14 | 15 | } 16 | .page a{ 17 | text-decoration: none; 18 | } 19 | 20 | .main_window_top{ 21 | padding-top: 35px; 22 | width: 90%; 23 | margin: 0 auto; 24 | font-family: spFont; 25 | } 26 | .news_title{ 27 | margin-left: 0%; 28 | font-size: 25px; 29 | color: red; 30 | } 31 | .classify{ 32 | margin-left: 41%; 33 | font-size: 25px; 34 | color: blue; 35 | } 36 | .info_classify { 37 | /*float: right;*/ 38 | margin-left: 9%; 39 | } 40 | .line{ 41 | width: 100%; 42 | background-repeat: no-repeat; 43 | background-size: 100% 100%; 44 | clip: rect(0, 0 ,50px, 50px); 45 | } 46 | 47 | .info_list{ 48 | margin-top: 50px; 49 | width: 1356px; 50 | } 51 | .info_item{ 52 | margin: 0 auto; 53 | } 54 | .info_list li{ 55 | margin-top: 40px; 56 | font-size: 18px; 57 | width: 1608px; 58 | font-family: spFont; 59 | } 60 | 61 | .info_list li a{ 62 | margin-left: 40px; 63 | display:inline-block; 64 | width:500px; 65 | } 66 | 67 | .main{ 68 | margin-top: 80px; 69 | margin-left: 5%; 70 | height: 640px; 71 | width: 91%; 72 | 73 | } 74 | 75 | .pagination{ 76 | padding: 0px; 77 | list-style: none; 78 | width: 270px; 79 | height: 30px; 80 | margin:0 auto; 81 | } 82 | 83 | .pagination li a{ 84 | font-size: 18px; 85 | } 86 | /*.info_block {*/ 87 | /*text-align: center;*/ 88 | /*width: 600px;*/ 89 | /*margin: 45px auto;*/ 90 | /*}*/ 91 | 92 | 93 | .pageone{ 94 | width: 25px; 95 | height: 30px; 96 | margin: 25px auto; 97 | } 98 | 99 | .time{ 100 | margin-left: 36%; 101 | font-size: 25px; 102 | color: blue; 103 | } 104 | .info_time{ 105 | margin-left: 31%; 106 | } 107 | 108 | .info_body{ 109 | width: 1500px; 110 | margin: 0 auto; 111 | } 112 | 113 | .info_info{ 114 | width: 1400px; 115 | 116 | 117 | margin: 0 auto ; 118 | } -------------------------------------------------------------------------------- /web/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/web/migrations/__init__.py -------------------------------------------------------------------------------- /web/migrations/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/web/migrations/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /web/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /web/selectFromDb.py: -------------------------------------------------------------------------------- 1 | #__author__:Omen 2 | #date:2018/4/12 3 | from web.connect_mysql import * 4 | import datetime 5 | def change(time): 6 | year = time[0:4] 7 | mounth = time[4:6] 8 | day = time[6:8] 9 | hour = time[8:] 10 | return(year+'.'+mounth+'.' +day+ ' '+' '+hour+' : 00') 11 | def select(): 12 | time = datetime.datetime.now().strftime("%Y%m%d%H") # 获取当前时间。 13 | query1 = select_from_mysql(view_news_classify) # 查询视图,时间符合当前时间。 14 | 15 | info_list = [] # 空的list 用于存储数据。 16 | 17 | for i in query1.filter(view_news_classify.insert_time==time): 18 | insert_time = change(i.insert_time) 19 | dict = {'id': i.news_id, # 新建字典用于存储一条数据。 20 | 'title': i.news_title, 21 | 'time': insert_time, 22 | 'classify': i.classify, 23 | 'url': i.news_url, 24 | } 25 | 26 | info_list.append(dict) 27 | 28 | 29 | return info_list # 返回list。 30 | -------------------------------------------------------------------------------- /web/static/css/aboutUS.css: -------------------------------------------------------------------------------- 1 | @font-face 2 | { 3 | font-family: spFont; 4 | src: url(../font/fz.TTF); 5 | } 6 | .main{ 7 | /*box-shadow: 5px 5px 2px 0px rgba(29,42,114,0.15);*/ 8 | background-size: 100% 100%; 9 | background-repeat: no-repeat; 10 | } 11 | 12 | .main_title{ 13 | width: 74px; 14 | height: 57px; 15 | /* margin-top: 94px; */ 16 | padding-top: 14px; 17 | margin: auto; 18 | text-align: center; 19 | } 20 | .team{ 21 | font-family: spFont; 22 | width: 850px; 23 | margin: 50px auto; 24 | color: #282c80; 25 | font-weight: bold; 26 | line-height: 28px; 27 | 28 | } 29 | .project{ 30 | width: 900px; 31 | margin: 97px auto; 32 | 33 | 34 | } 35 | 36 | .project p{ 37 | line-height: 28px; 38 | font-family: spFont; 39 | font-weight: bold; 40 | color: #282c80; 41 | margin-left: 24%; 42 | 43 | } -------------------------------------------------------------------------------- /web/static/css/articleAnalyze.css: -------------------------------------------------------------------------------- 1 | 2 | .main{ 3 | background-size: 100% 100%; 4 | background-repeat: no-repeat; 5 | } 6 | @font-face 7 | { 8 | font-family: spFont; 9 | src: url(../font/fz.TTF); 10 | } 11 | 12 | .textarea{ 13 | padding-top: 50px; 14 | } 15 | textarea{ 16 | height: 310px; 17 | width:86%; 18 | margin-left: 7%; 19 | resize: none; 20 | outline: none; 21 | border: none; 22 | } 23 | 24 | .button{ 25 | height: 31px; 26 | width: 112px; 27 | border: none; 28 | margin-top: 70px; 29 | margin-left: 87px; 30 | } 31 | 32 | .tag{ 33 | margin-top: 235px; 34 | margin-left: 135px; 35 | } 36 | .tag ul li{ 37 | list-style: none; 38 | float: left; 39 | font-size: 30px; 40 | margin-left: 25px; 41 | font-family: spFont; 42 | color: #282c80; 43 | font-weight: bold; 44 | } 45 | .chooser{ 46 | list-style:none; 47 | width: 900px; 48 | margin: -107px auto; 49 | } 50 | .chooser_li{ 51 | margin-left: 50px; 52 | } 53 | .chooser_ul{ 54 | list-style: none; 55 | } -------------------------------------------------------------------------------- /web/static/css/hotNews.css: -------------------------------------------------------------------------------- 1 | @font-face 2 | { 3 | font-family: spFont; 4 | src: url(../font/fz.TTF); 5 | } 6 | .main .info_list li{ 7 | list-style: none; 8 | width: 100%; 9 | } 10 | .page{ 11 | float: left; 12 | width: 15px; 13 | margin-left: 5px; 14 | 15 | } 16 | .page a{ 17 | text-decoration: none; 18 | } 19 | 20 | .main_window_top{ 21 | padding-top: 35px; 22 | width: 90%; 23 | margin: 0 auto; 24 | font-family: spFont; 25 | } 26 | .news_title{ 27 | margin-left: 10.5px; 28 | font-size: 25px; 29 | color: red; 30 | } 31 | .classify{ 32 | margin-left: 40.5%; 33 | font-size: 25px; 34 | color: blue; 35 | } 36 | .info_classify { 37 | /*float: right;*/ 38 | margin-left: 9%; 39 | } 40 | .line{ 41 | width: 100%; 42 | background-repeat: no-repeat; 43 | background-size: 100% 100%; 44 | clip: rect(0, 0 ,50px, 50px); 45 | } 46 | 47 | .info_list{ 48 | margin-top: 50px; 49 | width: 1356px; 50 | } 51 | .info_item{ 52 | margin: 0 auto; 53 | } 54 | .info_list li{ 55 | margin-top: 40px; 56 | font-size: 18px; 57 | width: 1608px; 58 | font-family: spFont; 59 | } 60 | 61 | .info_list li a{ 62 | margin-left: 40px; 63 | display:inline-block; 64 | width:500px; 65 | } 66 | 67 | .main{ 68 | margin-top: 80px; 69 | margin-left: 5%; 70 | height: 640px; 71 | width: 91%; 72 | 73 | } 74 | 75 | .pagination{ 76 | padding: 0px; 77 | list-style: none; 78 | width: 270px; 79 | height: 30px; 80 | margin:0 auto; 81 | } 82 | 83 | .pagination li a{ 84 | font-size: 18px; 85 | } 86 | /*.info_block {*/ 87 | /*text-align: center;*/ 88 | /*width: 600px;*/ 89 | /*margin: 45px auto;*/ 90 | /*}*/ 91 | 92 | 93 | .pageone{ 94 | width: 25px; 95 | height: 30px; 96 | margin: 25px auto; 97 | } 98 | 99 | .time{ 100 | margin-left: 32.5%; 101 | font-size: 25px; 102 | color: blue; 103 | } 104 | .info_time{ 105 | margin-left: 31%; 106 | } 107 | 108 | .info_body{ 109 | width: 1500px; 110 | margin: 0 auto; 111 | } 112 | 113 | .info_info{ 114 | width: 1400px; 115 | 116 | 117 | margin: 0 auto ; 118 | } -------------------------------------------------------------------------------- /web/static/css/main.css: -------------------------------------------------------------------------------- 1 | body{ 2 | margin-top: 0px; 3 | background-color: #ebebeb; 4 | margin: auto; 5 | width: 100%; 6 | max-width: 1920px; 7 | min-width: 1600px; 8 | } 9 | 10 | .banner{ 11 | margin: auto; 12 | height: 640px; 13 | width: 100%; 14 | background-repeat: no-repeat; 15 | background-position:center top; 16 | } 17 | 18 | .logo{ 19 | font-size: 24px; 20 | color: white; 21 | font-family: Gadugi; 22 | margin-left: 2.604%; 23 | padding-top: 5px; 24 | } 25 | .address{ 26 | margin-top: -25px; 27 | margin-left: 92.7%; 28 | font-size: 16px; 29 | color: white; 30 | font-family: Gadugi; 31 | } 32 | 33 | .Category{ 34 | margin-top: 25px; 35 | margin-left: 2.604%; 36 | height: 24px; 37 | width: 26px; 38 | background-size: 24px 26px; 39 | } 40 | .nav{ 41 | float: left; 42 | margin-top: -39px; 43 | } 44 | .nav ul li{ 45 | font-family: 微软雅黑; 46 | list-style: none; 47 | float: left; 48 | color: white; 49 | font-size: 22px; 50 | margin-left: 70px; 51 | } 52 | 53 | .nav ul li a{ 54 | color: white; 55 | text-decoration: none; 56 | } 57 | .nav ul li a:hover { 58 | color: #c8c8c8; 59 | } 60 | 61 | .navigationBar2{ 62 | margin-top: 453px; 63 | width: 1000px; 64 | height: 200px; 65 | margin: 453px auto; 66 | } 67 | 68 | .nav2_1{ 69 | float: left; 70 | margin-left: 65px; 71 | } 72 | .nav2_2{ 73 | float: left; 74 | margin-left: 132px; 75 | } 76 | 77 | .nav2_3{ 78 | float: left; 79 | margin-left: 117px; 80 | } 81 | .nav_2_1_1{ 82 | font-size: 24px; 83 | color: #fff; 84 | font-family: 微软雅黑; 85 | } 86 | .nav_2_1_2{ 87 | margin-top: -17px; 88 | font-size: 16px; 89 | color: #fff; 90 | font-family: 黑体; 91 | } 92 | .main{ 93 | margin: 80px auto; 94 | height: 640px; 95 | width: 91%; 96 | background-color: white; 97 | box-shadow: 5px 5px 2px 0px rgba(29,42,114,0.15); 98 | } 99 | .foot{ 100 | margin-top: 80px; 101 | height: 150px; 102 | /*border:1px solid red;*/ 103 | width: 800px; 104 | margin: auto; 105 | } 106 | 107 | 108 | 109 | .foot p{ 110 | text-align: center; 111 | } 112 | 113 | .foot_1{ 114 | margin-top: 50px; 115 | text-align: center; 116 | 117 | } 118 | 119 | .foot_1 a{ 120 | text-decoration: none; 121 | } -------------------------------------------------------------------------------- /web/static/css/main_back.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/web/static/css/main_back.css -------------------------------------------------------------------------------- /web/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/web/static/favicon.ico -------------------------------------------------------------------------------- /web/static/font/fz.TTF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/web/static/font/fz.TTF -------------------------------------------------------------------------------- /web/static/imgs/Category.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/web/static/imgs/Category.png -------------------------------------------------------------------------------- /web/static/imgs/aboutUS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/web/static/imgs/aboutUS.png -------------------------------------------------------------------------------- /web/static/imgs/banner_about_us.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/web/static/imgs/banner_about_us.png -------------------------------------------------------------------------------- /web/static/imgs/banner_atricle_analyzie.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/web/static/imgs/banner_atricle_analyzie.png -------------------------------------------------------------------------------- /web/static/imgs/banner_hot_news.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/web/static/imgs/banner_hot_news.png -------------------------------------------------------------------------------- /web/static/imgs/button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/web/static/imgs/button.png -------------------------------------------------------------------------------- /web/static/imgs/line.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/web/static/imgs/line.png -------------------------------------------------------------------------------- /web/static/imgs/wenzi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vectorsss/news_classification/02fd30eeff5f71d3789d6f38e55b4d9e2ddb601f/web/static/imgs/wenzi.png -------------------------------------------------------------------------------- /web/static/js/aboutUS.js: -------------------------------------------------------------------------------- 1 | //none -------------------------------------------------------------------------------- /web/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /web/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render, resolve_url, redirect, render_to_response, reverse 2 | 3 | from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger 4 | from web.selectFromDb import * 5 | from web.client import * 6 | 7 | # Create your views here. 8 | 9 | classify_list = [] # 用于存储分类 10 | get_art = '''''' 11 | article = ''' 12 | 魔兽世界:争霸艾泽拉斯重回起点,大结局或提前出现?伏笔太多! 13 | 14 | 魔兽世界陪伴了勇士们已经10年了,在这10年里很多我们称之为“神”的BOSS,都已经被脚男们推到。而魔兽世界的主线历史背景似乎也穷途末路,随着游戏策划们创意的枯竭,暴雪迫切需要一个版本来填坑过度,所以8.0争霸艾泽拉斯应运而生。 15 | 16 | 魔兽世界:争霸艾泽拉斯重回起点,大结局或提前出现?伏笔太多! 17 | 18 | 19 | 争霸艾泽拉斯 20 | 21 | 在我们击败黑暗泰坦萨格拉斯的时候,勇士们发现有一个更大的阴谋笼罩着整个宇宙。似乎萨格拉斯的燃烧军团并不是只是为了单纯的杀戮,从这个大版本最后的结局中,我们发现隐藏再虚空背后有一个连泰坦众神都害怕的敌人——虚空! 22 | 23 | 看完魔兽这样的故事走向,我越来越觉得这个以魔幻为题材的游戏,却有点像星际争霸的剧情了。邪恶的虫群最后也被洗白,最后三族联盟共同面对宇宙中最强的BOSS“艾蒙”。 24 | 25 | 难道最后我们艾泽拉斯也会联手泰坦众神,还有燃烧军团一起抵抗最大的敌人虚空吗? 26 | 27 | 魔兽世界:争霸艾泽拉斯重回起点,大结局或提前出现?伏笔太多! 28 | 29 | 萨格拉斯 30 | 31 | 争霸艾泽拉斯这个版本,虽然表面上是联盟与部落阵营的一场大冲突,可是在这冲突之下也隐藏着巨大的伏笔!而萨格拉斯最后怒劈艾泽拉斯星球的那把神剑,最后也一定能成为一个重要的“引子”。 32 | 33 | 而两个阵营的冲突更是让我们有很多想不通的疑点,比如希尔瓦娜斯为何火烧泰达希尔?在共同抵御了燃烧军团以后,希女王肯定不会无缘无故的去做贸然撕毁盟约的事情。 34 | 35 | 而最有可能的情况就是,泰达希尔的根部已经被上古之神腐化了,而上古之神就是虚空的爪牙! 36 | 37 | 魔兽世界:争霸艾泽拉斯重回起点,大结局或提前出现?伏笔太多! 38 | 39 | 火烧泰达希尔 40 | 41 | 最后让我们想想魔兽争霸WAR3的开场动画,当联盟和部落在大战一触即发的时候,天空突然被邪能笼罩,漫天开始落下火雨和恶魔......而这样的场景,是否会在“争霸艾泽拉斯”版本的最后出现呢? 42 | 43 | 虚空突然被撕裂,上古之神拔地而起,众神齐聚艾泽拉斯,而艾泽拉斯的星魂成为了最强的泰坦参与战斗,这也许就是魔兽世界的大结局吧! 7月15日 44 | ''' 45 | 46 | source = ''' 47 | 魔兽世界:争霸艾泽拉斯重回起点,大结局或提前出现?伏笔太多! 48 | 49 | 魔兽世界陪伴了勇士们已经10年了,在这10年里很多我们称之为“神”的BOSS,都已经被脚男们推到。而魔兽世界的主线历史背景似乎也穷途末路,随着游戏策划们创意的枯竭,暴雪迫切需要一个版本来填坑过度,所以8.0争霸艾泽拉斯应运而生。 50 | 51 | 魔兽世界:争霸艾泽拉斯重回起点,大结局或提前出现?伏笔太多! 52 | 53 | 54 | 争霸艾泽拉斯 55 | 56 | 在我们击败黑暗泰坦萨格拉斯的时候,勇士们发现有一个更大的阴谋笼罩着整个宇宙。似乎萨格拉斯的燃烧军团并不是只是为了单纯的杀戮,从这个大版本最后的结局中,我们发现隐藏再虚空背后有一个连泰坦众神都害怕的敌人——虚空! 57 | 58 | 看完魔兽这样的故事走向,我越来越觉得这个以魔幻为题材的游戏,却有点像星际争霸的剧情了。邪恶的虫群最后也被洗白,最后三族联盟共同面对宇宙中最强的BOSS“艾蒙”。 59 | 60 | 难道最后我们艾泽拉斯也会联手泰坦众神,还有燃烧军团一起抵抗最大的敌人虚空吗? 61 | 62 | 魔兽世界:争霸艾泽拉斯重回起点,大结局或提前出现?伏笔太多! 63 | 64 | 萨格拉斯 65 | 66 | 争霸艾泽拉斯这个版本,虽然表面上是联盟与部落阵营的一场大冲突,可是在这冲突之下也隐藏着巨大的伏笔!而萨格拉斯最后怒劈艾泽拉斯星球的那把神剑,最后也一定能成为一个重要的“引子”。 67 | 68 | 而两个阵营的冲突更是让我们有很多想不通的疑点,比如希尔瓦娜斯为何火烧泰达希尔?在共同抵御了燃烧军团以后,希女王肯定不会无缘无故的去做贸然撕毁盟约的事情。 69 | 70 | 而最有可能的情况就是,泰达希尔的根部已经被上古之神腐化了,而上古之神就是虚空的爪牙! 71 | 72 | 魔兽世界:争霸艾泽拉斯重回起点,大结局或提前出现?伏笔太多! 73 | 74 | 火烧泰达希尔 75 | 76 | 最后让我们想想魔兽争霸WAR3的开场动画,当联盟和部落在大战一触即发的时候,天空突然被邪能笼罩,漫天开始落下火雨和恶魔......而这样的场景,是否会在“争霸艾泽拉斯”版本的最后出现呢? 77 | 78 | 虚空突然被撕裂,上古之神拔地而起,众神齐聚艾泽拉斯,而艾泽拉斯的星魂成为了最强的泰坦参与战斗,这也许就是魔兽世界的大结局吧! 7月15日 79 | ''' 80 | def index(request): 81 | ''' 82 | 访问ip或域名跳转到aboutUs页面 83 | :param request: 84 | :return: 85 | ''' 86 | return redirect(resolve_url(about_us)) 87 | 88 | 89 | def about_us(request): 90 | ''' 91 | 返回aboutUS页面 92 | :param request: 93 | :return: 94 | ''' 95 | return render(request,'aboutUS.html') 96 | 97 | 98 | def hot_news(request): 99 | ''' 100 | 查询热点新闻数据库, 101 | 将返回结果进行分页操作。 102 | :param request: 103 | :return: 104 | ''' 105 | info_dict = select() # 查询数据库 106 | for item in info_dict: 107 | print ('12') 108 | print (item) 109 | pageinator = Paginator(info_dict, 6, 2) # 将查询到的结果分页。 110 | page = request.GET.get('page') # 从url里获取参数。 111 | 112 | try: 113 | customer = pageinator.page(page) # 获取当前参数的页面数据。 114 | except PageNotAnInteger: 115 | customer = pageinator.page(1) 116 | except EmptyPage: 117 | customer = pageinator.page(pageinator.num_pages) 118 | return render(request, 'hotNews.html', {'cus_list':customer}) # 渲染模板并返回。 119 | 120 | 121 | def article_analyze(request): 122 | global get_art, classify_list 123 | text = get_art 124 | list = classify_list 125 | if request.method == 'GET': 126 | get_art = '''''' 127 | classify_list = [] 128 | return render(request, 'articleAnalyze.html',{'classify': list,'article': article,'get_art': text}) 129 | 130 | def get_article(request): 131 | if request.method == 'POST': 132 | global classify_list,get_art 133 | classify_list = [] 134 | text = request.POST.get('text') # 获取form里的text。 135 | if len(text.strip()) < 300: 136 | print(len(text.strip())) 137 | classify = '文字小于三百个字符,自动恢复为默认范文1。' # 通过tcp传输文字 并获取返回的分类。 138 | get_art = source 139 | else: 140 | print(len(text.strip())) 141 | get_art = text 142 | classify = sen_info(text) # 通过tcp传输文字 并获取返回的分类。 143 | # classify = '123' 144 | 145 | classify_list.append(classify) # 添加分类。 146 | 147 | 148 | 149 | return redirect(resolve_url(article_analyze)) # 页面跳转。 150 | return redirect(resolve_url(about_us)) 151 | 152 | 153 | def page_not_found(request): 154 | return render_to_response('404.html') 155 | 156 | --------------------------------------------------------------------------------