├── DialogueExtractor_ch ├── Bert_ext.ipynb ├── Bert_ext.py ├── DialogueExtractor.py ├── config.json ├── icon.png ├── icon2.png ├── icon3.png ├── prototypes │ ├── Test.py │ ├── Test.ui │ ├── UI.aep │ ├── UI.png │ ├── UI.py │ ├── UI.ui │ └── logo_1.psd ├── requirements-beta.txt └── requirements.txt ├── LICENSE └── README.md /DialogueExtractor_ch/Bert_ext.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "metadata": { 7 | "scrolled": true 8 | }, 9 | "outputs": [ 10 | { 11 | "name": "stdout", 12 | "output_type": "stream", 13 | "text": [ 14 | "Requirement already satisfied: bert-extractive-summarizer in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (0.10.1)\n", 15 | "Requirement already satisfied: transformers in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from bert-extractive-summarizer) (4.16.1)\n", 16 | "Requirement already satisfied: spacy in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from bert-extractive-summarizer) (2.3.7)\n", 17 | "Requirement already satisfied: scikit-learn in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from bert-extractive-summarizer) (1.0.2)\n", 18 | "Requirement already satisfied: threadpoolctl>=2.0.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from scikit-learn->bert-extractive-summarizer) (3.0.0)\n", 19 | "Requirement already satisfied: scipy>=1.1.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from scikit-learn->bert-extractive-summarizer) (1.7.3)\n", 20 | "Requirement already satisfied: numpy>=1.14.6 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from scikit-learn->bert-extractive-summarizer) (1.21.5)\n", 21 | "Requirement already satisfied: joblib>=0.11 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from scikit-learn->bert-extractive-summarizer) (1.1.0)\n", 22 | "Requirement already satisfied: cymem<2.1.0,>=2.0.2 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy->bert-extractive-summarizer) (2.0.6)\n", 23 | "Requirement already satisfied: srsly<1.1.0,>=1.0.2 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy->bert-extractive-summarizer) (1.0.5)\n", 24 | "Requirement already satisfied: requests<3.0.0,>=2.13.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy->bert-extractive-summarizer) (2.27.1)\n", 25 | "Requirement already satisfied: murmurhash<1.1.0,>=0.28.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy->bert-extractive-summarizer) (1.0.6)\n", 26 | "Requirement already satisfied: catalogue<1.1.0,>=0.0.7 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy->bert-extractive-summarizer) (1.0.0)\n", 27 | "Requirement already satisfied: setuptools in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy->bert-extractive-summarizer) (58.0.4)\n", 28 | "Requirement already satisfied: preshed<3.1.0,>=3.0.2 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy->bert-extractive-summarizer) (3.0.6)\n", 29 | "Requirement already satisfied: thinc<7.5.0,>=7.4.1 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy->bert-extractive-summarizer) (7.4.5)\n", 30 | "Requirement already satisfied: wasabi<1.1.0,>=0.4.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy->bert-extractive-summarizer) (0.9.0)\n", 31 | "Requirement already satisfied: blis<0.8.0,>=0.4.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy->bert-extractive-summarizer) (0.7.5)\n", 32 | "Requirement already satisfied: plac<1.2.0,>=0.9.6 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy->bert-extractive-summarizer) (0.9.6)\n", 33 | "Requirement already satisfied: tqdm<5.0.0,>=4.38.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy->bert-extractive-summarizer) (4.62.3)\n", 34 | "Requirement already satisfied: importlib-metadata>=0.20 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from catalogue<1.1.0,>=0.0.7->spacy->bert-extractive-summarizer) (4.10.1)\n", 35 | "Requirement already satisfied: typing-extensions>=3.6.4 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from importlib-metadata>=0.20->catalogue<1.1.0,>=0.0.7->spacy->bert-extractive-summarizer) (4.0.1)\n", 36 | "Requirement already satisfied: zipp>=0.5 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from importlib-metadata>=0.20->catalogue<1.1.0,>=0.0.7->spacy->bert-extractive-summarizer) (3.7.0)\n", 37 | "Requirement already satisfied: certifi>=2017.4.17 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from requests<3.0.0,>=2.13.0->spacy->bert-extractive-summarizer) (2021.10.8)\n", 38 | "Requirement already satisfied: charset-normalizer~=2.0.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from requests<3.0.0,>=2.13.0->spacy->bert-extractive-summarizer) (2.0.10)\n", 39 | "Requirement already satisfied: urllib3<1.27,>=1.21.1 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from requests<3.0.0,>=2.13.0->spacy->bert-extractive-summarizer) (1.26.8)\n", 40 | "Requirement already satisfied: idna<4,>=2.5 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from requests<3.0.0,>=2.13.0->spacy->bert-extractive-summarizer) (3.3)\n", 41 | "Requirement already satisfied: packaging>=20.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from transformers->bert-extractive-summarizer) (21.3)\n", 42 | "Requirement already satisfied: pyyaml>=5.1 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from transformers->bert-extractive-summarizer) (6.0)\n", 43 | "Requirement already satisfied: tokenizers!=0.11.3,>=0.10.1 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from transformers->bert-extractive-summarizer) (0.11.4)\n", 44 | "Requirement already satisfied: regex!=2019.12.17 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from transformers->bert-extractive-summarizer) (2022.1.18)\n", 45 | "Requirement already satisfied: filelock in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from transformers->bert-extractive-summarizer) (3.4.2)\n", 46 | "Requirement already satisfied: huggingface-hub<1.0,>=0.1.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from transformers->bert-extractive-summarizer) (0.4.0)\n", 47 | "Requirement already satisfied: sacremoses in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from transformers->bert-extractive-summarizer) (0.0.47)\n", 48 | "Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from packaging>=20.0->transformers->bert-extractive-summarizer) (3.0.7)\n", 49 | "Requirement already satisfied: six in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from sacremoses->transformers->bert-extractive-summarizer) (1.16.0)\n", 50 | "Requirement already satisfied: click in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from sacremoses->transformers->bert-extractive-summarizer) (8.0.3)\n", 51 | "Requirement already satisfied: spacy==2.3.7 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (2.3.7)\n", 52 | "Requirement already satisfied: cymem<2.1.0,>=2.0.2 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy==2.3.7) (2.0.6)\n", 53 | "Requirement already satisfied: thinc<7.5.0,>=7.4.1 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy==2.3.7) (7.4.5)\n", 54 | "Requirement already satisfied: murmurhash<1.1.0,>=0.28.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy==2.3.7) (1.0.6)\n", 55 | "Requirement already satisfied: plac<1.2.0,>=0.9.6 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy==2.3.7) (0.9.6)\n", 56 | "Requirement already satisfied: srsly<1.1.0,>=1.0.2 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy==2.3.7) (1.0.5)\n", 57 | "Requirement already satisfied: numpy>=1.15.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy==2.3.7) (1.21.5)\n", 58 | "Requirement already satisfied: requests<3.0.0,>=2.13.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy==2.3.7) (2.27.1)\n", 59 | "Requirement already satisfied: preshed<3.1.0,>=3.0.2 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy==2.3.7) (3.0.6)\n", 60 | "Requirement already satisfied: wasabi<1.1.0,>=0.4.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy==2.3.7) (0.9.0)\n", 61 | "Requirement already satisfied: blis<0.8.0,>=0.4.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy==2.3.7) (0.7.5)\n", 62 | "Requirement already satisfied: tqdm<5.0.0,>=4.38.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy==2.3.7) (4.62.3)\n", 63 | "Requirement already satisfied: catalogue<1.1.0,>=0.0.7 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy==2.3.7) (1.0.0)\n", 64 | "Requirement already satisfied: setuptools in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy==2.3.7) (58.0.4)\n", 65 | "Requirement already satisfied: importlib-metadata>=0.20 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from catalogue<1.1.0,>=0.0.7->spacy==2.3.7) (4.10.1)\n", 66 | "Requirement already satisfied: zipp>=0.5 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from importlib-metadata>=0.20->catalogue<1.1.0,>=0.0.7->spacy==2.3.7) (3.7.0)\n", 67 | "Requirement already satisfied: typing-extensions>=3.6.4 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from importlib-metadata>=0.20->catalogue<1.1.0,>=0.0.7->spacy==2.3.7) (4.0.1)\n", 68 | "Requirement already satisfied: idna<4,>=2.5 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from requests<3.0.0,>=2.13.0->spacy==2.3.7) (3.3)\n", 69 | "Requirement already satisfied: certifi>=2017.4.17 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from requests<3.0.0,>=2.13.0->spacy==2.3.7) (2021.10.8)\n", 70 | "Requirement already satisfied: charset-normalizer~=2.0.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from requests<3.0.0,>=2.13.0->spacy==2.3.7) (2.0.10)\n", 71 | "Requirement already satisfied: urllib3<1.27,>=1.21.1 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from requests<3.0.0,>=2.13.0->spacy==2.3.7) (1.26.8)\n" 72 | ] 73 | }, 74 | { 75 | "name": "stdout", 76 | "output_type": "stream", 77 | "text": [ 78 | "Requirement already satisfied: transformers in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (4.16.1)\n", 79 | "Requirement already satisfied: packaging>=20.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from transformers) (21.3)\n", 80 | "Requirement already satisfied: sacremoses in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from transformers) (0.0.47)\n", 81 | "Requirement already satisfied: requests in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from transformers) (2.27.1)\n", 82 | "Requirement already satisfied: regex!=2019.12.17 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from transformers) (2022.1.18)\n", 83 | "Requirement already satisfied: pyyaml>=5.1 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from transformers) (6.0)\n", 84 | "Requirement already satisfied: importlib-metadata in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from transformers) (4.10.1)\n", 85 | "Requirement already satisfied: tokenizers!=0.11.3,>=0.10.1 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from transformers) (0.11.4)\n", 86 | "Requirement already satisfied: numpy>=1.17 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from transformers) (1.21.5)\n", 87 | "Requirement already satisfied: huggingface-hub<1.0,>=0.1.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from transformers) (0.4.0)\n", 88 | "Requirement already satisfied: tqdm>=4.27 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from transformers) (4.62.3)\n", 89 | "Requirement already satisfied: filelock in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from transformers) (3.4.2)\n", 90 | "Requirement already satisfied: typing-extensions>=3.7.4.3 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from huggingface-hub<1.0,>=0.1.0->transformers) (4.0.1)\n", 91 | "Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from packaging>=20.0->transformers) (3.0.7)\n", 92 | "Requirement already satisfied: zipp>=0.5 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from importlib-metadata->transformers) (3.7.0)\n", 93 | "Requirement already satisfied: charset-normalizer~=2.0.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from requests->transformers) (2.0.10)\n", 94 | "Requirement already satisfied: idna<4,>=2.5 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from requests->transformers) (3.3)\n", 95 | "Requirement already satisfied: urllib3<1.27,>=1.21.1 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from requests->transformers) (1.26.8)\n", 96 | "Requirement already satisfied: certifi>=2017.4.17 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from requests->transformers) (2021.10.8)\n", 97 | "Requirement already satisfied: click in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from sacremoses->transformers) (8.0.3)\n", 98 | "Requirement already satisfied: joblib in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from sacremoses->transformers) (1.1.0)\n", 99 | "Requirement already satisfied: six in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from sacremoses->transformers) (1.16.0)\n", 100 | "Requirement already satisfied: neuralcoref in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (4.0)\n", 101 | "Requirement already satisfied: numpy>=1.15.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from neuralcoref) (1.21.5)\n", 102 | "Requirement already satisfied: boto3 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from neuralcoref) (1.20.46)\n", 103 | "Requirement already satisfied: requests<3.0.0,>=2.13.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from neuralcoref) (2.27.1)\n", 104 | "Requirement already satisfied: spacy>=2.1.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from neuralcoref) (2.3.7)\n", 105 | "Requirement already satisfied: certifi>=2017.4.17 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from requests<3.0.0,>=2.13.0->neuralcoref) (2021.10.8)\n", 106 | "Requirement already satisfied: charset-normalizer~=2.0.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from requests<3.0.0,>=2.13.0->neuralcoref) (2.0.10)\n", 107 | "Requirement already satisfied: idna<4,>=2.5 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from requests<3.0.0,>=2.13.0->neuralcoref) (3.3)\n", 108 | "Requirement already satisfied: urllib3<1.27,>=1.21.1 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from requests<3.0.0,>=2.13.0->neuralcoref) (1.26.8)\n", 109 | "Requirement already satisfied: thinc<7.5.0,>=7.4.1 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy>=2.1.0->neuralcoref) (7.4.5)\n", 110 | "Requirement already satisfied: plac<1.2.0,>=0.9.6 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy>=2.1.0->neuralcoref) (0.9.6)\n", 111 | "Requirement already satisfied: srsly<1.1.0,>=1.0.2 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy>=2.1.0->neuralcoref) (1.0.5)\n", 112 | "Requirement already satisfied: murmurhash<1.1.0,>=0.28.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy>=2.1.0->neuralcoref) (1.0.6)\n", 113 | "Requirement already satisfied: tqdm<5.0.0,>=4.38.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy>=2.1.0->neuralcoref) (4.62.3)\n", 114 | "Requirement already satisfied: cymem<2.1.0,>=2.0.2 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy>=2.1.0->neuralcoref) (2.0.6)\n", 115 | "Requirement already satisfied: setuptools in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy>=2.1.0->neuralcoref) (58.0.4)\n", 116 | "Requirement already satisfied: catalogue<1.1.0,>=0.0.7 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy>=2.1.0->neuralcoref) (1.0.0)\n", 117 | "Requirement already satisfied: wasabi<1.1.0,>=0.4.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy>=2.1.0->neuralcoref) (0.9.0)\n", 118 | "Requirement already satisfied: blis<0.8.0,>=0.4.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy>=2.1.0->neuralcoref) (0.7.5)\n", 119 | "Requirement already satisfied: preshed<3.1.0,>=3.0.2 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy>=2.1.0->neuralcoref) (3.0.6)\n", 120 | "Requirement already satisfied: importlib-metadata>=0.20 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from catalogue<1.1.0,>=0.0.7->spacy>=2.1.0->neuralcoref) (4.10.1)\n", 121 | "Requirement already satisfied: typing-extensions>=3.6.4 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from importlib-metadata>=0.20->catalogue<1.1.0,>=0.0.7->spacy>=2.1.0->neuralcoref) (4.0.1)\n", 122 | "Requirement already satisfied: zipp>=0.5 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from importlib-metadata>=0.20->catalogue<1.1.0,>=0.0.7->spacy>=2.1.0->neuralcoref) (3.7.0)\n", 123 | "Requirement already satisfied: s3transfer<0.6.0,>=0.5.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from boto3->neuralcoref) (0.5.0)\n", 124 | "Requirement already satisfied: botocore<1.24.0,>=1.23.46 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from boto3->neuralcoref) (1.23.46)\n", 125 | "Requirement already satisfied: jmespath<1.0.0,>=0.7.1 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from boto3->neuralcoref) (0.10.0)\n", 126 | "Requirement already satisfied: python-dateutil<3.0.0,>=2.1 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from botocore<1.24.0,>=1.23.46->boto3->neuralcoref) (2.8.2)\n", 127 | "Requirement already satisfied: six>=1.5 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from python-dateutil<3.0.0,>=2.1->botocore<1.24.0,>=1.23.46->boto3->neuralcoref) (1.16.0)\n", 128 | "Requirement already satisfied: sentencepiece in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (0.1.96)\n", 129 | "Requirement already satisfied: tensorflow in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (2.7.0)\n", 130 | "Requirement already satisfied: termcolor>=1.1.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from tensorflow) (1.1.0)\n", 131 | "Requirement already satisfied: wheel<1.0,>=0.32.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from tensorflow) (0.37.1)\n", 132 | "Requirement already satisfied: keras<2.8,>=2.7.0rc0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from tensorflow) (2.7.0)\n", 133 | "Requirement already satisfied: tensorflow-estimator<2.8,~=2.7.0rc0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from tensorflow) (2.7.0)\n", 134 | "Requirement already satisfied: numpy>=1.14.5 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from tensorflow) (1.21.5)\n", 135 | "Requirement already satisfied: libclang>=9.0.1 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from tensorflow) (13.0.0)\n", 136 | "Requirement already satisfied: six>=1.12.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from tensorflow) (1.16.0)\n", 137 | "Requirement already satisfied: grpcio<2.0,>=1.24.3 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from tensorflow) (1.43.0)\n", 138 | "Requirement already satisfied: h5py>=2.9.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from tensorflow) (3.6.0)\n", 139 | "Requirement already satisfied: astunparse>=1.6.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from tensorflow) (1.6.3)\n", 140 | "Requirement already satisfied: protobuf>=3.9.2 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from tensorflow) (3.19.4)\n", 141 | "Requirement already satisfied: tensorflow-io-gcs-filesystem>=0.21.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from tensorflow) (0.23.1)\n", 142 | "Requirement already satisfied: flatbuffers<3.0,>=1.12 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from tensorflow) (2.0)\n", 143 | "Requirement already satisfied: google-pasta>=0.1.1 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from tensorflow) (0.2.0)\n", 144 | "Requirement already satisfied: absl-py>=0.4.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from tensorflow) (1.0.0)\n", 145 | "Requirement already satisfied: keras-preprocessing>=1.1.1 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from tensorflow) (1.1.2)\n", 146 | "Requirement already satisfied: opt-einsum>=2.3.2 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from tensorflow) (3.3.0)\n", 147 | "Requirement already satisfied: tensorboard~=2.6 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from tensorflow) (2.8.0)\n", 148 | "Requirement already satisfied: typing-extensions>=3.6.6 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from tensorflow) (4.0.1)\n", 149 | "Requirement already satisfied: gast<0.5.0,>=0.2.1 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from tensorflow) (0.4.0)\n", 150 | "Requirement already satisfied: wrapt>=1.11.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from tensorflow) (1.13.3)\n", 151 | "Requirement already satisfied: cached-property in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from h5py>=2.9.0->tensorflow) (1.5.2)\n" 152 | ] 153 | }, 154 | { 155 | "name": "stdout", 156 | "output_type": "stream", 157 | "text": [ 158 | "Requirement already satisfied: google-auth-oauthlib<0.5,>=0.4.1 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from tensorboard~=2.6->tensorflow) (0.4.6)\n", 159 | "Requirement already satisfied: setuptools>=41.0.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from tensorboard~=2.6->tensorflow) (58.0.4)\n", 160 | "Requirement already satisfied: werkzeug>=0.11.15 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from tensorboard~=2.6->tensorflow) (2.0.2)\n", 161 | "Requirement already satisfied: tensorboard-plugin-wit>=1.6.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from tensorboard~=2.6->tensorflow) (1.8.1)\n", 162 | "Requirement already satisfied: google-auth<3,>=1.6.3 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from tensorboard~=2.6->tensorflow) (2.5.0)\n", 163 | "Requirement already satisfied: tensorboard-data-server<0.7.0,>=0.6.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from tensorboard~=2.6->tensorflow) (0.6.1)\n", 164 | "Requirement already satisfied: markdown>=2.6.8 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from tensorboard~=2.6->tensorflow) (3.3.6)\n", 165 | "Requirement already satisfied: requests<3,>=2.21.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from tensorboard~=2.6->tensorflow) (2.27.1)\n", 166 | "Requirement already satisfied: rsa<5,>=3.1.4 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from google-auth<3,>=1.6.3->tensorboard~=2.6->tensorflow) (4.8)\n", 167 | "Requirement already satisfied: pyasn1-modules>=0.2.1 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from google-auth<3,>=1.6.3->tensorboard~=2.6->tensorflow) (0.2.8)\n", 168 | "Requirement already satisfied: cachetools<6.0,>=2.0.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from google-auth<3,>=1.6.3->tensorboard~=2.6->tensorflow) (5.0.0)\n", 169 | "Requirement already satisfied: requests-oauthlib>=0.7.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from google-auth-oauthlib<0.5,>=0.4.1->tensorboard~=2.6->tensorflow) (1.3.0)\n", 170 | "Requirement already satisfied: importlib-metadata>=4.4 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from markdown>=2.6.8->tensorboard~=2.6->tensorflow) (4.10.1)\n", 171 | "Requirement already satisfied: zipp>=0.5 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from importlib-metadata>=4.4->markdown>=2.6.8->tensorboard~=2.6->tensorflow) (3.7.0)\n", 172 | "Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from pyasn1-modules>=0.2.1->google-auth<3,>=1.6.3->tensorboard~=2.6->tensorflow) (0.4.8)\n", 173 | "Requirement already satisfied: idna<4,>=2.5 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from requests<3,>=2.21.0->tensorboard~=2.6->tensorflow) (3.3)\n", 174 | "Requirement already satisfied: urllib3<1.27,>=1.21.1 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from requests<3,>=2.21.0->tensorboard~=2.6->tensorflow) (1.26.8)\n", 175 | "Requirement already satisfied: certifi>=2017.4.17 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from requests<3,>=2.21.0->tensorboard~=2.6->tensorflow) (2021.10.8)\n", 176 | "Requirement already satisfied: charset-normalizer~=2.0.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from requests<3,>=2.21.0->tensorboard~=2.6->tensorflow) (2.0.10)\n", 177 | "Requirement already satisfied: oauthlib>=3.0.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard~=2.6->tensorflow) (3.1.1)\n", 178 | "Collecting zh_core_web_lg==2.3.1\n", 179 | " Using cached zh_core_web_lg-2.3.1-py3-none-any.whl\n", 180 | "Requirement already satisfied: jieba in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from zh_core_web_lg==2.3.1) (0.42.1)\n", 181 | "Requirement already satisfied: pkuseg>=0.0.22 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from zh_core_web_lg==2.3.1) (0.0.25)\n", 182 | "Requirement already satisfied: spacy<2.4.0,>=2.3.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from zh_core_web_lg==2.3.1) (2.3.7)\n", 183 | "Requirement already satisfied: cython in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from pkuseg>=0.0.22->zh_core_web_lg==2.3.1) (0.29.27)\n", 184 | "Requirement already satisfied: numpy>=1.16.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from pkuseg>=0.0.22->zh_core_web_lg==2.3.1) (1.21.5)\n", 185 | "Requirement already satisfied: srsly<1.1.0,>=1.0.2 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy<2.4.0,>=2.3.0->zh_core_web_lg==2.3.1) (1.0.5)\n", 186 | "Requirement already satisfied: tqdm<5.0.0,>=4.38.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy<2.4.0,>=2.3.0->zh_core_web_lg==2.3.1) (4.62.3)\n", 187 | "Requirement already satisfied: murmurhash<1.1.0,>=0.28.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy<2.4.0,>=2.3.0->zh_core_web_lg==2.3.1) (1.0.6)\n", 188 | "Requirement already satisfied: preshed<3.1.0,>=3.0.2 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy<2.4.0,>=2.3.0->zh_core_web_lg==2.3.1) (3.0.6)\n", 189 | "Requirement already satisfied: setuptools in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy<2.4.0,>=2.3.0->zh_core_web_lg==2.3.1) (58.0.4)\n", 190 | "Requirement already satisfied: plac<1.2.0,>=0.9.6 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy<2.4.0,>=2.3.0->zh_core_web_lg==2.3.1) (0.9.6)\n", 191 | "Requirement already satisfied: wasabi<1.1.0,>=0.4.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy<2.4.0,>=2.3.0->zh_core_web_lg==2.3.1) (0.9.0)\n", 192 | "Requirement already satisfied: cymem<2.1.0,>=2.0.2 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy<2.4.0,>=2.3.0->zh_core_web_lg==2.3.1) (2.0.6)\n", 193 | "Requirement already satisfied: catalogue<1.1.0,>=0.0.7 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy<2.4.0,>=2.3.0->zh_core_web_lg==2.3.1) (1.0.0)\n", 194 | "Requirement already satisfied: requests<3.0.0,>=2.13.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy<2.4.0,>=2.3.0->zh_core_web_lg==2.3.1) (2.27.1)\n", 195 | "Requirement already satisfied: thinc<7.5.0,>=7.4.1 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy<2.4.0,>=2.3.0->zh_core_web_lg==2.3.1) (7.4.5)\n", 196 | "Requirement already satisfied: blis<0.8.0,>=0.4.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from spacy<2.4.0,>=2.3.0->zh_core_web_lg==2.3.1) (0.7.5)\n", 197 | "Requirement already satisfied: importlib-metadata>=0.20 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from catalogue<1.1.0,>=0.0.7->spacy<2.4.0,>=2.3.0->zh_core_web_lg==2.3.1) (4.10.1)\n", 198 | "Requirement already satisfied: typing-extensions>=3.6.4 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from importlib-metadata>=0.20->catalogue<1.1.0,>=0.0.7->spacy<2.4.0,>=2.3.0->zh_core_web_lg==2.3.1) (4.0.1)\n", 199 | "Requirement already satisfied: zipp>=0.5 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from importlib-metadata>=0.20->catalogue<1.1.0,>=0.0.7->spacy<2.4.0,>=2.3.0->zh_core_web_lg==2.3.1) (3.7.0)\n", 200 | "Requirement already satisfied: charset-normalizer~=2.0.0 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from requests<3.0.0,>=2.13.0->spacy<2.4.0,>=2.3.0->zh_core_web_lg==2.3.1) (2.0.10)\n", 201 | "Requirement already satisfied: certifi>=2017.4.17 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from requests<3.0.0,>=2.13.0->spacy<2.4.0,>=2.3.0->zh_core_web_lg==2.3.1) (2021.10.8)\n", 202 | "Requirement already satisfied: urllib3<1.27,>=1.21.1 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from requests<3.0.0,>=2.13.0->spacy<2.4.0,>=2.3.0->zh_core_web_lg==2.3.1) (1.26.8)\n", 203 | "Requirement already satisfied: idna<4,>=2.5 in /opt/miniconda3/envs/DE/lib/python3.7/site-packages (from requests<3.0.0,>=2.13.0->spacy<2.4.0,>=2.3.0->zh_core_web_lg==2.3.1) (3.3)\n", 204 | "\u001b[38;5;2m✔ Download and installation successful\u001b[0m\n", 205 | "You can now load the model via spacy.load('zh_core_web_lg')\n" 206 | ] 207 | } 208 | ], 209 | "source": [ 210 | "!pip install bert-extractive-summarizer\n", 211 | "!pip install spacy==2.3.7\n", 212 | "!pip install transformers\n", 213 | "!pip install neuralcoref\n", 214 | "!pip install sentencepiece\n", 215 | "!pip install tensorflow\n", 216 | "!python -m spacy download zh_core_web_lg" 217 | ] 218 | }, 219 | { 220 | "cell_type": "code", 221 | "execution_count": 2, 222 | "metadata": {}, 223 | "outputs": [ 224 | { 225 | "name": "stdout", 226 | "output_type": "stream", 227 | "text": [ 228 | "Collecting package metadata (current_repodata.json): done\n", 229 | "Solving environment: done\n", 230 | "\n", 231 | "\n", 232 | "==> WARNING: A newer version of conda exists. <==\n", 233 | " current version: 4.10.3\n", 234 | " latest version: 4.11.0\n", 235 | "\n", 236 | "Please update conda by running\n", 237 | "\n", 238 | " $ conda update -n base -c defaults conda\n", 239 | "\n", 240 | "\n", 241 | "\n", 242 | "# All requested packages already installed.\n", 243 | "\n" 244 | ] 245 | } 246 | ], 247 | "source": [ 248 | "!conda install pytorch torchvision torchaudio -c pytorch -y" 249 | ] 250 | }, 251 | { 252 | "cell_type": "code", 253 | "execution_count": 3, 254 | "metadata": {}, 255 | "outputs": [ 256 | { 257 | "name": "stderr", 258 | "output_type": "stream", 259 | "text": [ 260 | "Building prefix dict from the default dictionary ...\n", 261 | "Loading model from cache /var/folders/7m/hsl39nr92272zml47mrxh2hc0000gn/T/jieba.cache\n", 262 | "Loading model cost 0.446 seconds.\n", 263 | "Prefix dict has been built successfully.\n" 264 | ] 265 | }, 266 | { 267 | "data": { 268 | "text/plain": [ 269 | "" 270 | ] 271 | }, 272 | "execution_count": 3, 273 | "metadata": {}, 274 | "output_type": "execute_result" 275 | } 276 | ], 277 | "source": [ 278 | "import warnings\n", 279 | "warnings.filterwarnings('ignore')\n", 280 | "\n", 281 | "import spacy\n", 282 | "import zh_core_web_lg\n", 283 | "import neuralcoref\n", 284 | "\n", 285 | "nlp = zh_core_web_lg.load()\n", 286 | "neuralcoref.add_to_pipe(nlp)" 287 | ] 288 | }, 289 | { 290 | "cell_type": "code", 291 | "execution_count": 4, 292 | "metadata": {}, 293 | "outputs": [], 294 | "source": [ 295 | "from summarizer import Summarizer\n", 296 | "from summarizer.text_processors.sentence_handler import SentenceHandler\n", 297 | "from spacy.lang.zh import Chinese\n", 298 | "from transformers import AutoConfig, AutoTokenizer, AutoModel\n", 299 | "import random" 300 | ] 301 | }, 302 | { 303 | "cell_type": "code", 304 | "execution_count": 5, 305 | "metadata": {}, 306 | "outputs": [ 307 | { 308 | "name": "stderr", 309 | "output_type": "stream", 310 | "text": [ 311 | "Some weights of the model checkpoint at uer/roberta-base-finetuned-chinanews-chinese were not used when initializing BertModel: ['classifier.bias', 'classifier.weight']\n", 312 | "- This IS expected if you are initializing BertModel from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).\n", 313 | "- This IS NOT expected if you are initializing BertModel from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).\n" 314 | ] 315 | }, 316 | { 317 | "data": { 318 | "text/plain": [ 319 | "'一直以来总想用一种什么方式把初中生活记录下来,用文字,又太过单调,用图画,又太过死板,,只有一种叫做光影的东西才能把他们全记录的真真切切。 我们在摄像头下肆意打闹,管他见不见阎罗王,上课时在课桌下搞着小发明,幻想成为下一个爱因斯坦,翻开桌斗一看,一堆小纸条和零零散散的的橡皮泥,桌角还有用纸包得严严的口香糖。 吧啦”又一个可怜的小孩的小孩柜门被某某按进去了,随后一声尖叫,有什么办法呢,修柜吧。 曾一度有过一段医院的经历,在重症病房外要么是大喜要么是大悲,在病人命悬一线时,有了生的希望时,亲人是欣喜若狂的,他们觉得亲人活着,就已经是老天在眷顾他们了,只要有生命,已经是别无所求,与生死较量过的人,还有什么苦不能吃什么难不能过呢。 然后每日练习十二小时,平均每天击出一千球,一直练到球杆握不住为止,这就是她成功的代价。'" 320 | ] 321 | }, 322 | "execution_count": 5, 323 | "metadata": {}, 324 | "output_type": "execute_result" 325 | } 326 | ], 327 | "source": [ 328 | "modelName = \"bert-base-chinese\"\n", 329 | "modelName = \"uer/roberta-base-finetuned-chinanews-chinese\"\n", 330 | "custom_config = AutoConfig.from_pretrained(modelName)\n", 331 | "custom_config.output_hidden_states=True\n", 332 | "custom_tokenizer = AutoTokenizer.from_pretrained(modelName)\n", 333 | "custom_model = AutoModel.from_pretrained(modelName, config=custom_config)\n", 334 | "model = Summarizer(\n", 335 | " custom_model=custom_model, \n", 336 | " custom_tokenizer=custom_tokenizer,\n", 337 | " sentence_handler = SentenceHandler(language=Chinese),\n", 338 | ")\n", 339 | "with open(\"1.txt\") as file:\n", 340 | " plain = file.read().split(\"。\")\n", 341 | " body = []\n", 342 | " for sentence in plain:\n", 343 | " if random.randint(0, 100) > 10:\n", 344 | " body.append(sentence)\n", 345 | " body = \"。\".join(body)\n", 346 | "\n", 347 | "result = model(\n", 348 | " body=body,\n", 349 | " num_sentences=5\n", 350 | ")\n", 351 | "result" 352 | ] 353 | }, 354 | { 355 | "cell_type": "code", 356 | "execution_count": 6, 357 | "metadata": {}, 358 | "outputs": [ 359 | { 360 | "data": { 361 | "text/plain": [ 362 | "array([[ 0.00324062, 0.26196805, 0.3949575 , ..., 0.3007724 ,\n", 363 | " 0.6028439 , 0.3966718 ],\n", 364 | " [ 0.1440831 , 0.50811267, -0.4292719 , ..., 0.29488227,\n", 365 | " 0.10104778, 0.27318 ],\n", 366 | " [ 1.0714781 , 0.01688286, -0.42002812, ..., 0.4559773 ,\n", 367 | " -1.0178088 , -0.11570095]], dtype=float32)" 368 | ] 369 | }, 370 | "execution_count": 6, 371 | "metadata": {}, 372 | "output_type": "execute_result" 373 | } 374 | ], 375 | "source": [ 376 | "model.run_embeddings(body, ratio=0.2)" 377 | ] 378 | }, 379 | { 380 | "cell_type": "code", 381 | "execution_count": 7, 382 | "metadata": {}, 383 | "outputs": [ 384 | { 385 | "data": { 386 | "text/plain": [ 387 | "'一直以来总想用一种什么方式把初中生活记录下来,用文字,又太过单调,用图画,又太过死板,,只有一种叫做光影的东西才能把他们全记录的真真切切。 我们在摄像头下肆意打闹,管他见不见阎罗王,上课时在课桌下搞着小发明,幻想成为下一个爱因斯坦,翻开桌斗一看,一堆小纸条和零零散散的的橡皮泥,桌角还有用纸包得严严的口香糖。 吧啦”又一个可怜的小孩的小孩柜门被某某按进去了,随后一声尖叫,有什么办法呢,修柜吧。 曾一度有过一段医院的经历,在重症病房外要么是大喜要么是大悲,在病人命悬一线时,有了生的希望时,亲人是欣喜若狂的,他们觉得亲人活着,就已经是老天在眷顾他们了,只要有生命,已经是别无所求,与生死较量过的人,还有什么苦不能吃什么难不能过呢。 然后每日练习十二小时,平均每天击出一千球,一直练到球杆握不住为止,这就是她成功的代价。'" 388 | ] 389 | }, 390 | "execution_count": 7, 391 | "metadata": {}, 392 | "output_type": "execute_result" 393 | } 394 | ], 395 | "source": [ 396 | "result" 397 | ] 398 | }, 399 | { 400 | "cell_type": "code", 401 | "execution_count": 8, 402 | "metadata": {}, 403 | "outputs": [ 404 | { 405 | "data": { 406 | "text/plain": [ 407 | "BertConfig {\n", 408 | " \"_name_or_path\": \"uer/roberta-base-finetuned-chinanews-chinese\",\n", 409 | " \"architectures\": [\n", 410 | " \"BertForSequenceClassification\"\n", 411 | " ],\n", 412 | " \"attention_probs_dropout_prob\": 0.1,\n", 413 | " \"classifier_dropout\": null,\n", 414 | " \"gradient_checkpointing\": false,\n", 415 | " \"hidden_act\": \"gelu\",\n", 416 | " \"hidden_dropout_prob\": 0.1,\n", 417 | " \"hidden_size\": 768,\n", 418 | " \"id2label\": {\n", 419 | " \"0\": \"mainland China politics\",\n", 420 | " \"1\": \"Hong Kong - Macau politics\",\n", 421 | " \"2\": \"International news\",\n", 422 | " \"3\": \"financial news\",\n", 423 | " \"4\": \"culture\",\n", 424 | " \"5\": \"entertainment\",\n", 425 | " \"6\": \"sports\"\n", 426 | " },\n", 427 | " \"initializer_range\": 0.02,\n", 428 | " \"intermediate_size\": 3072,\n", 429 | " \"label2id\": {\n", 430 | " \"Hong Kong - Macau politics\": 1,\n", 431 | " \"International news\": 2,\n", 432 | " \"culture\": 4,\n", 433 | " \"entertainment\": 5,\n", 434 | " \"financial news\": 3,\n", 435 | " \"mainland China politics\": 0,\n", 436 | " \"sports\": 6\n", 437 | " },\n", 438 | " \"layer_norm_eps\": 1e-12,\n", 439 | " \"max_position_embeddings\": 512,\n", 440 | " \"model_type\": \"bert\",\n", 441 | " \"num_attention_heads\": 12,\n", 442 | " \"num_hidden_layers\": 12,\n", 443 | " \"output_hidden_states\": true,\n", 444 | " \"pad_token_id\": 0,\n", 445 | " \"position_embedding_type\": \"absolute\",\n", 446 | " \"transformers_version\": \"4.16.1\",\n", 447 | " \"type_vocab_size\": 2,\n", 448 | " \"use_cache\": true,\n", 449 | " \"vocab_size\": 21128\n", 450 | "}" 451 | ] 452 | }, 453 | "execution_count": 8, 454 | "metadata": {}, 455 | "output_type": "execute_result" 456 | } 457 | ], 458 | "source": [ 459 | "custom_config" 460 | ] 461 | } 462 | ], 463 | "metadata": { 464 | "kernelspec": { 465 | "display_name": "Python 3 (ipykernel)", 466 | "language": "python", 467 | "name": "python3" 468 | }, 469 | "language_info": { 470 | "codemirror_mode": { 471 | "name": "ipython", 472 | "version": 3 473 | }, 474 | "file_extension": ".py", 475 | "mimetype": "text/x-python", 476 | "name": "python", 477 | "nbconvert_exporter": "python", 478 | "pygments_lexer": "ipython3", 479 | "version": "3.9.7" 480 | } 481 | }, 482 | "nbformat": 4, 483 | "nbformat_minor": 4 484 | } 485 | -------------------------------------------------------------------------------- /DialogueExtractor_ch/Bert_ext.py: -------------------------------------------------------------------------------- 1 | # coding=utf8 2 | import random 3 | import spacy 4 | import zh_core_web_lg 5 | import neuralcoref 6 | from summarizer import Summarizer 7 | from summarizer.text_processors.sentence_handler import SentenceHandler 8 | from spacy.lang.zh import Chinese 9 | from transformers import AutoConfig, AutoTokenizer, AutoModel 10 | from DialogueExtractor import Clip 11 | 12 | nlp = zh_core_web_lg.load() 13 | neuralcoref.add_to_pipe(nlp) 14 | modelName = "bert-base-chinese" 15 | # modelName = "uer/roberta-base-finetuned-chinanews-chinese" 16 | custom_config = AutoConfig.from_pretrained(modelName) 17 | custom_config.output_hidden_states=True 18 | custom_tokenizer = AutoTokenizer.from_pretrained(modelName) 19 | custom_model = AutoModel.from_pretrained(modelName, config=custom_config) 20 | model = Summarizer( 21 | custom_model=custom_model, 22 | custom_tokenizer=custom_tokenizer, 23 | sentence_handler = SentenceHandler(language=Chinese), 24 | ) 25 | 26 | def extractive_summarize(sentences, source, target, seed=666): 27 | """ 28 | sentences: list of string sentences 29 | source: if integer, use specified amount of sentences as the pool. Treat as ratio if float 30 | target: if integer, generate specified amount of sentences from the pool. Treat as ratio if float 31 | seed: random seed 32 | """ 33 | source = float(source) 34 | target = float(target) 35 | if source % 1 != 0: 36 | if source > 1: 37 | source = min(len(sentences), int(source)) 38 | else: 39 | source = min(1, abs(source)) 40 | source = int(len(sentences) * source) 41 | else: 42 | source = int(min(source, len(sentences))) 43 | 44 | if target % 1 != 0: 45 | if target > 1: 46 | target = min(source, int(target)) 47 | else: 48 | target = min(1, abs(target)) 49 | target = int(source * target) 50 | else: 51 | target = int(min(target, source)) 52 | 53 | seed = int(seed) 54 | 55 | # Sample data 56 | random.seed(seed) 57 | sampled_keys = random.sample(sentences.keys(), source) 58 | result = model( 59 | body="。".join(sampled_keys), 60 | min_length=10, 61 | max_length=50, 62 | num_sentences=target 63 | ) 64 | return result.split("。 ") -------------------------------------------------------------------------------- /DialogueExtractor_ch/DialogueExtractor.py: -------------------------------------------------------------------------------- 1 | """ 2 | Author: color·sky 3 | Date: 2022/02/14 4 | """ 5 | from PyQt6 import QtCore, QtGui, QtWidgets 6 | from PyQt6.QtWidgets import QFileDialog, QMenu 7 | from datetime import datetime, timedelta 8 | from pysubparser import parser 9 | from typing import List 10 | import subprocess 11 | import shutil 12 | import json 13 | import os 14 | import re 15 | 16 | ENABLE_BETA = False 17 | 18 | 19 | def denoise(inputFile): 20 | filename = inputFile 21 | tempfilename = filename.replace(".mp4", "_temp.mp4") 22 | wavfilename = filename.replace(".mp4", ".flac") 23 | print("extracting audio") 24 | ff1 = f"ffmpeg -y -loglevel quiet -i \"{filename}\" -q:a 0 -map a \"{wavfilename}\"" 25 | subprocess.call(ff1, shell=True) 26 | print("done extraction...") 27 | print("begin denoising") 28 | if os.path.exists(wavfilename[:-5]): 29 | shutil.rmtree(wavfilename[:-5]) 30 | separator.separate_to_file( 31 | wavfilename, wavfilename[:-5], filename_format='{instrument}.{codec}') 32 | ff2 = f"ffmpeg -y -loglevel quiet -i \"{filename}\" -i \"{wavfilename[:-5]}/vocals.wav\" -vcodec copy -map 0:0 -map 1:0 \"{tempfilename}\"" 33 | subprocess.call(ff2, shell=True) 34 | if os.path.exists(filename): 35 | os.remove(filename) 36 | if os.path.exists(wavfilename[:-5]): 37 | shutil.rmtree(wavfilename[:-5]) 38 | if os.path.exists(wavfilename): 39 | os.remove(wavfilename) 40 | os.rename(tempfilename, filename) 41 | if os.path.exists(tempfilename): 42 | os.remove(tempfilename) 43 | print(f"done denoising: {filename}") 44 | 45 | 46 | class ProjectSetup: 47 | inputFolder = None 48 | outputFolder = None 49 | videoCaptionPairs = {} 50 | dialogue = [] 51 | filtedDialogue = [] 52 | 53 | def __init__(self) -> None: 54 | if "config.json" in os.listdir("./"): 55 | with open("config.json", encoding="utf-8") as json_file: 56 | s = json_file.read() 57 | if not s: 58 | data = {} 59 | else: 60 | data = json.loads(s) 61 | self.inputFolder = data.get("inputFolder") 62 | self.outputFolder = data.get("outputFolder") 63 | 64 | def fetchEpisodeCaptionPairs(self): 65 | """Look into the inputFolder and fetch all video:caption pairs""" 66 | videoFormats = [".mkv", ".mp4", ".avi", ".mov", ".wmv"] 67 | captionFormats = [".sub", ".ass", ".srt", ".ssa"] 68 | videoFiles = [] 69 | captionFiles = [] 70 | for filename in os.listdir(self.inputFolder): 71 | if any([videoFormat in filename for videoFormat in videoFormats]): 72 | videoFiles.append(filename) 73 | if any([ 74 | captionFormat in filename 75 | for captionFormat in captionFormats 76 | ]): 77 | captionFiles.append(filename) 78 | self.videoCaptionPairs = {} 79 | for videoFile in videoFiles: 80 | video_name = videoFile.split(".")[0] 81 | for cap_extension in captionFormats: 82 | try: 83 | with open(f"{self.inputFolder}/{video_name}{cap_extension}") as caption_file: 84 | pass 85 | self.videoCaptionPairs[videoFile] = f"{video_name}{cap_extension}" 86 | break 87 | except FileNotFoundError: 88 | continue 89 | 90 | def updateDialogue(self, itemIndex): 91 | self.dialogue = [] 92 | if not self.videoCaptionPairs: 93 | return 94 | if itemIndex == -1: 95 | return 96 | if itemIndex == 0: 97 | filenames = list(self.videoCaptionPairs.values()) 98 | else: 99 | filenames = [list(self.videoCaptionPairs.values())[itemIndex - 1]] 100 | for i, filename in enumerate(filenames): 101 | episode = i + 1 if len(filenames) > 1 else itemIndex 102 | subtitles = parser.parse(f'{self.inputFolder}/{filename}') 103 | for subtitle in subtitles: 104 | self.dialogue.append( 105 | (episode, subtitle.start.strftime('%H:%M:%S'), subtitle.end.strftime('%H:%M:%S'), subtitle.text)) 106 | 107 | 108 | class Clip: 109 | def __init__(self, inputFile, e, st, et, d, lo=0, ro=0): 110 | self.episode = e 111 | self.startTime = st 112 | self.endTime = et 113 | self.dialogue = d 114 | self.inputFile = inputFile 115 | self.outputFile = "".join( 116 | x for x in f"{e}_{st.replace(':','_')}_{et.replace(':','_')}_{d}" 117 | if x.isalnum() or x in ('.', '_')) + ".mp4" 118 | self.leftOffset = lo 119 | self.rightOffset = ro 120 | 121 | def __repr__(self): 122 | return f"{self.inputFile} -> {self.outputFile}" 123 | 124 | def getClipFilename(self, outputDir=None, denoise_=False): 125 | if not outputDir: 126 | outputDir = "./temp" 127 | # print(self.__repr__() + 128 | # f" lo:{self.leftOffset}, ro:{self.rightOffset}") 129 | start_dt = datetime.strptime( 130 | self.startTime, '%H:%M:%S') - timedelta(seconds=self.leftOffset) 131 | end_dt = datetime.strptime( 132 | self.endTime, '%H:%M:%S') + timedelta(seconds=self.rightOffset) 133 | duration = str(end_dt - start_dt) 134 | # Convert begin-end time into %H:%M:%S format 135 | start_dt = str(start_dt).split(" ")[-1] 136 | outputFileName = f"{outputDir}/{self.outputFile}" 137 | ffmpeg_instruction = f"ffmpeg -y -ss {start_dt} -i \"{self.inputFile}\" -t {duration} -vcodec copy \"{outputFileName}\" -loglevel quiet" 138 | subprocess.call(ffmpeg_instruction, shell=True) 139 | if denoise_: 140 | denoise(outputFileName) 141 | print(f"Clip output to: {outputFileName}") 142 | return outputFileName 143 | 144 | 145 | class Ui_MainWindow(object): 146 | projectSetup = ProjectSetup() 147 | filtered_dialogue = [] 148 | folderChanged = False 149 | 150 | def getInputFolder(self, MainWindow): 151 | self.folderChanged = True 152 | data = {} 153 | try: 154 | with open("./config.json", encoding="utf-8") as json_file: 155 | s = json_file.read() 156 | if not s: 157 | data = {} 158 | else: 159 | data = json.loads(s) 160 | except FileNotFoundError: 161 | pass 162 | 163 | fileDir = QFileDialog.getExistingDirectory( 164 | MainWindow, 'Select input folder', data.get("inputFolder")) 165 | # Validate the selection 166 | if fileDir: 167 | self.projectSetup.inputFolder = fileDir 168 | data["inputFolder"] = fileDir 169 | with open("./config.json", "w", encoding="utf-8") as json_file: 170 | json.dump(data, json_file, ensure_ascii=False) 171 | else: 172 | return 173 | self.InputDirectory.setText(self.projectSetup.inputFolder) 174 | self.projectSetup.fetchEpisodeCaptionPairs() 175 | # Append Episodes into the EpisodeSelection 176 | self.EpisodeSelection.clear() 177 | for episodeName in ["All"] + list( 178 | self.projectSetup.videoCaptionPairs.keys()): 179 | self.EpisodeSelection.addItem(episodeName) 180 | 181 | def getOutputFolder(self, MainWindow): 182 | with open("./config.json", encoding="utf-8") as json_file: 183 | s = json_file.read() 184 | if not s: 185 | data = {} 186 | else: 187 | data = json.loads(s) 188 | fileDir = QFileDialog.getExistingDirectory( 189 | MainWindow, 'Select output folder', data.get("outputFolder")) 190 | # Validate the selection 191 | if fileDir: 192 | self.projectSetup.outputFolder = fileDir 193 | data["outputFolder"] = fileDir 194 | with open("./config.json", "w", encoding="utf-8") as json_file: 195 | json.dump(data, json_file, ensure_ascii=False) 196 | else: 197 | return 198 | self.OutputDirectory.setText(self.projectSetup.outputFolder) 199 | 200 | def updateDialogue(self): 201 | self.projectSetup.updateDialogue(self.EpisodeSelection.currentIndex()) 202 | self.updateSearch() 203 | 204 | def updateSearch(self, clear_hist=True): 205 | self.tableWidget.clearContents() 206 | if clear_hist: 207 | self.filtered_dialogue = [] 208 | for row in self.projectSetup.dialogue: 209 | e, st, et, d = row 210 | if self.SearchText.text(): 211 | if not re.findall(self.SearchText.text(), d): 212 | continue 213 | self.filtered_dialogue.append((e, st, et, d)) 214 | self.tableWidget.setRowCount(len(self.filtered_dialogue)) 215 | for i, row in enumerate(self.filtered_dialogue): 216 | e, st, et, d = row 217 | if self.SearchText.text(): 218 | if not re.findall(self.SearchText.text(), d): 219 | continue 220 | item = QtWidgets.QTableWidgetItem(str(e)) 221 | self.tableWidget.setItem(i, 0, item) 222 | item = QtWidgets.QTableWidgetItem(str(st)) 223 | self.tableWidget.setItem(i, 1, item) 224 | item = QtWidgets.QTableWidgetItem(str(et)) 225 | self.tableWidget.setItem(i, 2, item) 226 | item = QtWidgets.QTableWidgetItem(str(d)) 227 | self.tableWidget.setItem(i, 3, item) 228 | self.ResultLabel.setText( 229 | f"找到 {len(self.filtered_dialogue)} 行结果") 230 | 231 | def getClipFile(self) -> List[Clip]: 232 | selectedItems = self.tableWidget.selectedItems() 233 | if not selectedItems: 234 | return 235 | clips = [] 236 | while selectedItems: 237 | e = selectedItems.pop(0).text() 238 | st = selectedItems.pop(0).text() 239 | et = selectedItems.pop(0).text() 240 | d = selectedItems.pop(0).text() 241 | inputFile = list( 242 | self.projectSetup.videoCaptionPairs.keys())[int(e) - 1] 243 | inputFile = f"{self.InputDirectory.toPlainText()}/{inputFile}" 244 | clip = Clip(inputFile, e, st, et, d, self.LOffsetSpinBox.value(), 245 | self.ROffsetSpinBox.value()) 246 | clips.append(clip) 247 | return clips 248 | 249 | def getConcateClipFilename(self, clips, output_folder=None, denoise_=False): 250 | if not clips: 251 | return 252 | start_time = str(clips[0].startTime).replace(":", "_") 253 | end_time = str(clips[-1].endTime).replace(":", "_") 254 | outputFilename = f"./temp/合并_{start_time}_{end_time}.mp4" 255 | if output_folder: 256 | outputFilename = f'"{output_folder}/合并_{start_time}_{end_time}.mp4"' 257 | 258 | # Write config file 259 | clip_names = [] 260 | with open("./temp/concat.txt", "w") as config_file: 261 | for clip in clips: 262 | clipFilename = clip.getClipFilename()[7:] 263 | config_file.write(f"file '{clipFilename}'\n") 264 | clip_names.append(f"./temp/{clipFilename}") 265 | ffmpegScript = f"ffmpeg -f concat -safe 0 -i ./temp/concat.txt -c copy {outputFilename} -loglevel quiet" 266 | subprocess.call(ffmpegScript, shell=True) 267 | 268 | if denoise_: 269 | denoise(outputFilename) 270 | 271 | # Remove single clips 272 | [os.remove(clip_name) 273 | for clip_name in clip_names+["./temp/concat.txt"]] 274 | return outputFilename 275 | 276 | def previewSelected(self): 277 | # Clear tempfolder 278 | dir = './temp/' 279 | if not os.path.exists(dir): 280 | # Create a new directory because it does not exist 281 | os.makedirs(dir) 282 | for files in os.listdir(dir): 283 | path = os.path.join(dir, files) 284 | try: 285 | shutil.rmtree(path) 286 | except OSError: 287 | os.remove(path) 288 | # Acquire clip 289 | clips = self.getClipFile() 290 | if not clips: 291 | return 292 | if len(clips) == 1 or not self.ConcatenateCheckBox.isChecked(): # Only selected one clip 293 | clip = clips[-1] # Only Preview the last selected file 294 | clipFilename = clip.getClipFilename( 295 | denoise_=self.DenoiseCheckBox.isChecked()) 296 | else: 297 | clipFilename = self.getConcateClipFilename( 298 | clips, denoise_=self.DenoiseCheckBox.isChecked()) 299 | print(clipFilename) 300 | ffplayScript = f"ffplay -x 800 -y 600 -autoexit {clipFilename}" 301 | if not self.PreviewCheckBox.isChecked(): 302 | ffplayScript += " -nodisp" 303 | subprocess.call(ffplayScript, shell=True) 304 | print("Preview Finished") 305 | for files in os.listdir(dir): 306 | path = os.path.join(dir, files) 307 | try: 308 | shutil.rmtree(path) 309 | except OSError: 310 | os.remove(path) 311 | 312 | def exportSelected(self): 313 | clips = self.getClipFile() 314 | if not clips: 315 | return 316 | if self.ConcatenateCheckBox.isChecked() and len(clips) > 1: 317 | self.getConcateClipFilename( 318 | clips, self.OutputDirectory.toPlainText(), denoise_=self.DenoiseCheckBox.isChecked()) 319 | else: 320 | for clip in clips: 321 | clipFilename = clip.getClipFilename( 322 | self.OutputDirectory.toPlainText(), denoise_=self.DenoiseCheckBox.isChecked()) 323 | 324 | def generateScript(self): 325 | 326 | print("Generate!") 327 | sentences = {} 328 | self.updateSearch(clear_hist=False) 329 | for row in range(self.tableWidget.rowCount()): 330 | e = self.tableWidget.item(row, 0).text() 331 | st = self.tableWidget.item(row, 1).text() 332 | et = self.tableWidget.item(row, 2).text() 333 | d = self.tableWidget.item(row, 3).text() 334 | info = {"e":e, "st":st, "et":et, "d":d} 335 | punct = ".,。,?!?!\s\r\n" 336 | kwd = re.sub(f"[{punct}]+",",", d) 337 | if not kwd: 338 | continue 339 | if kwd[-1] in punct: 340 | kwd = kwd[:-1] 341 | sentences[kwd] = info 342 | 343 | extracted_keys = extractive_summarize(sentences, self.SourceAmount.text(), self.TargetAmount.text(), self.RandomSeed.text()) 344 | self.tableWidget.clearContents() 345 | self.tableWidget.setRowCount(len(extracted_keys)) 346 | cursor = 0 347 | for k in extracted_keys: 348 | v = sentences.get(k) 349 | if not v: 350 | continue 351 | e, st, et, d = v["e"], v["st"], v["et"], v["d"] 352 | item = QtWidgets.QTableWidgetItem(str(e)) 353 | self.tableWidget.setItem(cursor, 0, item) 354 | item = QtWidgets.QTableWidgetItem(str(st)) 355 | self.tableWidget.setItem(cursor, 1, item) 356 | item = QtWidgets.QTableWidgetItem(str(et)) 357 | self.tableWidget.setItem(cursor, 2, item) 358 | item = QtWidgets.QTableWidgetItem(str(d)) 359 | self.tableWidget.setItem(cursor, 3, item) 360 | cursor += 1 361 | self.ResultLabel.setText( 362 | f"成功生成 {len(extracted_keys)} 行剧本") 363 | 364 | def openAbout(self): 365 | url = QtCore.QUrl("https://space.bilibili.com/2181001") 366 | QtGui.QDesktopServices.openUrl(url) 367 | 368 | 369 | def setupUi(self, MainWindow): 370 | MainWindow.setObjectName("MainWindow") 371 | MainWindow.setEnabled(True) 372 | MainWindow.resize(800, 600) 373 | MainWindow.setWindowIcon(QtGui.QIcon('icon3.png')) 374 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Fixed, 375 | QtWidgets.QSizePolicy.Policy.Fixed) 376 | sizePolicy.setHorizontalStretch(0) 377 | sizePolicy.setVerticalStretch(0) 378 | sizePolicy.setHeightForWidth( 379 | MainWindow.sizePolicy().hasHeightForWidth()) 380 | MainWindow.setSizePolicy(sizePolicy) 381 | MainWindow.setMinimumSize(QtCore.QSize(800, 615)) 382 | MainWindow.setMaximumSize(QtCore.QSize(800, 615)) 383 | MainWindow.setAutoFillBackground(False) 384 | MainWindow.setAnimated(True) 385 | self.centralwidget = QtWidgets.QWidget(MainWindow) 386 | self.centralwidget.setObjectName("centralwidget") 387 | self.menubar = QtWidgets.QMenuBar(MainWindow) 388 | self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 22)) 389 | self.menubar.setObjectName("menubar") 390 | self.menu_About = QtWidgets.QMenu(self.menubar) 391 | self.menu_About.setObjectName("menu_About") 392 | MainWindow.setMenuBar(self.menubar) 393 | self.actionAuthor_color_sky = QtGui.QAction(MainWindow) 394 | self.actionAuthor_color_sky.setObjectName("actionAuthor_color_sky") 395 | self.menu_About.addAction(self.actionAuthor_color_sky) 396 | self.menubar.addAction(self.menu_About.menuAction()) 397 | self.InputDirButton = QtWidgets.QPushButton(self.centralwidget) 398 | self.InputDirButton.setEnabled(True) 399 | self.InputDirButton.setGeometry(QtCore.QRect(689, 19, 101, 32)) 400 | sizePolicy = QtWidgets.QSizePolicy( 401 | QtWidgets.QSizePolicy.Policy.Minimum, 402 | QtWidgets.QSizePolicy.Policy.Minimum) 403 | sizePolicy.setHorizontalStretch(0) 404 | sizePolicy.setVerticalStretch(0) 405 | sizePolicy.setHeightForWidth( 406 | self.InputDirButton.sizePolicy().hasHeightForWidth()) 407 | self.InputDirButton.setSizePolicy(sizePolicy) 408 | self.InputDirButton.setFocusPolicy(QtCore.Qt.FocusPolicy.NoFocus) 409 | self.InputDirButton.setObjectName("InputDirButton") 410 | self.OutputDirButton = QtWidgets.QPushButton(self.centralwidget) 411 | self.OutputDirButton.setEnabled(True) 412 | self.OutputDirButton.setGeometry(QtCore.QRect(689, 59, 101, 32)) 413 | sizePolicy = QtWidgets.QSizePolicy( 414 | QtWidgets.QSizePolicy.Policy.Minimum, 415 | QtWidgets.QSizePolicy.Policy.Minimum) 416 | sizePolicy.setHorizontalStretch(0) 417 | sizePolicy.setVerticalStretch(0) 418 | sizePolicy.setHeightForWidth( 419 | self.OutputDirButton.sizePolicy().hasHeightForWidth()) 420 | self.OutputDirButton.setSizePolicy(sizePolicy) 421 | self.OutputDirButton.setFocusPolicy(QtCore.Qt.FocusPolicy.NoFocus) 422 | self.OutputDirButton.setObjectName("OutputDirButton") 423 | self.InputDirectory = QtWidgets.QTextEdit(self.centralwidget) 424 | self.InputDirectory.setEnabled(False) 425 | self.InputDirectory.setGeometry(QtCore.QRect(10, 20, 670, 30)) 426 | self.InputDirectory.setObjectName("InputDirectory") 427 | self.OutputDirectory = QtWidgets.QTextEdit(self.centralwidget) 428 | self.OutputDirectory.setEnabled(False) 429 | self.OutputDirectory.setGeometry(QtCore.QRect(10, 60, 670, 30)) 430 | self.OutputDirectory.setObjectName("OutputDirectory") 431 | self.EpisodeLabel = QtWidgets.QLabel(self.centralwidget) 432 | self.EpisodeLabel.setGeometry(QtCore.QRect(10, 100, 60, 30)) 433 | self.EpisodeLabel.setObjectName("EpisodeLabel") 434 | self.EpisodeSelection = QtWidgets.QComboBox(self.centralwidget) 435 | self.EpisodeSelection.setGeometry(QtCore.QRect(45, 106, 200, 21)) 436 | sizePolicy = QtWidgets.QSizePolicy( 437 | QtWidgets.QSizePolicy.Policy.Preferred, 438 | QtWidgets.QSizePolicy.Policy.Preferred) 439 | sizePolicy.setHorizontalStretch(0) 440 | sizePolicy.setVerticalStretch(0) 441 | sizePolicy.setHeightForWidth( 442 | self.EpisodeSelection.sizePolicy().hasHeightForWidth()) 443 | self.EpisodeSelection.setSizePolicy(sizePolicy) 444 | self.EpisodeSelection.setFocusPolicy(QtCore.Qt.FocusPolicy.NoFocus) 445 | self.EpisodeSelection.setObjectName("EpisodeSelection") 446 | self.EpisodeSelection.addItem("") 447 | sizePolicy = QtWidgets.QSizePolicy( 448 | QtWidgets.QSizePolicy.Policy.Expanding, 449 | QtWidgets.QSizePolicy.Policy.Expanding) 450 | sizePolicy.setHorizontalStretch(0) 451 | sizePolicy.setVerticalStretch(0) 452 | self.SearchText = QtWidgets.QLineEdit(self.centralwidget) 453 | self.SearchText.setGeometry(QtCore.QRect(45, 140, 745, 30)) 454 | self.SearchText.setObjectName("SearchText") 455 | self.SearchLabel = QtWidgets.QLabel(self.centralwidget) 456 | self.SearchLabel.setGeometry(QtCore.QRect(10, 140, 60, 30)) 457 | self.SearchLabel.setObjectName("SearchLabel") 458 | 459 | self.ScriptGenerateButton = QtWidgets.QPushButton( 460 | self.centralwidget) 461 | self.ScriptGenerateButton.setEnabled(True) 462 | self.ScriptGenerateButton.setGeometry( 463 | QtCore.QRect(660, 179, 131, 50)) 464 | sizePolicy = QtWidgets.QSizePolicy( 465 | QtWidgets.QSizePolicy.Policy.Minimum, 466 | QtWidgets.QSizePolicy.Policy.Minimum) 467 | sizePolicy.setHorizontalStretch(0) 468 | sizePolicy.setVerticalStretch(0) 469 | sizePolicy.setHeightForWidth( 470 | self.ScriptGenerateButton.sizePolicy().hasHeightForWidth()) 471 | self.ScriptGenerateButton.setSizePolicy(sizePolicy) 472 | self.ScriptGenerateButton.setFocusPolicy( 473 | QtCore.Qt.FocusPolicy.NoFocus) 474 | self.ScriptGenerateButton.setObjectName("ScriptGenerateButton") 475 | 476 | self.ScriptConfig = QtWidgets.QLabel(self.centralwidget) 477 | self.ScriptConfig.setGeometry(QtCore.QRect(660, 227, 300, 30)) 478 | self.ScriptConfig.setObjectName("ScriptConfig") 479 | 480 | self.SourceAmount = QtWidgets.QDoubleSpinBox(self.centralwidget) 481 | self.SourceAmount.setGeometry(QtCore.QRect(660, 256, 40, 30)) 482 | self.SourceAmount.setObjectName("SourceAmount") 483 | self.SourceAmount.setDecimals(1) 484 | self.SourceAmount.setMinimum(0.0) 485 | self.SourceAmount.setMaximum(9999999999) 486 | self.SourceAmount.setSingleStep(0.1) 487 | self.SourceAmount.setValue(0.3) 488 | 489 | self.TargetAmount = QtWidgets.QDoubleSpinBox(self.centralwidget) 490 | self.TargetAmount.setGeometry(QtCore.QRect(705, 256, 40, 30)) 491 | self.TargetAmount.setObjectName("TargetAmount") 492 | self.TargetAmount.setDecimals(1) 493 | self.TargetAmount.setMinimum(0.0) 494 | self.TargetAmount.setMaximum(9999999999) 495 | self.TargetAmount.setSingleStep(0.1) 496 | self.TargetAmount.setValue(20) 497 | 498 | self.RandomSeed = QtWidgets.QDoubleSpinBox(self.centralwidget) 499 | self.RandomSeed.setGeometry(QtCore.QRect(750, 256, 40, 30)) 500 | self.RandomSeed.setObjectName("RandomSeed") 501 | self.RandomSeed.setDecimals(0) 502 | self.RandomSeed.setMinimum(0) 503 | self.RandomSeed.setMaximum(9999999999) 504 | self.RandomSeed.setSingleStep(1) 505 | self.RandomSeed.setValue(233) 506 | 507 | self.DenoiseCheckBox = QtWidgets.QCheckBox(self.centralwidget) 508 | self.DenoiseCheckBox.setGeometry(QtCore.QRect(659, 291, 130, 45)) 509 | self.DenoiseCheckBox.setChecked(False) 510 | self.DenoiseCheckBox.setObjectName("DenoiseCheckBox") 511 | 512 | self.ResultLabel = QtWidgets.QLabel(self.centralwidget) 513 | self.ResultLabel.setAlignment( 514 | QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter) 515 | self.ResultLabel.setGeometry(QtCore.QRect(672, 138, 100, 35)) 516 | self.ResultLabel.setObjectName("ResultLabel") 517 | self.ConcatenateCheckBox = QtWidgets.QCheckBox(self.centralwidget) 518 | self.ConcatenateCheckBox.setGeometry(QtCore.QRect(659, 355, 130, 45)) 519 | self.ConcatenateCheckBox.setChecked(False) 520 | self.ConcatenateCheckBox.setObjectName("ConcatenateCheckBox") 521 | self.PreviewCheckBox = QtWidgets.QCheckBox(self.centralwidget) 522 | self.PreviewCheckBox.setGeometry(QtCore.QRect(659, 323, 130, 45)) 523 | self.PreviewCheckBox.setChecked(False) 524 | self.PreviewCheckBox.setObjectName("PreviewCheckBox") 525 | self.LOffsetSpinBox = QtWidgets.QDoubleSpinBox(self.centralwidget) 526 | self.LOffsetSpinBox.setGeometry(QtCore.QRect(710, 402, 60, 35)) 527 | self.LOffsetSpinBox.setMinimum(-1000.0) 528 | self.LOffsetSpinBox.setMaximum(1000.0) 529 | self.LOffsetSpinBox.setSingleStep(0.5) 530 | self.LOffsetSpinBox.setObjectName("LOffsetSpinBox") 531 | self.LOffsetLabel = QtWidgets.QLabel(self.centralwidget) 532 | self.LOffsetLabel.setGeometry(QtCore.QRect(660, 402, 50, 35)) 533 | self.LOffsetLabel.setObjectName("LOffsetLabel") 534 | self.ROffsetLabel = QtWidgets.QLabel(self.centralwidget) 535 | self.ROffsetLabel.setGeometry(QtCore.QRect(660, 442, 50, 35)) 536 | self.ROffsetLabel.setObjectName("ROffsetLabel") 537 | self.ROffsetSpinBox = QtWidgets.QDoubleSpinBox(self.centralwidget) 538 | self.ROffsetSpinBox.setGeometry(QtCore.QRect(710, 442, 60, 35)) 539 | self.ROffsetSpinBox.setMinimum(-1000.0) 540 | self.ROffsetSpinBox.setMaximum(1000.0) 541 | self.ROffsetSpinBox.setSingleStep(0.5) 542 | self.ROffsetSpinBox.setObjectName("ROffsetSpinBox") 543 | self.seconds_1 = QtWidgets.QLabel(self.centralwidget) 544 | self.seconds_1.setGeometry(QtCore.QRect(778, 402, 22, 35)) 545 | self.seconds_1.setObjectName("seconds_1") 546 | self.PerviewButton = QtWidgets.QPushButton(self.centralwidget) 547 | self.PerviewButton.setEnabled(True) 548 | self.PerviewButton.setGeometry(QtCore.QRect(660, 482, 131, 50)) 549 | sizePolicy = QtWidgets.QSizePolicy( 550 | QtWidgets.QSizePolicy.Policy.Minimum, 551 | QtWidgets.QSizePolicy.Policy.Minimum) 552 | sizePolicy.setHorizontalStretch(0) 553 | sizePolicy.setVerticalStretch(0) 554 | sizePolicy.setHeightForWidth( 555 | self.PerviewButton.sizePolicy().hasHeightForWidth()) 556 | self.PerviewButton.setSizePolicy(sizePolicy) 557 | self.PerviewButton.setFocusPolicy(QtCore.Qt.FocusPolicy.NoFocus) 558 | self.PerviewButton.setObjectName("PerviewButton") 559 | self.seconds_2 = QtWidgets.QLabel(self.centralwidget) 560 | self.seconds_2.setGeometry(QtCore.QRect(778, 442, 22, 35)) 561 | self.seconds_2.setObjectName("seconds_2") 562 | self.ExportButton = QtWidgets.QPushButton(self.centralwidget) 563 | self.ExportButton.setEnabled(True) 564 | self.ExportButton.setGeometry(QtCore.QRect(660, 534, 131, 50)) 565 | sizePolicy = QtWidgets.QSizePolicy( 566 | QtWidgets.QSizePolicy.Policy.Minimum, 567 | QtWidgets.QSizePolicy.Policy.Minimum) 568 | sizePolicy.setHorizontalStretch(0) 569 | sizePolicy.setVerticalStretch(0) 570 | sizePolicy.setHeightForWidth( 571 | self.ExportButton.sizePolicy().hasHeightForWidth()) 572 | self.ExportButton.setSizePolicy(sizePolicy) 573 | self.ExportButton.setFocusPolicy(QtCore.Qt.FocusPolicy.NoFocus) 574 | self.ExportButton.setObjectName("ExportButton") 575 | self.tableWidget = QtWidgets.QTableWidget(self.centralwidget) 576 | self.tableWidget.setGeometry(QtCore.QRect(10, 180, 640, 403)) 577 | self.tableWidget.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) 578 | self.tableWidget.setLineWidth(1) 579 | self.tableWidget.setSizeAdjustPolicy( 580 | QtWidgets.QAbstractScrollArea.SizeAdjustPolicy.AdjustToContents) 581 | self.tableWidget.setEditTriggers( 582 | QtWidgets.QAbstractItemView.EditTrigger.NoEditTriggers) 583 | self.tableWidget.setAlternatingRowColors(True) 584 | self.tableWidget.setSelectionBehavior( 585 | QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows) 586 | self.tableWidget.setGridStyle(QtCore.Qt.PenStyle.NoPen) 587 | self.tableWidget.setWordWrap(True) 588 | self.tableWidget.setRowCount(0) 589 | self.tableWidget.setColumnCount(4) 590 | self.tableWidget.setObjectName("tableWidget") 591 | item = QtWidgets.QTableWidgetItem() 592 | self.tableWidget.setHorizontalHeaderItem(0, item) 593 | item = QtWidgets.QTableWidgetItem() 594 | self.tableWidget.setHorizontalHeaderItem(1, item) 595 | item = QtWidgets.QTableWidgetItem() 596 | self.tableWidget.setHorizontalHeaderItem(2, item) 597 | item = QtWidgets.QTableWidgetItem() 598 | self.tableWidget.setHorizontalHeaderItem(3, item) 599 | item = QtWidgets.QTableWidgetItem() 600 | self.tableWidget.setItem(0, 0, item) 601 | item = QtWidgets.QTableWidgetItem() 602 | self.tableWidget.setItem(0, 1, item) 603 | item = QtWidgets.QTableWidgetItem() 604 | self.tableWidget.setItem(0, 2, item) 605 | item = QtWidgets.QTableWidgetItem() 606 | item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable 607 | | QtCore.Qt.ItemFlag.ItemIsEnabled) 608 | self.tableWidget.setItem(0, 3, item) 609 | self.tableWidget.horizontalHeader().setVisible(True) 610 | self.tableWidget.horizontalHeader().setCascadingSectionResizes(True) 611 | self.tableWidget.horizontalHeader().setDefaultSectionSize(60) 612 | self.tableWidget.horizontalHeader().setHighlightSections(True) 613 | self.tableWidget.horizontalHeader().setMinimumSectionSize(20) 614 | self.tableWidget.horizontalHeader().setSortIndicatorShown(False) 615 | self.tableWidget.horizontalHeader().setStretchLastSection(True) 616 | self.tableWidget.verticalHeader().setVisible(False) 617 | self.tableWidget.verticalHeader().setDefaultSectionSize(21) 618 | self.tableWidget.verticalHeader().setSortIndicatorShown(False) 619 | MainWindow.setCentralWidget(self.centralwidget) 620 | 621 | self.retranslateUi(MainWindow) 622 | QtCore.QMetaObject.connectSlotsByName(MainWindow) 623 | 624 | def retranslateUi(self, MainWindow): 625 | _translate = QtCore.QCoreApplication.translate 626 | MainWindow.setWindowTitle( 627 | _translate("MainWindow", "Dialogue Extractor v1.0")) 628 | self.menu_About.setTitle(_translate("MainWindow", "&关于")) 629 | self.actionAuthor_color_sky.setText( 630 | _translate("MainWindow", "&关于作者 (color·sky)")) 631 | self.actionAuthor_color_sky.triggered.connect(lambda: self.openAbout()) 632 | 633 | self.InputDirButton.setText(_translate("MainWindow", "导入路径")) 634 | self.InputDirButton.clicked.connect( 635 | lambda: self.getInputFolder(MainWindow)) 636 | self.OutputDirButton.setText(_translate("MainWindow", "导出路径")) 637 | self.OutputDirButton.clicked.connect( 638 | lambda: self.getOutputFolder(MainWindow)) 639 | 640 | self.EpisodeLabel.setText(_translate("MainWindow", "集数")) 641 | self.EpisodeSelection.setItemText(0, _translate("MainWindow", "全部")) 642 | self.EpisodeSelection.currentIndexChanged.connect( 643 | lambda: self.updateDialogue()) 644 | self.SearchLabel.setText(_translate("MainWindow", "搜索")) 645 | 646 | self.ScriptGenerateButton.setText(_translate("MainWindow", "剧本生成")) 647 | self.ScriptConfig.setText(_translate( 648 | "MainWindow", " S T R")) 649 | self.DenoiseCheckBox.setText( 650 | _translate("MainWindow", " 人声提取")) 651 | 652 | if not ENABLE_BETA: 653 | self.ScriptGenerateButton.setEnabled(False) 654 | self.SourceAmount.setEnabled(False) 655 | self.TargetAmount.setEnabled(False) 656 | self.RandomSeed.setEnabled(False) 657 | self.DenoiseCheckBox.setEnabled(False) 658 | else: 659 | self.ScriptGenerateButton.clicked.connect(lambda: self.generateScript()) 660 | 661 | self.SearchText.returnPressed.connect(lambda: self.updateSearch()) 662 | self.ConcatenateCheckBox.setText( 663 | _translate("MainWindow", " 合并多选")) 664 | self.ConcatenateCheckBox.setChecked(True) 665 | self.PreviewCheckBox.setText( 666 | _translate("MainWindow", " 视频预览")) 667 | self.PreviewCheckBox.setChecked(True) 668 | self.LOffsetLabel.setText(_translate("MainWindow", "左偏移")) 669 | self.ROffsetLabel.setText(_translate("MainWindow", "右偏移")) 670 | 671 | self.seconds_1.setText(_translate("MainWindow", "秒")) 672 | self.PerviewButton.setText(_translate("MainWindow", "预览")) 673 | self.PerviewButton.clicked.connect(lambda: self.previewSelected()) 674 | 675 | self.seconds_2.setText(_translate("MainWindow", "秒")) 676 | self.ExportButton.setText(_translate("MainWindow", "提取")) 677 | self.ExportButton.clicked.connect(lambda: self.exportSelected()) 678 | 679 | item = self.tableWidget.horizontalHeaderItem(0) 680 | item.setText(_translate("MainWindow", "集数")) 681 | item = self.tableWidget.horizontalHeaderItem(1) 682 | item.setText(_translate("MainWindow", "开始")) 683 | item = self.tableWidget.horizontalHeaderItem(2) 684 | item.setText(_translate("MainWindow", "结束")) 685 | item = self.tableWidget.horizontalHeaderItem(3) 686 | item.setText(_translate("MainWindow", "字幕")) 687 | __sortingEnabled = self.tableWidget.isSortingEnabled() 688 | self.tableWidget.setSortingEnabled(False) 689 | self.tableWidget.setSortingEnabled(__sortingEnabled) 690 | # self.tableWidget.doubleClicked.connect(lambda: self.previewSelected()) 691 | 692 | 693 | if __name__ == "__main__": 694 | import sys 695 | app = QtWidgets.QApplication(sys.argv) 696 | if ENABLE_BETA: 697 | from spleeter.separator import Separator 698 | from Bert_ext import extractive_summarize 699 | separator = Separator('spleeter:4stems') 700 | MainWindow = QtWidgets.QMainWindow() 701 | ui = Ui_MainWindow() 702 | ui.setupUi(MainWindow) 703 | MainWindow.show() 704 | sys.exit(app.exec()) 705 | -------------------------------------------------------------------------------- /DialogueExtractor_ch/config.json: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /DialogueExtractor_ch/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/COLOR-SKY/DialogueExtractor/8f9ae060ded848493763b53c45ebab10d70b6df9/DialogueExtractor_ch/icon.png -------------------------------------------------------------------------------- /DialogueExtractor_ch/icon2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/COLOR-SKY/DialogueExtractor/8f9ae060ded848493763b53c45ebab10d70b6df9/DialogueExtractor_ch/icon2.png -------------------------------------------------------------------------------- /DialogueExtractor_ch/icon3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/COLOR-SKY/DialogueExtractor/8f9ae060ded848493763b53c45ebab10d70b6df9/DialogueExtractor_ch/icon3.png -------------------------------------------------------------------------------- /DialogueExtractor_ch/prototypes/Test.py: -------------------------------------------------------------------------------- 1 | # Form implementation generated from reading ui file 'Test.ui' 2 | # 3 | # Created by: PyQt6 UI code generator 6.1.0 4 | # 5 | # WARNING: Any manual changes made to this file will be lost when pyuic6 is 6 | # run again. Do not edit this file unless you know what you are doing. 7 | 8 | 9 | from PyQt6 import QtCore, QtGui, QtWidgets 10 | 11 | 12 | class Ui_MainWindow(object): 13 | def setupUi(self, MainWindow): 14 | MainWindow.setObjectName("MainWindow") 15 | MainWindow.resize(800, 600) 16 | self.centralwidget = QtWidgets.QWidget(MainWindow) 17 | self.centralwidget.setObjectName("centralwidget") 18 | MainWindow.setCentralWidget(self.centralwidget) 19 | self.menubar = QtWidgets.QMenuBar(MainWindow) 20 | self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 22)) 21 | self.menubar.setObjectName("menubar") 22 | self.menu_About = QtWidgets.QMenu(self.menubar) 23 | self.menu_About.setObjectName("menu_About") 24 | MainWindow.setMenuBar(self.menubar) 25 | self.statusbar = QtWidgets.QStatusBar(MainWindow) 26 | self.statusbar.setObjectName("statusbar") 27 | MainWindow.setStatusBar(self.statusbar) 28 | self.actionAuthor_color_sky = QtGui.QAction(MainWindow) 29 | self.actionAuthor_color_sky.setObjectName("actionAuthor_color_sky") 30 | self.menu_About.addAction(self.actionAuthor_color_sky) 31 | self.menubar.addAction(self.menu_About.menuAction()) 32 | 33 | self.retranslateUi(MainWindow) 34 | QtCore.QMetaObject.connectSlotsByName(MainWindow) 35 | 36 | def retranslateUi(self, MainWindow): 37 | _translate = QtCore.QCoreApplication.translate 38 | MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) 39 | self.menu_About.setTitle(_translate("MainWindow", "&About")) 40 | self.actionAuthor_color_sky.setText(_translate("MainWindow", "&Author(color·sky)")) 41 | 42 | if __name__ == "__main__": 43 | import sys 44 | app = QtWidgets.QApplication(sys.argv) 45 | MainWindow = QtWidgets.QMainWindow() 46 | ui = Ui_MainWindow() 47 | ui.setupUi(MainWindow) 48 | MainWindow.show() 49 | sys.exit(app.exec()) -------------------------------------------------------------------------------- /DialogueExtractor_ch/prototypes/Test.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 800 10 | 600 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | 18 | 19 | 20 | 0 21 | 0 22 | 800 23 | 22 24 | 25 | 26 | 27 | 28 | &About 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | &Author(color·sky) 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /DialogueExtractor_ch/prototypes/UI.aep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/COLOR-SKY/DialogueExtractor/8f9ae060ded848493763b53c45ebab10d70b6df9/DialogueExtractor_ch/prototypes/UI.aep -------------------------------------------------------------------------------- /DialogueExtractor_ch/prototypes/UI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/COLOR-SKY/DialogueExtractor/8f9ae060ded848493763b53c45ebab10d70b6df9/DialogueExtractor_ch/prototypes/UI.png -------------------------------------------------------------------------------- /DialogueExtractor_ch/prototypes/UI.py: -------------------------------------------------------------------------------- 1 | # Form implementation generated from reading ui file 'UI.ui' 2 | # 3 | # Created by: PyQt6 UI code generator 6.1.0 4 | # 5 | # WARNING: Any manual changes made to this file will be lost when pyuic6 is 6 | # run again. Do not edit this file unless you know what you are doing. 7 | 8 | 9 | from PyQt6 import QtCore, QtGui, QtWidgets 10 | 11 | 12 | class Ui_MainWindow(object): 13 | def setupUi(self, MainWindow): 14 | MainWindow.setObjectName("MainWindow") 15 | MainWindow.setEnabled(True) 16 | MainWindow.resize(600, 600) 17 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Fixed, QtWidgets.QSizePolicy.Policy.Fixed) 18 | sizePolicy.setHorizontalStretch(0) 19 | sizePolicy.setVerticalStretch(0) 20 | sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth()) 21 | MainWindow.setSizePolicy(sizePolicy) 22 | MainWindow.setMinimumSize(QtCore.QSize(600, 600)) 23 | MainWindow.setMaximumSize(QtCore.QSize(600, 600)) 24 | MainWindow.setAutoFillBackground(False) 25 | MainWindow.setAnimated(True) 26 | self.centralwidget = QtWidgets.QWidget(MainWindow) 27 | self.centralwidget.setObjectName("centralwidget") 28 | self.OutputDirButton = QtWidgets.QPushButton(self.centralwidget) 29 | self.OutputDirButton.setEnabled(True) 30 | self.OutputDirButton.setGeometry(QtCore.QRect(500, 54, 80, 40)) 31 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Minimum) 32 | sizePolicy.setHorizontalStretch(0) 33 | sizePolicy.setVerticalStretch(0) 34 | sizePolicy.setHeightForWidth(self.OutputDirButton.sizePolicy().hasHeightForWidth()) 35 | self.OutputDirButton.setSizePolicy(sizePolicy) 36 | self.OutputDirButton.setFocusPolicy(QtCore.Qt.FocusPolicy.NoFocus) 37 | self.OutputDirButton.setObjectName("OutputDirButton") 38 | self.InputDirectory = QtWidgets.QTextEdit(self.centralwidget) 39 | self.InputDirectory.setEnabled(False) 40 | self.InputDirectory.setGeometry(QtCore.QRect(20, 20, 470, 30)) 41 | self.InputDirectory.setObjectName("InputDirectory") 42 | self.OutputDirectory = QtWidgets.QTextEdit(self.centralwidget) 43 | self.OutputDirectory.setEnabled(False) 44 | self.OutputDirectory.setGeometry(QtCore.QRect(20, 60, 470, 30)) 45 | self.OutputDirectory.setObjectName("OutputDirectory") 46 | self.EpisodeLabel = QtWidgets.QLabel(self.centralwidget) 47 | self.EpisodeLabel.setGeometry(QtCore.QRect(20, 100, 60, 30)) 48 | self.EpisodeLabel.setObjectName("EpisodeLabel") 49 | self.EpisodeSelection = QtWidgets.QComboBox(self.centralwidget) 50 | self.EpisodeSelection.setGeometry(QtCore.QRect(73, 106, 120, 21)) 51 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Preferred) 52 | sizePolicy.setHorizontalStretch(0) 53 | sizePolicy.setVerticalStretch(0) 54 | sizePolicy.setHeightForWidth(self.EpisodeSelection.sizePolicy().hasHeightForWidth()) 55 | self.EpisodeSelection.setSizePolicy(sizePolicy) 56 | self.EpisodeSelection.setFocusPolicy(QtCore.Qt.FocusPolicy.NoFocus) 57 | self.EpisodeSelection.setObjectName("EpisodeSelection") 58 | self.EpisodeSelection.addItem("") 59 | self.DialogueRegexLabel = QtWidgets.QLabel(self.centralwidget) 60 | self.DialogueRegexLabel.setGeometry(QtCore.QRect(210, 100, 100, 30)) 61 | self.DialogueRegexLabel.setObjectName("DialogueRegexLabel") 62 | self.DialogueRegexInput = QtWidgets.QTextEdit(self.centralwidget) 63 | self.DialogueRegexInput.setGeometry(QtCore.QRect(310, 100, 270, 30)) 64 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) 65 | sizePolicy.setHorizontalStretch(0) 66 | sizePolicy.setVerticalStretch(0) 67 | sizePolicy.setHeightForWidth(self.DialogueRegexInput.sizePolicy().hasHeightForWidth()) 68 | self.DialogueRegexInput.setSizePolicy(sizePolicy) 69 | self.DialogueRegexInput.setObjectName("DialogueRegexInput") 70 | self.SearchText = QtWidgets.QTextEdit(self.centralwidget) 71 | self.SearchText.setGeometry(QtCore.QRect(79, 140, 500, 30)) 72 | self.SearchText.setObjectName("SearchText") 73 | self.SearchLabel = QtWidgets.QLabel(self.centralwidget) 74 | self.SearchLabel.setGeometry(QtCore.QRect(20, 140, 60, 30)) 75 | self.SearchLabel.setObjectName("SearchLabel") 76 | self.DenoiseCheckBox = QtWidgets.QCheckBox(self.centralwidget) 77 | self.DenoiseCheckBox.setGeometry(QtCore.QRect(456, 360, 110, 45)) 78 | font = QtGui.QFont() 79 | font.setPointSize(14) 80 | self.DenoiseCheckBox.setFont(font) 81 | self.DenoiseCheckBox.setChecked(False) 82 | self.DenoiseCheckBox.setObjectName("DenoiseCheckBox") 83 | self.LOffsetSpinBox = QtWidgets.QDoubleSpinBox(self.centralwidget) 84 | self.LOffsetSpinBox.setGeometry(QtCore.QRect(510, 402, 60, 35)) 85 | self.LOffsetSpinBox.setMinimum(-1000.0) 86 | self.LOffsetSpinBox.setMaximum(1000.0) 87 | self.LOffsetSpinBox.setSingleStep(0.5) 88 | self.LOffsetSpinBox.setObjectName("LOffsetSpinBox") 89 | self.LOffsetLabel = QtWidgets.QLabel(self.centralwidget) 90 | self.LOffsetLabel.setGeometry(QtCore.QRect(460, 402, 50, 35)) 91 | self.LOffsetLabel.setObjectName("LOffsetLabel") 92 | self.ROffsetLabel = QtWidgets.QLabel(self.centralwidget) 93 | self.ROffsetLabel.setGeometry(QtCore.QRect(460, 442, 50, 35)) 94 | self.ROffsetLabel.setObjectName("ROffsetLabel") 95 | self.ROffsetSpinBox = QtWidgets.QDoubleSpinBox(self.centralwidget) 96 | self.ROffsetSpinBox.setGeometry(QtCore.QRect(510, 442, 60, 35)) 97 | self.ROffsetSpinBox.setMinimum(-1000.0) 98 | self.ROffsetSpinBox.setMaximum(1000.0) 99 | self.ROffsetSpinBox.setSingleStep(0.5) 100 | self.ROffsetSpinBox.setObjectName("ROffsetSpinBox") 101 | self.seconds_1 = QtWidgets.QLabel(self.centralwidget) 102 | self.seconds_1.setGeometry(QtCore.QRect(580, 402, 10, 35)) 103 | self.seconds_1.setObjectName("seconds_1") 104 | self.PerviewButton = QtWidgets.QPushButton(self.centralwidget) 105 | self.PerviewButton.setEnabled(True) 106 | self.PerviewButton.setGeometry(QtCore.QRect(460, 482, 131, 50)) 107 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Minimum) 108 | sizePolicy.setHorizontalStretch(0) 109 | sizePolicy.setVerticalStretch(0) 110 | sizePolicy.setHeightForWidth(self.PerviewButton.sizePolicy().hasHeightForWidth()) 111 | self.PerviewButton.setSizePolicy(sizePolicy) 112 | self.PerviewButton.setFocusPolicy(QtCore.Qt.FocusPolicy.NoFocus) 113 | self.PerviewButton.setObjectName("PerviewButton") 114 | self.seconds_2 = QtWidgets.QLabel(self.centralwidget) 115 | self.seconds_2.setGeometry(QtCore.QRect(580, 442, 10, 35)) 116 | self.seconds_2.setObjectName("seconds_2") 117 | self.ExportButton = QtWidgets.QPushButton(self.centralwidget) 118 | self.ExportButton.setEnabled(True) 119 | self.ExportButton.setGeometry(QtCore.QRect(460, 534, 131, 50)) 120 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Minimum) 121 | sizePolicy.setHorizontalStretch(0) 122 | sizePolicy.setVerticalStretch(0) 123 | sizePolicy.setHeightForWidth(self.ExportButton.sizePolicy().hasHeightForWidth()) 124 | self.ExportButton.setSizePolicy(sizePolicy) 125 | self.ExportButton.setFocusPolicy(QtCore.Qt.FocusPolicy.NoFocus) 126 | self.ExportButton.setObjectName("ExportButton") 127 | self.tableWidget = QtWidgets.QTableWidget(self.centralwidget) 128 | self.tableWidget.setGeometry(QtCore.QRect(20, 180, 420, 400)) 129 | self.tableWidget.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) 130 | self.tableWidget.setLineWidth(1) 131 | self.tableWidget.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.SizeAdjustPolicy.AdjustToContents) 132 | self.tableWidget.setEditTriggers(QtWidgets.QAbstractItemView.EditTrigger.NoEditTriggers) 133 | self.tableWidget.setAlternatingRowColors(True) 134 | self.tableWidget.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows) 135 | self.tableWidget.setGridStyle(QtCore.Qt.PenStyle.NoPen) 136 | self.tableWidget.setWordWrap(True) 137 | self.tableWidget.setRowCount(20) 138 | self.tableWidget.setColumnCount(4) 139 | self.tableWidget.setObjectName("tableWidget") 140 | item = QtWidgets.QTableWidgetItem() 141 | self.tableWidget.setHorizontalHeaderItem(0, item) 142 | item = QtWidgets.QTableWidgetItem() 143 | self.tableWidget.setHorizontalHeaderItem(1, item) 144 | item = QtWidgets.QTableWidgetItem() 145 | self.tableWidget.setHorizontalHeaderItem(2, item) 146 | item = QtWidgets.QTableWidgetItem() 147 | self.tableWidget.setHorizontalHeaderItem(3, item) 148 | item = QtWidgets.QTableWidgetItem() 149 | self.tableWidget.setItem(0, 0, item) 150 | item = QtWidgets.QTableWidgetItem() 151 | self.tableWidget.setItem(0, 1, item) 152 | item = QtWidgets.QTableWidgetItem() 153 | self.tableWidget.setItem(0, 2, item) 154 | item = QtWidgets.QTableWidgetItem() 155 | item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable|QtCore.Qt.ItemFlag.ItemIsEnabled) 156 | self.tableWidget.setItem(0, 3, item) 157 | self.tableWidget.horizontalHeader().setVisible(True) 158 | self.tableWidget.horizontalHeader().setCascadingSectionResizes(True) 159 | self.tableWidget.horizontalHeader().setDefaultSectionSize(60) 160 | self.tableWidget.horizontalHeader().setHighlightSections(True) 161 | self.tableWidget.horizontalHeader().setMinimumSectionSize(20) 162 | self.tableWidget.horizontalHeader().setSortIndicatorShown(False) 163 | self.tableWidget.horizontalHeader().setStretchLastSection(True) 164 | self.tableWidget.verticalHeader().setVisible(False) 165 | self.tableWidget.verticalHeader().setDefaultSectionSize(21) 166 | self.tableWidget.verticalHeader().setSortIndicatorShown(False) 167 | self.InputDirButton = QtWidgets.QPushButton(self.centralwidget) 168 | self.InputDirButton.setEnabled(True) 169 | self.InputDirButton.setGeometry(QtCore.QRect(500, 14, 80, 40)) 170 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Minimum) 171 | sizePolicy.setHorizontalStretch(0) 172 | sizePolicy.setVerticalStretch(0) 173 | sizePolicy.setHeightForWidth(self.InputDirButton.sizePolicy().hasHeightForWidth()) 174 | self.InputDirButton.setSizePolicy(sizePolicy) 175 | self.InputDirButton.setFocusPolicy(QtCore.Qt.FocusPolicy.NoFocus) 176 | self.InputDirButton.setObjectName("InputDirButton") 177 | MainWindow.setCentralWidget(self.centralwidget) 178 | 179 | self.retranslateUi(MainWindow) 180 | QtCore.QMetaObject.connectSlotsByName(MainWindow) 181 | 182 | def retranslateUi(self, MainWindow): 183 | _translate = QtCore.QCoreApplication.translate 184 | MainWindow.setWindowTitle(_translate("MainWindow", "Dialogue Extractor")) 185 | self.OutputDirButton.setText(_translate("MainWindow", "Output")) 186 | self.EpisodeLabel.setText(_translate("MainWindow", "Episode")) 187 | self.EpisodeSelection.setItemText(0, _translate("MainWindow", "All")) 188 | self.DialogueRegexLabel.setText(_translate("MainWindow", "Dialogue Regex")) 189 | self.SearchLabel.setText(_translate("MainWindow", "Search")) 190 | self.DenoiseCheckBox.setText(_translate("MainWindow", " Denoise")) 191 | self.LOffsetLabel.setText(_translate("MainWindow", "LOffset")) 192 | self.ROffsetLabel.setText(_translate("MainWindow", "ROffset")) 193 | self.seconds_1.setText(_translate("MainWindow", "s")) 194 | self.PerviewButton.setText(_translate("MainWindow", "Preview")) 195 | self.seconds_2.setText(_translate("MainWindow", "s")) 196 | self.ExportButton.setText(_translate("MainWindow", "Export")) 197 | item = self.tableWidget.horizontalHeaderItem(0) 198 | item.setText(_translate("MainWindow", "ep")) 199 | item = self.tableWidget.horizontalHeaderItem(1) 200 | item.setText(_translate("MainWindow", "st")) 201 | item = self.tableWidget.horizontalHeaderItem(2) 202 | item.setText(_translate("MainWindow", "et")) 203 | item = self.tableWidget.horizontalHeaderItem(3) 204 | item.setText(_translate("MainWindow", "Dialogue")) 205 | __sortingEnabled = self.tableWidget.isSortingEnabled() 206 | self.tableWidget.setSortingEnabled(False) 207 | item = self.tableWidget.item(0, 0) 208 | item.setText(_translate("MainWindow", "0")) 209 | item = self.tableWidget.item(0, 1) 210 | item.setText(_translate("MainWindow", "0:45:12")) 211 | item = self.tableWidget.item(0, 2) 212 | item.setText(_translate("MainWindow", "0:1:2")) 213 | item = self.tableWidget.item(0, 3) 214 | item.setText(_translate("MainWindow", "奥斯打破外额打破滴我")) 215 | self.tableWidget.setSortingEnabled(__sortingEnabled) 216 | self.InputDirButton.setText(_translate("MainWindow", "Input")) 217 | 218 | 219 | if __name__ == "__main__": 220 | import sys 221 | app = QtWidgets.QApplication(sys.argv) 222 | MainWindow = QtWidgets.QMainWindow() 223 | ui = Ui_MainWindow() 224 | ui.setupUi(MainWindow) 225 | MainWindow.show() 226 | sys.exit(app.exec()) 227 | -------------------------------------------------------------------------------- /DialogueExtractor_ch/prototypes/UI.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | true 7 | 8 | 9 | 10 | 0 11 | 0 12 | 600 13 | 600 14 | 15 | 16 | 17 | 18 | 0 19 | 0 20 | 21 | 22 | 23 | 24 | 600 25 | 600 26 | 27 | 28 | 29 | 30 | 600 31 | 600 32 | 33 | 34 | 35 | Dialogue Extractor 36 | 37 | 38 | false 39 | 40 | 41 | true 42 | 43 | 44 | 45 | 46 | true 47 | 48 | 49 | 50 | 500 51 | 54 52 | 80 53 | 40 54 | 55 | 56 | 57 | 58 | 0 59 | 0 60 | 61 | 62 | 63 | Qt::NoFocus 64 | 65 | 66 | Output 67 | 68 | 69 | 70 | 71 | false 72 | 73 | 74 | 75 | 20 76 | 20 77 | 470 78 | 30 79 | 80 | 81 | 82 | 83 | 84 | false 85 | 86 | 87 | 88 | 20 89 | 60 90 | 470 91 | 30 92 | 93 | 94 | 95 | 96 | 97 | 98 | 20 99 | 100 100 | 60 101 | 30 102 | 103 | 104 | 105 | Episode 106 | 107 | 108 | 109 | 110 | 111 | 73 112 | 106 113 | 120 114 | 21 115 | 116 | 117 | 118 | 119 | 0 120 | 0 121 | 122 | 123 | 124 | Qt::NoFocus 125 | 126 | 127 | 128 | All 129 | 130 | 131 | 132 | 133 | 134 | 135 | 210 136 | 100 137 | 100 138 | 30 139 | 140 | 141 | 142 | Dialogue Regex 143 | 144 | 145 | 146 | 147 | 148 | 310 149 | 100 150 | 270 151 | 30 152 | 153 | 154 | 155 | 156 | 0 157 | 0 158 | 159 | 160 | 161 | 162 | 163 | 164 | 79 165 | 140 166 | 500 167 | 30 168 | 169 | 170 | 171 | 172 | 173 | 174 | 20 175 | 140 176 | 60 177 | 30 178 | 179 | 180 | 181 | Search 182 | 183 | 184 | 185 | 186 | 187 | 456 188 | 360 189 | 110 190 | 45 191 | 192 | 193 | 194 | 195 | 14 196 | 197 | 198 | 199 | Denoise 200 | 201 | 202 | false 203 | 204 | 205 | 206 | 207 | 208 | 510 209 | 402 210 | 60 211 | 35 212 | 213 | 214 | 215 | -1000.000000000000000 216 | 217 | 218 | 1000.000000000000000 219 | 220 | 221 | 0.500000000000000 222 | 223 | 224 | 225 | 226 | 227 | 460 228 | 402 229 | 50 230 | 35 231 | 232 | 233 | 234 | LOffset 235 | 236 | 237 | 238 | 239 | 240 | 460 241 | 442 242 | 50 243 | 35 244 | 245 | 246 | 247 | ROffset 248 | 249 | 250 | 251 | 252 | 253 | 510 254 | 442 255 | 60 256 | 35 257 | 258 | 259 | 260 | -1000.000000000000000 261 | 262 | 263 | 1000.000000000000000 264 | 265 | 266 | 0.500000000000000 267 | 268 | 269 | 270 | 271 | 272 | 580 273 | 402 274 | 10 275 | 35 276 | 277 | 278 | 279 | s 280 | 281 | 282 | 283 | 284 | true 285 | 286 | 287 | 288 | 460 289 | 482 290 | 131 291 | 50 292 | 293 | 294 | 295 | 296 | 0 297 | 0 298 | 299 | 300 | 301 | Qt::NoFocus 302 | 303 | 304 | Preview 305 | 306 | 307 | 308 | 309 | 310 | 580 311 | 442 312 | 10 313 | 35 314 | 315 | 316 | 317 | s 318 | 319 | 320 | 321 | 322 | true 323 | 324 | 325 | 326 | 460 327 | 534 328 | 131 329 | 50 330 | 331 | 332 | 333 | 334 | 0 335 | 0 336 | 337 | 338 | 339 | Qt::NoFocus 340 | 341 | 342 | Export 343 | 344 | 345 | 346 | 347 | 348 | 20 349 | 180 350 | 420 351 | 400 352 | 353 | 354 | 355 | QFrame::Sunken 356 | 357 | 358 | 1 359 | 360 | 361 | QAbstractScrollArea::AdjustToContents 362 | 363 | 364 | QAbstractItemView::NoEditTriggers 365 | 366 | 367 | true 368 | 369 | 370 | QAbstractItemView::SelectRows 371 | 372 | 373 | Qt::NoPen 374 | 375 | 376 | true 377 | 378 | 379 | 20 380 | 381 | 382 | 4 383 | 384 | 385 | true 386 | 387 | 388 | true 389 | 390 | 391 | 20 392 | 393 | 394 | 60 395 | 396 | 397 | true 398 | 399 | 400 | false 401 | 402 | 403 | true 404 | 405 | 406 | false 407 | 408 | 409 | 21 410 | 411 | 412 | false 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | ep 437 | 438 | 439 | 440 | 441 | st 442 | 443 | 444 | 445 | 446 | et 447 | 448 | 449 | 450 | 451 | Dialogue 452 | 453 | 454 | 455 | 456 | 0 457 | 458 | 459 | 460 | 461 | 0:45:12 462 | 463 | 464 | 465 | 466 | 0:1:2 467 | 468 | 469 | 470 | 471 | 奥斯打破外额打破滴我 472 | 473 | 474 | ItemIsSelectable|ItemIsEnabled 475 | 476 | 477 | 478 | 479 | 480 | true 481 | 482 | 483 | 484 | 500 485 | 14 486 | 80 487 | 40 488 | 489 | 490 | 491 | 492 | 0 493 | 0 494 | 495 | 496 | 497 | Qt::NoFocus 498 | 499 | 500 | Input 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | -------------------------------------------------------------------------------- /DialogueExtractor_ch/prototypes/logo_1.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/COLOR-SKY/DialogueExtractor/8f9ae060ded848493763b53c45ebab10d70b6df9/DialogueExtractor_ch/prototypes/logo_1.psd -------------------------------------------------------------------------------- /DialogueExtractor_ch/requirements-beta.txt: -------------------------------------------------------------------------------- 1 | ###### spacy w/ neuralcoref only works with python3.7 ###### 2 | PyQt6 3 | pysub-parser 4 | libsndfile 5 | ffmpeg 6 | spleeter 7 | bert-extractive-summarizer 8 | spacy==2.3.7 9 | transformers 10 | neuralcoref 11 | sentencepiece 12 | tensorflow -------------------------------------------------------------------------------- /DialogueExtractor_ch/requirements.txt: -------------------------------------------------------------------------------- 1 | PyQt6 2 | pysub-parser -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Video Demo: https://www.bilibili.com/video/BV1Ba41187cP/ 2 | 3 | # DialogueExtractor 4 | A tool that extracts video clips using subtitles 5 | 6 | # Pre-requisit 7 | * `ffmpeg ffprobe` added to system path 8 | * Basic features: pip install -r requirements.txt 9 | * Beta features: pip install -r requirements-beta.txt 10 | 11 | # Beta Features 12 | Change line#16 in DialogueExtractor.py to **TRUE** to enable beta features 13 | 14 | # FAQ 15 | * UnicodeDecodeError: "utf-8" codec can't decode byte 0x.... : invalid continuation byte. 16 | 17 | * Your subtitle file may not be encoded with "utf-8", please double check. --------------------------------------------------------------------------------