1
0
Fork 0
mirror of https://github.com/Findus23/cr-search.git synced 2024-09-19 15:23:44 +02:00

initial commit

This commit is contained in:
Lukas Winkler 2020-03-07 10:45:39 +01:00
commit 78bb5da2bf
Signed by: lukas
GPG key ID: 54DE4D798D244853
89 changed files with 11048 additions and 0 deletions

118
.gitignore vendored Normal file
View file

@ -0,0 +1,118 @@
# Created by https://www.gitignore.io/api/python
# Edit at https://www.gitignore.io/?templates=python
### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# pyenv
.python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# Mr Developer
.mr.developer.cfg
.project
.pydevproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# End of https://www.gitignore.io/api/python
.idea
FINAL*
sonic/
python-sonic-client/
notes.md
data/

23
app.py Normal file
View file

@ -0,0 +1,23 @@
import sentry_sdk
from flask import Flask
from playhouse.flask_utils import FlaskDB
from playhouse.pool import PooledPostgresqlDatabase
from sentry_sdk.integrations.flask import FlaskIntegration
import config
DATABASE = PooledPostgresqlDatabase(**config.dbauth)
if config.sentryDSN:
sentry_sdk.init(
dsn=config.sentryDSN,
integrations=[FlaskIntegration()]
)
# Create a Flask WSGI app and configure it using values from the module.
app = Flask(__name__)
app.config.from_object(__name__)
flask_db = FlaskDB(app)
db = flask_db.database

20
colors.py Normal file
View file

@ -0,0 +1,20 @@
from models import Person
colors = {
"Laura": "#59c3f9",
"Marisha": "#00146e",
"Liam": "#fe8413",
"Taliesin": "#be1c0d",
"Ashley": "#868984",
"Sam": "#dae1dd",
"Travis": "#076708",
"Matt": "#471f0e" # random color
}
p: Person
for p in Person.select():
print(p)
if p.name in colors.keys():
print(p.name)
p.color = colors[p.name]
p.save()

48
complete.py Normal file
View file

@ -0,0 +1,48 @@
import readline
from models import Phrase
class SimpleCompleter:
def __init__(self):
return
def complete(self, text, state):
response = None
if state == 0:
# This is the first time for this text, so build a match list.
if text:
phrases = Phrase.select().where((Phrase.until_episode == 9) & (Phrase.text % ("%" + text + "%")))
self.matches = [p.text for p in phrases]
# self.matches = [s
# for s in self.options
# if s and s.startswith(text)]
# Return the state'th item from the match list,
# if we have that many.
try:
response = self.matches[state]
except IndexError:
response = None
return response
def input_loop():
line = ''
while line != 'stop':
line = input('Prompt ("stop" to quit): ')
print('Dispatch %s' % line)
phrases = Phrase.select().where((Phrase.until_episode == 9) & (Phrase.text % ("%" + "test" + "%")))
print([p.text for p in phrases])
# Register our completer function
readline.set_completer(SimpleCompleter().complete)
# Use the tab key for completion
readline.parse_and_bind('tab: complete')
# Prompt the user for text
input_loop()

9
config.py Normal file
View file

@ -0,0 +1,9 @@
dbauth = {
"database": 'crsearch',
"user": 'crsearch',
"password": 'crsearch',
"port": 5433,
"host": "127.0.0.1"
}
sentryDSN = None

6
createdb.py Normal file
View file

@ -0,0 +1,6 @@
from models import db, Episode, Person, Line, Phrase
# db.drop_tables([Episode, Person, Line, Phrase])
# db.create_tables([Episode, Person, Line, Phrase])
db.drop_tables([Phrase])
db.create_tables([Phrase])

38
fetch.py Normal file
View file

@ -0,0 +1,38 @@
from subprocess import run
import youtube_dl
from models import Episode
from utils import srtdir
campaign_playlists = {2: "https://www.youtube.com/playlist?list=PL1tiwbzkOjQxD0jjAE7PsWoaCrs0EkBH2"}
campaign = 2
ydl_opts = {
'extract_flat': True
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
# ydl.download(['https://www.youtube.com/watch?v=BaW_jenozKc'])
playlist = ydl.extract_info(campaign_playlists[campaign], download=False)
ids = [v["url"] for v in playlist["entries"]]
print(ids)
ydl_opts = {
"writesubtitles": True,
"subtitleslangs": ["en"],
"skip_download": True,
}
for nr, id in enumerate(ids, 1):
vttfile = srtdir / f"C{campaign}E{nr}"
ydl_opts["outtmpl"] = str(vttfile)
e = Episode()
e.season = campaign
e.episode_number = nr
e.youtube_id = id
e.save()
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download([f'https://www.youtube.com/watch?v={id}'])
run(["ffmpeg", "-i", vttfile.with_suffix(".en.vtt"), vttfile.with_suffix(".srt")])
vttfile.with_suffix(".en.vtt").unlink()

16
index.py Normal file
View file

@ -0,0 +1,16 @@
from sonic import IngestClient, ControlClient
from models import Line
with IngestClient("127.0.0.1", 1491, "SecretPassword") as ingestcl:
ingestcl.flush_collection("crsearch")
total = Line.select().count()
i = 0
for line in Line.select():
ingestcl.push("crsearch", "crsearch", str(line.id), line.text,lang="eng")
if i % 100 == 0: print(i, total)
i += 1
print(ingestcl.count("crsearch", "crsearch"))
with ControlClient("127.0.0.1", 1491, "SecretPassword") as controlcl:
controlcl.trigger("consolidate")

49
main.py Normal file
View file

@ -0,0 +1,49 @@
from html import unescape
from peewee import fn
from srt import parse
from models import Person, Line, Episode, db
from typo import fix_typo
from utils import td_to_milliseconds, get_filename
campaign = 2
for episode_nr in range(1, 95):
file = get_filename(campaign, episode_nr)
text = file.read_text()
subtitlelines = parse(text)
print(episode_nr)
person = None
episode = Episode.get(season=campaign, episode_number=episode_nr)
with db.atomic():
i = 0
for line in subtitlelines:
i += 1
assert i == line.index
text = unescape(line.content)
dbline = Line()
if ":" in text:
name, resttext = text.split(":", maxsplit=1)
if name.isupper():
formatted_name = fix_typo(name.strip()).title()
if formatted_name == "San":
print(name.title())
person, created = Person.get_or_create(name=formatted_name)
text = resttext.strip()
else:
if text.startswith("(") and text.endswith(")"):
dbline.isnote = True
person = None
elif text.startswith("[") and text.endswith("]"):
dbline.ismeta = True
person = None
text = text.replace("\n", " ")
dbline.text = text
dbline.search_text = fn.to_tsvector('english', text)
dbline.person = person
dbline.starttime = td_to_milliseconds(line.start)
dbline.endtime = td_to_milliseconds(line.end)
dbline.episode = episode
dbline.order = line.index
dbline.save()

72
models.py Normal file
View file

@ -0,0 +1,72 @@
from peewee import PostgresqlDatabase, Model, IntegerField, CharField, BooleanField, ForeignKeyField
from playhouse.postgres_ext import TSVectorField
from config import dbauth
db = PostgresqlDatabase(**dbauth)
db.connect()
class BaseModel(Model):
class Meta:
database = db
class Episode(BaseModel):
season = IntegerField()
episode_number = IntegerField()
youtube_id = CharField(max_length=11)
class Meta:
indexes = ((("season", "episode_number"), True),)
@property
def name(self) -> str:
return f"C{self.season}E{self.episode_number:03d}"
class Person(BaseModel):
name = CharField(unique=True)
color = CharField(null=True)
FULL_TEXT_SEARCH = '''SELECT id, text, ts_rank_cd(search_text, query) AS rank
FROM line,
to_tsquery('english', %s) query
WHERE search_text @@ query
ORDER BY rank DESC
'''
class Line(BaseModel):
text = CharField()
search_text = TSVectorField()
person = ForeignKeyField(Person, backref="lines", null=True)
isnote = BooleanField(default=False)
ismeta = BooleanField(default=False)
starttime = IntegerField()
endtime = IntegerField()
episode = ForeignKeyField(Episode, backref="lines")
order = IntegerField()
class Meta:
indexes = ((("episode", "order"), True),)
@classmethod
def full_text_search(cls, query_string: str):
cursor = cls._meta.database.execute_sql(
FULL_TEXT_SEARCH,
(query_string,)
)
result = cursor.fetchall()
cursor.close()
return result
class Phrase(BaseModel):
text = CharField()
count = IntegerField()
until_episode = ForeignKeyField(Episode, backref="phrase")
class Meta:
indexes = ((("text", "until_episode"), True),)

50
phrases.py Normal file
View file

@ -0,0 +1,50 @@
from collections import Counter
import spacy as spacy
from progress.bar import IncrementalBar
from spacy.lang.en import English
from spacy.tokens.span import Span
from spacy.tokens.token import Token
from models import Episode, Line, db, Phrase
from stopwords import STOP_WORDS
nlp: English = spacy.load("en_core_web_sm", disable=["ner", "textcat"])
nlp.Defaults.stop_words = STOP_WORDS
cnt = Counter()
campaign = 2
for episode in Episode.select().where(Episode.season == campaign):
print(f"Episode {episode}")
person = None
text = ""
line_select = Line.select().where(Line.episode == episode)
with IncrementalBar('Parsing lines', max=line_select.count(), suffix="%(percent).1f%% - %(eta)ds") as bar:
for line in Line.select().where(Line.episode == episode):
bar.next()
if line.person == person:
text += " " + line.text
else:
person = line.person
text += "\n"
delete = ["\"", "--", "(", ")", "[", "]"]
for string in delete:
text = text.replace(string, "")
print("run nlp")
doc = nlp(text)
nouns = []
span: Span
for span in doc.noun_chunks:
tok: Token
noun_chunk = "".join([tok.text_with_ws for tok in span if not tok.is_stop]).strip()
nouns.append(noun_chunk)
cnt.update(nouns)
with db.atomic():
with IncrementalBar('inserting phrases', max=len(cnt)) as bar:
for phrase, count in cnt.items():
bar.next()
if "\n" in phrase:
continue
if len(phrase) < 4:
continue
Phrase.create(text=phrase, count=count, until_episode=episode)

646
poetry.lock generated Normal file
View file

@ -0,0 +1,646 @@
[[package]]
category = "main"
description = "The Blis BLAS-like linear algebra library, as a self-contained C-extension."
name = "blis"
optional = false
python-versions = "*"
version = "0.4.1"
[package.dependencies]
numpy = ">=1.15.0"
[[package]]
category = "main"
description = "Super lightweight function registries for your library"
name = "catalogue"
optional = false
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7"
version = "1.0.0"
[[package]]
category = "main"
description = "Python package for providing Mozilla's CA Bundle."
name = "certifi"
optional = false
python-versions = "*"
version = "2019.11.28"
[[package]]
category = "main"
description = "Universal encoding detector for Python 2 and 3"
name = "chardet"
optional = false
python-versions = "*"
version = "3.0.4"
[[package]]
category = "main"
description = "Composable command line interface toolkit"
name = "click"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
version = "7.0"
[[package]]
category = "main"
description = "Manage calls to calloc/free through Cython"
name = "cymem"
optional = false
python-versions = "*"
version = "2.0.3"
[[package]]
category = "main"
description = "English multi-task CNN trained on OntoNotes. Assigns context-specific token vectors, POS tags, dependency parse and named entities."
name = "en_core_web_sm"
optional = false
python-versions = "*"
version = "2.2.5"
[package.dependencies]
spacy = ">=2.2.2"
[package.source]
reference = ""
type = "url"
url = "https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.2.5/en_core_web_sm-2.2.5.tar.gz"
[[package]]
category = "main"
description = "A simple framework for building complex web applications."
name = "flask"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
version = "1.1.1"
[package.dependencies]
Jinja2 = ">=2.10.1"
Werkzeug = ">=0.15"
click = ">=5.1"
itsdangerous = ">=0.24"
[package.extras]
dev = ["pytest", "coverage", "tox", "sphinx", "pallets-sphinx-themes", "sphinxcontrib-log-cabinet", "sphinx-issues"]
docs = ["sphinx", "pallets-sphinx-themes", "sphinxcontrib-log-cabinet", "sphinx-issues"]
dotenv = ["python-dotenv"]
[[package]]
category = "main"
description = "Internationalized Domain Names in Applications (IDNA)"
name = "idna"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
version = "2.9"
[[package]]
category = "main"
description = "Various helpers to pass data to untrusted environments and back."
name = "itsdangerous"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
version = "1.1.0"
[[package]]
category = "main"
description = "A very fast and expressive template engine."
name = "jinja2"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
version = "2.11.1"
[package.dependencies]
MarkupSafe = ">=0.23"
[package.extras]
i18n = ["Babel (>=0.8)"]
[[package]]
category = "main"
description = "Safely add untrusted strings to HTML/XML markup."
name = "markupsafe"
optional = false
python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*"
version = "1.1.1"
[[package]]
category = "main"
description = "Cython bindings for MurmurHash"
name = "murmurhash"
optional = false
python-versions = "*"
version = "1.0.2"
[[package]]
category = "main"
description = "NumPy is the fundamental package for array computing with Python."
name = "numpy"
optional = false
python-versions = ">=3.5"
version = "1.18.1"
[[package]]
category = "main"
description = "a little orm"
name = "peewee"
optional = false
python-versions = "*"
version = "3.13.1"
[[package]]
category = "main"
description = "The smartest command line arguments parser in the world"
name = "plac"
optional = false
python-versions = "*"
version = "1.1.3"
[[package]]
category = "main"
description = "Cython hash table that trusts the keys are pre-hashed"
name = "preshed"
optional = false
python-versions = "*"
version = "3.0.2"
[package.dependencies]
cymem = ">=2.0.2,<2.1.0"
murmurhash = ">=0.28.0,<1.1.0"
[[package]]
category = "main"
description = "Easy to use progress bars"
name = "progress"
optional = false
python-versions = "*"
version = "1.5"
[[package]]
category = "main"
description = "psycopg2 - Python-PostgreSQL Database Adapter"
name = "psycopg2"
optional = false
python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*"
version = "2.8.4"
[[package]]
category = "main"
description = "Pure Python MySQL Driver"
name = "pymysql"
optional = false
python-versions = "*"
version = "0.9.3"
[package.extras]
rsa = ["cryptography"]
[[package]]
category = "main"
description = "Python HTTP for Humans."
name = "requests"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
version = "2.23.0"
[package.dependencies]
certifi = ">=2017.4.17"
chardet = ">=3.0.2,<4"
idna = ">=2.5,<3"
urllib3 = ">=1.21.1,<1.25.0 || >1.25.0,<1.25.1 || >1.25.1,<1.26"
[package.extras]
security = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)"]
socks = ["PySocks (>=1.5.6,<1.5.7 || >1.5.7)", "win-inet-pton"]
[[package]]
category = "main"
description = "Python client for Sentry (https://getsentry.com)"
name = "sentry-sdk"
optional = false
python-versions = "*"
version = "0.14.2"
[package.dependencies]
certifi = "*"
urllib3 = ">=1.10.0"
[package.extras]
aiohttp = ["aiohttp (>=3.5)"]
beam = ["beam (>=2.12)"]
bottle = ["bottle (>=0.12.13)"]
celery = ["celery (>=3)"]
django = ["django (>=1.8)"]
falcon = ["falcon (>=1.4)"]
flask = ["flask (>=0.11)", "blinker (>=1.1)"]
pyspark = ["pyspark (>=2.4.4)"]
rq = ["0.6"]
sanic = ["sanic (>=0.8)"]
sqlalchemy = ["sqlalchemy (>=1.2)"]
tornado = ["tornado (>=5)"]
[[package]]
category = "main"
description = "python client for sonic search backend"
develop = true
name = "sonic-client"
optional = false
python-versions = "*"
version = "0.0.5"
[package.source]
reference = ""
type = "directory"
url = "python-sonic-client"
[[package]]
category = "main"
description = "Industrial-strength Natural Language Processing (NLP) in Python"
name = "spacy"
optional = false
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7"
version = "2.2.3"
[package.dependencies]
blis = ">=0.4.0,<0.5.0"
catalogue = ">=0.0.7,<1.1.0"
cymem = ">=2.0.2,<2.1.0"
murmurhash = ">=0.28.0,<1.1.0"
numpy = ">=1.15.0"
plac = ">=0.9.6,<1.2.0"
preshed = ">=3.0.2,<3.1.0"
requests = ">=2.13.0,<3.0.0"
setuptools = "*"
srsly = ">=0.1.0,<1.1.0"
thinc = ">=7.3.0,<7.4.0"
wasabi = ">=0.4.0,<1.1.0"
[package.extras]
cuda = ["cupy (>=5.0.0b4)"]
cuda100 = ["cupy-cuda100 (>=5.0.0b4)"]
cuda80 = ["cupy-cuda80 (>=5.0.0b4)"]
cuda90 = ["cupy-cuda90 (>=5.0.0b4)"]
cuda91 = ["cupy-cuda91 (>=5.0.0b4)"]
cuda92 = ["cupy-cuda92 (>=5.0.0b4)"]
ja = ["mecab-python3 (0.7)"]
ko = ["natto-py (0.9.0)"]
lookups = ["spacy-lookups-data (>=0.0.5)"]
th = ["pythainlp (>=2.0)"]
[[package]]
category = "main"
description = "Modern high-performance serialization utilities for Python"
name = "srsly"
optional = false
python-versions = "*"
version = "1.0.1"
[[package]]
category = "main"
description = "A tiny library for parsing, modifying, and composing SRT files."
name = "srt"
optional = false
python-versions = "*"
version = "3.0.0"
[[package]]
category = "main"
description = "Practical Machine Learning for NLP"
name = "thinc"
optional = false
python-versions = "*"
version = "7.3.1"
[package.dependencies]
blis = ">=0.4.0,<0.5.0"
cymem = ">=2.0.2,<2.1.0"
murmurhash = ">=0.28.0,<1.1.0"
numpy = ">=1.7.0"
plac = ">=0.9.6,<1.2.0"
preshed = ">=1.0.1,<3.1.0"
srsly = ">=0.0.6,<1.1.0"
tqdm = ">=4.10.0,<5.0.0"
wasabi = ">=0.0.9,<1.1.0"
[package.extras]
cuda = ["cupy (>=5.0.0b4)"]
cuda100 = ["cupy-cuda100 (>=5.0.0b4)"]
cuda110 = ["cupy-cuda110 (>=5.0.0b4)"]
cuda80 = ["cupy-cuda80 (>=5.0.0b4)"]
cuda90 = ["cupy-cuda90 (>=5.0.0b4)"]
cuda91 = ["cupy-cuda91 (>=5.0.0b4)"]
cuda92 = ["cupy-cuda92 (>=5.0.0b4)"]
[[package]]
category = "main"
description = "Fast, Extensible Progress Meter"
name = "tqdm"
optional = false
python-versions = ">=2.6, !=3.0.*, !=3.1.*"
version = "4.43.0"
[package.extras]
dev = ["py-make (>=0.1.0)", "twine", "argopt", "pydoc-markdown"]
[[package]]
category = "main"
description = "HTTP library with thread-safe connection pooling, file post, and more."
name = "urllib3"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4"
version = "1.25.8"
[package.extras]
brotli = ["brotlipy (>=0.6.0)"]
secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "ipaddress"]
socks = ["PySocks (>=1.5.6,<1.5.7 || >1.5.7,<2.0)"]
[[package]]
category = "main"
description = "A lightweight console printing and formatting toolkit"
name = "wasabi"
optional = false
python-versions = "*"
version = "0.6.0"
[[package]]
category = "main"
description = "The comprehensive WSGI web application library."
name = "werkzeug"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
version = "1.0.0"
[package.extras]
dev = ["pytest", "coverage", "tox", "sphinx", "pallets-sphinx-themes", "sphinx-issues"]
watchdog = ["watchdog"]
[[package]]
category = "main"
description = "YouTube video downloader"
name = "youtube-dl"
optional = false
python-versions = "*"
version = "2020.2.16"
[metadata]
content-hash = "99f0ade4553c864959a79089176ecda0a9358dcaee08902649efbd0a22e105f0"
python-versions = "^3.8"
[metadata.files]
blis = [
{file = "blis-0.4.1-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl", hash = "sha256:135450caabc8aea9bb9250329ebdf7189982d9b57d5c92789b2ba2fe52c247a7"},
{file = "blis-0.4.1-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:26b16d6005bb2671699831b5cc699905215d1abde1ec5c1d04de7dcd9eb29f75"},
{file = "blis-0.4.1-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:d1d59faebc1c94f8f4f77154ef4b9d6d40364b111cf8fde48ee3b524c85f1075"},
{file = "blis-0.4.1-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl", hash = "sha256:38fe877a4b52e762f5e137a412e3c256545a696a12ae8c40d67b8815d2bb5097"},
{file = "blis-0.4.1-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:1402d9cbb0fbc21b749dd5b87d7ee14249e74a0ca38be6ecc56b3b356fca2f21"},
{file = "blis-0.4.1-cp35-cp35m-win_amd64.whl", hash = "sha256:8aeaf6954351593a1e412f80e398aa51df588d3c0de74b9f3323b694c603381b"},
{file = "blis-0.4.1-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl", hash = "sha256:3347a4b1b7d3ae14476aac9a6f7bf8ebf464863f4ebf4aea228874a7694ea240"},
{file = "blis-0.4.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:77a6486b9794af01bcdfd1bc6e067c93add4b93292e6f95bf6e5ce7f98bf0163"},
{file = "blis-0.4.1-cp36-cp36m-win_amd64.whl", hash = "sha256:f0b0dad4d6268d9dba0a65a9db12dd7a2d8686b648399e4aa1aec7550697e99e"},
{file = "blis-0.4.1-cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl", hash = "sha256:4fb89c47ee06b58a4410a16fd5794847517262c9d2a342643475b477dfeff0a4"},
{file = "blis-0.4.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:03c368c9716ca814c436550a5f1e02ccf74850e613602519e3941d212e5aa177"},
{file = "blis-0.4.1-cp37-cp37m-win_amd64.whl", hash = "sha256:ddd732c5274d1082fa92e2c42317587d5ebabce7741ca98120f69bd45d004b99"},
{file = "blis-0.4.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:9ede123065f3cacb109967755b3d83d4ca0de90643a9058129a6ab2d4051954f"},
{file = "blis-0.4.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:00473602629ba69fe6565108e21957e918cb48b59f5bf2f6bfb6e04de42500cb"},
{file = "blis-0.4.1-cp38-cp38-win_amd64.whl", hash = "sha256:856142a11e37fd2c47c5006a3197e157bb8469a491a73d2d442223dd3279df84"},
{file = "blis-0.4.1.tar.gz", hash = "sha256:d69257d317e86f34a7f230a2fd1f021fd2a1b944137f40d8cdbb23bd334cd0c4"},
]
catalogue = [
{file = "catalogue-1.0.0-py2.py3-none-any.whl", hash = "sha256:584d78e7f4c3c6e2fd498eb56dfc8ef1f4ff738480237de2ccd26cbe2cf47172"},
{file = "catalogue-1.0.0.tar.gz", hash = "sha256:d74d1d856c6b36a37bf14aa6dbbc27d0582667b7ab979a6108e61a575e8723f5"},
]
certifi = [
{file = "certifi-2019.11.28-py2.py3-none-any.whl", hash = "sha256:017c25db2a153ce562900032d5bc68e9f191e44e9a0f762f373977de9df1fbb3"},
{file = "certifi-2019.11.28.tar.gz", hash = "sha256:25b64c7da4cd7479594d035c08c2d809eb4aab3a26e5a990ea98cc450c320f1f"},
]
chardet = [
{file = "chardet-3.0.4-py2.py3-none-any.whl", hash = "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"},
{file = "chardet-3.0.4.tar.gz", hash = "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae"},
]
click = [
{file = "Click-7.0-py2.py3-none-any.whl", hash = "sha256:2335065e6395b9e67ca716de5f7526736bfa6ceead690adf616d925bdc622b13"},
{file = "Click-7.0.tar.gz", hash = "sha256:5b94b49521f6456670fdb30cd82a4eca9412788a93fa6dd6df72c94d5a8ff2d7"},
]
cymem = [
{file = "cymem-2.0.3-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:f4f19af4bca81f11922508a9dcf30ce1d2aee4972af9f81ce8e5331a6f46f5e1"},
{file = "cymem-2.0.3-cp35-cp35m-win_amd64.whl", hash = "sha256:cd21ec48ee70878d46c486e2f7ae94b32bfc6b37c4d27876c5a5a00c4eb75c3c"},
{file = "cymem-2.0.3-cp36-cp36m-macosx_10_6_intel.whl", hash = "sha256:6f4cb689a9552e9e13dccc89203c8ab09f210a7ffb92ce27c384a4a0be27b527"},
{file = "cymem-2.0.3-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:7236252bed70f37b898933dcf8aa875d0829664a245a272516f27b30439df71c"},
{file = "cymem-2.0.3-cp36-cp36m-win_amd64.whl", hash = "sha256:719f04a11ca709fc2b47868070d79fccff77e5d502ff32de2f4baa73cb16166f"},
{file = "cymem-2.0.3-cp37-cp37m-macosx_10_6_intel.whl", hash = "sha256:d7505c500d994f11662e5595f5002251f572acc189f18944619352e2636f5181"},
{file = "cymem-2.0.3-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:c288a1bbdf58c360457443e5297e74844e1961e5e7001dbcb3a5297a41911a11"},
{file = "cymem-2.0.3-cp37-cp37m-win_amd64.whl", hash = "sha256:7f5ddceb12b73f7fd2e4398266401b6f887003740ccd18c989a2af04500b5f2b"},
{file = "cymem-2.0.3-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:622c20a57701d02f01a47e856dea248e112638f28c8249dbe3ed95a9702e3d74"},
{file = "cymem-2.0.3-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:85b9364e099426bd7f445a7705aad87bf6dbb71d79e3802dd8ca14e181d38a33"},
{file = "cymem-2.0.3-cp38-cp38-win_amd64.whl", hash = "sha256:dd24848fbd75b17bab06408da6c029ba7cc615bd9e4a1f755fb3a090025fb922"},
{file = "cymem-2.0.3.tar.gz", hash = "sha256:5083b2ab5fe13ced094a82e0df465e2dbbd9b1c013288888035e24fd6eb4ed01"},
]
en_core_web_sm = []
flask = [
{file = "Flask-1.1.1-py2.py3-none-any.whl", hash = "sha256:45eb5a6fd193d6cf7e0cf5d8a5b31f83d5faae0293695626f539a823e93b13f6"},
{file = "Flask-1.1.1.tar.gz", hash = "sha256:13f9f196f330c7c2c5d7a5cf91af894110ca0215ac051b5844701f2bfd934d52"},
]
idna = [
{file = "idna-2.9-py2.py3-none-any.whl", hash = "sha256:a068a21ceac8a4d63dbfd964670474107f541babbd2250d61922f029858365fa"},
{file = "idna-2.9.tar.gz", hash = "sha256:7588d1c14ae4c77d74036e8c22ff447b26d0fde8f007354fd48a7814db15b7cb"},
]
itsdangerous = [
{file = "itsdangerous-1.1.0-py2.py3-none-any.whl", hash = "sha256:b12271b2047cb23eeb98c8b5622e2e5c5e9abd9784a153e9d8ef9cb4dd09d749"},
{file = "itsdangerous-1.1.0.tar.gz", hash = "sha256:321b033d07f2a4136d3ec762eac9f16a10ccd60f53c0c91af90217ace7ba1f19"},
]
jinja2 = [
{file = "Jinja2-2.11.1-py2.py3-none-any.whl", hash = "sha256:b0eaf100007721b5c16c1fc1eecb87409464edc10469ddc9a22a27a99123be49"},
{file = "Jinja2-2.11.1.tar.gz", hash = "sha256:93187ffbc7808079673ef52771baa950426fd664d3aad1d0fa3e95644360e250"},
]
markupsafe = [
{file = "MarkupSafe-1.1.1-cp27-cp27m-macosx_10_6_intel.whl", hash = "sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161"},
{file = "MarkupSafe-1.1.1-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7"},
{file = "MarkupSafe-1.1.1-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:500d4957e52ddc3351cabf489e79c91c17f6e0899158447047588650b5e69183"},
{file = "MarkupSafe-1.1.1-cp27-cp27m-win32.whl", hash = "sha256:b2051432115498d3562c084a49bba65d97cf251f5a331c64a12ee7e04dacc51b"},
{file = "MarkupSafe-1.1.1-cp27-cp27m-win_amd64.whl", hash = "sha256:98c7086708b163d425c67c7a91bad6e466bb99d797aa64f965e9d25c12111a5e"},
{file = "MarkupSafe-1.1.1-cp27-cp27mu-manylinux1_i686.whl", hash = "sha256:cd5df75523866410809ca100dc9681e301e3c27567cf498077e8551b6d20e42f"},
{file = "MarkupSafe-1.1.1-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:43a55c2930bbc139570ac2452adf3d70cdbb3cfe5912c71cdce1c2c6bbd9c5d1"},
{file = "MarkupSafe-1.1.1-cp34-cp34m-macosx_10_6_intel.whl", hash = "sha256:1027c282dad077d0bae18be6794e6b6b8c91d58ed8a8d89a89d59693b9131db5"},
{file = "MarkupSafe-1.1.1-cp34-cp34m-manylinux1_i686.whl", hash = "sha256:62fe6c95e3ec8a7fad637b7f3d372c15ec1caa01ab47926cfdf7a75b40e0eac1"},
{file = "MarkupSafe-1.1.1-cp34-cp34m-manylinux1_x86_64.whl", hash = "sha256:88e5fcfb52ee7b911e8bb6d6aa2fd21fbecc674eadd44118a9cc3863f938e735"},
{file = "MarkupSafe-1.1.1-cp34-cp34m-win32.whl", hash = "sha256:ade5e387d2ad0d7ebf59146cc00c8044acbd863725f887353a10df825fc8ae21"},
{file = "MarkupSafe-1.1.1-cp34-cp34m-win_amd64.whl", hash = "sha256:09c4b7f37d6c648cb13f9230d847adf22f8171b1ccc4d5682398e77f40309235"},
{file = "MarkupSafe-1.1.1-cp35-cp35m-macosx_10_6_intel.whl", hash = "sha256:79855e1c5b8da654cf486b830bd42c06e8780cea587384cf6545b7d9ac013a0b"},
{file = "MarkupSafe-1.1.1-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:c8716a48d94b06bb3b2524c2b77e055fb313aeb4ea620c8dd03a105574ba704f"},
{file = "MarkupSafe-1.1.1-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:7c1699dfe0cf8ff607dbdcc1e9b9af1755371f92a68f706051cc8c37d447c905"},
{file = "MarkupSafe-1.1.1-cp35-cp35m-win32.whl", hash = "sha256:6dd73240d2af64df90aa7c4e7481e23825ea70af4b4922f8ede5b9e35f78a3b1"},
{file = "MarkupSafe-1.1.1-cp35-cp35m-win_amd64.whl", hash = "sha256:9add70b36c5666a2ed02b43b335fe19002ee5235efd4b8a89bfcf9005bebac0d"},
{file = "MarkupSafe-1.1.1-cp36-cp36m-macosx_10_6_intel.whl", hash = "sha256:24982cc2533820871eba85ba648cd53d8623687ff11cbb805be4ff7b4c971aff"},
{file = "MarkupSafe-1.1.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:00bc623926325b26bb9605ae9eae8a215691f33cae5df11ca5424f06f2d1f473"},
{file = "MarkupSafe-1.1.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:717ba8fe3ae9cc0006d7c451f0bb265ee07739daf76355d06366154ee68d221e"},
{file = "MarkupSafe-1.1.1-cp36-cp36m-win32.whl", hash = "sha256:535f6fc4d397c1563d08b88e485c3496cf5784e927af890fb3c3aac7f933ec66"},
{file = "MarkupSafe-1.1.1-cp36-cp36m-win_amd64.whl", hash = "sha256:b1282f8c00509d99fef04d8ba936b156d419be841854fe901d8ae224c59f0be5"},
{file = "MarkupSafe-1.1.1-cp37-cp37m-macosx_10_6_intel.whl", hash = "sha256:8defac2f2ccd6805ebf65f5eeb132adcf2ab57aa11fdf4c0dd5169a004710e7d"},
{file = "MarkupSafe-1.1.1-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:46c99d2de99945ec5cb54f23c8cd5689f6d7177305ebff350a58ce5f8de1669e"},
{file = "MarkupSafe-1.1.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:ba59edeaa2fc6114428f1637ffff42da1e311e29382d81b339c1817d37ec93c6"},
{file = "MarkupSafe-1.1.1-cp37-cp37m-win32.whl", hash = "sha256:b00c1de48212e4cc9603895652c5c410df699856a2853135b3967591e4beebc2"},
{file = "MarkupSafe-1.1.1-cp37-cp37m-win_amd64.whl", hash = "sha256:9bf40443012702a1d2070043cb6291650a0841ece432556f784f004937f0f32c"},
{file = "MarkupSafe-1.1.1.tar.gz", hash = "sha256:29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b"},
]
murmurhash = [
{file = "murmurhash-1.0.2-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl", hash = "sha256:717196a04cdc80cc3103a3da17b2415a8a5e1d0d578b7079259386bf153b3258"},
{file = "murmurhash-1.0.2-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:a6c071b4b498bcea16a8dc8590cad81fa8d43821f34c74bc00f96499e2527073"},
{file = "murmurhash-1.0.2-cp27-cp27m-win_amd64.whl", hash = "sha256:d696c394ebd164ca80b5871e2e9ad2f9fdbb81bd3c552c1d5f1e8ee694e6204a"},
{file = "murmurhash-1.0.2-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:27b908fe4bdb426f4e4e4a8821acbe0302915b2945e035ec9d8ca513e2a74b1f"},
{file = "murmurhash-1.0.2-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:33405103fa8cde15d72ee525a03d5cfe2c7e4901133819754810986e29627d68"},
{file = "murmurhash-1.0.2-cp35-cp35m-win_amd64.whl", hash = "sha256:3af36a0dc9f13f6892d9b8b39a6a3ccf216cae5bce38adc7c2d145677987772f"},
{file = "murmurhash-1.0.2-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl", hash = "sha256:fe344face8d30a5a6aa26e5acf288aa2a8f0f32e05efdda3d314b4bf289ec2af"},
{file = "murmurhash-1.0.2-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:386a9eed3cb27cb2cd4394b6521275ba04552642c2d9cab5c9fb42aa5a3325c0"},
{file = "murmurhash-1.0.2-cp36-cp36m-win_amd64.whl", hash = "sha256:b0afe329701b59d02e56bc6cee7325af83e3fee9c299c615fc1df3202b4f886f"},
{file = "murmurhash-1.0.2-cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl", hash = "sha256:bf33490514d308bcc27ed240cb3eb114f1ec31af031535cd8f27659a7049bd52"},
{file = "murmurhash-1.0.2-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:8a4ed95cd3456b43ea301679c7c39ade43fc18b844b37d0ba0ac0d6acbff8e0c"},
{file = "murmurhash-1.0.2-cp37-cp37m-win_amd64.whl", hash = "sha256:ba766343bdbcb928039b8fff609e80ae7a5fd5ed7a4fc5af822224b63e0cbaff"},
{file = "murmurhash-1.0.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:cc97ea766ac545074bab0e5af3dbc48e0d05ba230ae5a404e284d39abe4b3baf"},
{file = "murmurhash-1.0.2-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:8b045a79e8b621b4b35b29f29e33e9e0964f3a276f7da4d5736142f322ad4842"},
{file = "murmurhash-1.0.2-cp38-cp38-win_amd64.whl", hash = "sha256:f468e4868f78c3ac202a66abfe2866414bca4ae7666a21ef0938c423de0f7d50"},
{file = "murmurhash-1.0.2.tar.gz", hash = "sha256:c7a646f6b07b033642b4f52ae2e45efd8b80780b3b90e8092a0cec935fbf81e2"},
]
numpy = [
{file = "numpy-1.18.1-cp35-cp35m-macosx_10_6_intel.whl", hash = "sha256:20b26aaa5b3da029942cdcce719b363dbe58696ad182aff0e5dcb1687ec946dc"},
{file = "numpy-1.18.1-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:70a840a26f4e61defa7bdf811d7498a284ced303dfbc35acb7be12a39b2aa121"},
{file = "numpy-1.18.1-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:17aa7a81fe7599a10f2b7d95856dc5cf84a4eefa45bc96123cbbc3ebc568994e"},
{file = "numpy-1.18.1-cp35-cp35m-win32.whl", hash = "sha256:f3d0a94ad151870978fb93538e95411c83899c9dc63e6fb65542f769568ecfa5"},
{file = "numpy-1.18.1-cp35-cp35m-win_amd64.whl", hash = "sha256:1786a08236f2c92ae0e70423c45e1e62788ed33028f94ca99c4df03f5be6b3c6"},
{file = "numpy-1.18.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:ae0975f42ab1f28364dcda3dde3cf6c1ddab3e1d4b2909da0cb0191fa9ca0480"},
{file = "numpy-1.18.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:cf7eb6b1025d3e169989416b1adcd676624c2dbed9e3bcb7137f51bfc8cc2572"},
{file = "numpy-1.18.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:b765ed3930b92812aa698a455847141869ef755a87e099fddd4ccf9d81fffb57"},
{file = "numpy-1.18.1-cp36-cp36m-win32.whl", hash = "sha256:2d75908ab3ced4223ccba595b48e538afa5ecc37405923d1fea6906d7c3a50bc"},
{file = "numpy-1.18.1-cp36-cp36m-win_amd64.whl", hash = "sha256:9acdf933c1fd263c513a2df3dceecea6f3ff4419d80bf238510976bf9bcb26cd"},
{file = "numpy-1.18.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:56bc8ded6fcd9adea90f65377438f9fea8c05fcf7c5ba766bef258d0da1554aa"},
{file = "numpy-1.18.1-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:e422c3152921cece8b6a2fb6b0b4d73b6579bd20ae075e7d15143e711f3ca2ca"},
{file = "numpy-1.18.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:b3af02ecc999c8003e538e60c89a2b37646b39b688d4e44d7373e11c2debabec"},
{file = "numpy-1.18.1-cp37-cp37m-win32.whl", hash = "sha256:d92350c22b150c1cae7ebb0ee8b5670cc84848f6359cf6b5d8f86617098a9b73"},
{file = "numpy-1.18.1-cp37-cp37m-win_amd64.whl", hash = "sha256:77c3bfe65d8560487052ad55c6998a04b654c2fbc36d546aef2b2e511e760971"},
{file = "numpy-1.18.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:c98c5ffd7d41611407a1103ae11c8b634ad6a43606eca3e2a5a269e5d6e8eb07"},
{file = "numpy-1.18.1-cp38-cp38-manylinux1_i686.whl", hash = "sha256:9537eecf179f566fd1c160a2e912ca0b8e02d773af0a7a1120ad4f7507cd0d26"},
{file = "numpy-1.18.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:e840f552a509e3380b0f0ec977e8124d0dc34dc0e68289ca28f4d7c1d0d79474"},
{file = "numpy-1.18.1-cp38-cp38-win32.whl", hash = "sha256:590355aeade1a2eaba17617c19edccb7db8d78760175256e3cf94590a1a964f3"},
{file = "numpy-1.18.1-cp38-cp38-win_amd64.whl", hash = "sha256:39d2c685af15d3ce682c99ce5925cc66efc824652e10990d2462dfe9b8918c6a"},
{file = "numpy-1.18.1.zip", hash = "sha256:b6ff59cee96b454516e47e7721098e6ceebef435e3e21ac2d6c3b8b02628eb77"},
]
peewee = [
{file = "peewee-3.13.1.tar.gz", hash = "sha256:9492af4d1f8e18a7fa0e930960315b38931286ea0f1659bbd5503456cffdacde"},
]
plac = [
{file = "plac-1.1.3-py2.py3-none-any.whl", hash = "sha256:487e553017d419f35add346c4c09707e52fa53f7e7181ce1098ca27620e9ceee"},
{file = "plac-1.1.3.tar.gz", hash = "sha256:398cb947c60c4c25e275e1f1dadf027e7096858fb260b8ece3b33bcff90d985f"},
]
preshed = [
{file = "preshed-3.0.2-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl", hash = "sha256:448d9df12e63fe4a3024f6153ee6703bb95d2be0ce887b5eda7ddc41acfba825"},
{file = "preshed-3.0.2-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:633358f1fb0ec5dd6dbe4971c328d08809e5a8dbefdf13a802ae0a7cb45306c7"},
{file = "preshed-3.0.2-cp27-cp27m-win_amd64.whl", hash = "sha256:7ea588a78aaf310ae2c293071a8571b07ae434819be05fe510442b6df3f8fbf7"},
{file = "preshed-3.0.2-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:8a9a8222a697a513f25a94733e7a17cc298ecd8fd56b606a1d8fa0ac342c2830"},
{file = "preshed-3.0.2-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:253970beae87ab672a6afb543908761795eea3cb7b0d784e2ea51e265752059e"},
{file = "preshed-3.0.2-cp35-cp35m-win_amd64.whl", hash = "sha256:88427346b220293439db77c82913791fa13edc6ac73d8159610699a3ca17aae9"},
{file = "preshed-3.0.2-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl", hash = "sha256:6518bbd5fb8adbc3231e75ae78d96a7bdd5405a3b23a09d5e62a2e4fc833724e"},
{file = "preshed-3.0.2-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:1be3cb59211282e906a11443464fe3e19f6561e2fcd06410e4adc6d45354cf82"},
{file = "preshed-3.0.2-cp36-cp36m-win_amd64.whl", hash = "sha256:ece5e850f667eaa3367d5c56dda9e3aa6ac1c0bb2117d2f466a26db5f26bbe4b"},
{file = "preshed-3.0.2-cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl", hash = "sha256:1ef72a120e49356058b3c0590d7b5e91f2747b44e006eef6579be6131223cab0"},
{file = "preshed-3.0.2-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:7e80ffc1fb79496d4feafe0eaf71ee5e532b91daf6cec235d7f9c4c12657a58c"},
{file = "preshed-3.0.2-cp37-cp37m-win_amd64.whl", hash = "sha256:0c15ae62f2595ca479decc3452967484dae57b510278800f5deb9115238cc818"},
{file = "preshed-3.0.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:e37058d91bd7f0f5a7a9c83d22a83dc581ab5f79688a87be81f200993145a250"},
{file = "preshed-3.0.2-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:b4ae6c7c44aa3ff7bd717791bb6b619ecb273b7cb128c986f2dc65f6e0e6ddd4"},
{file = "preshed-3.0.2-cp38-cp38-win_amd64.whl", hash = "sha256:190345724eb3f7aeaeb2a758740d698bd6c017c2cdf07c71c16b34820973d114"},
{file = "preshed-3.0.2.tar.gz", hash = "sha256:61d73468c97c1d6d5a048de0b01d5a6fd052123358aca4823cdb277e436436cb"},
]
progress = [
{file = "progress-1.5.tar.gz", hash = "sha256:69ecedd1d1bbe71bf6313d88d1e6c4d2957b7f1d4f71312c211257f7dae64372"},
]
psycopg2 = [
{file = "psycopg2-2.8.4-cp27-cp27m-win32.whl", hash = "sha256:72772181d9bad1fa349792a1e7384dde56742c14af2b9986013eb94a240f005b"},
{file = "psycopg2-2.8.4-cp27-cp27m-win_amd64.whl", hash = "sha256:893c11064b347b24ecdd277a094413e1954f8a4e8cdaf7ffbe7ca3db87c103f0"},
{file = "psycopg2-2.8.4-cp34-cp34m-win32.whl", hash = "sha256:9ab75e0b2820880ae24b7136c4d230383e07db014456a476d096591172569c38"},
{file = "psycopg2-2.8.4-cp34-cp34m-win_amd64.whl", hash = "sha256:b0845e3bdd4aa18dc2f9b6fb78fbd3d9d371ad167fd6d1b7ad01c0a6cdad4fc6"},
{file = "psycopg2-2.8.4-cp35-cp35m-win32.whl", hash = "sha256:ef6df7e14698e79c59c7ee7cf94cd62e5b869db369ed4b1b8f7b729ea825712a"},
{file = "psycopg2-2.8.4-cp35-cp35m-win_amd64.whl", hash = "sha256:965c4c93e33e6984d8031f74e51227bd755376a9df6993774fd5b6fb3288b1f4"},
{file = "psycopg2-2.8.4-cp36-cp36m-win32.whl", hash = "sha256:ed686e5926929887e2c7ae0a700e32c6129abb798b4ad2b846e933de21508151"},
{file = "psycopg2-2.8.4-cp36-cp36m-win_amd64.whl", hash = "sha256:dca2d7203f0dfce8ea4b3efd668f8ea65cd2b35112638e488a4c12594015f67b"},
{file = "psycopg2-2.8.4-cp37-cp37m-win32.whl", hash = "sha256:8396be6e5ff844282d4d49b81631772f80dabae5658d432202faf101f5283b7c"},
{file = "psycopg2-2.8.4-cp37-cp37m-win_amd64.whl", hash = "sha256:47fc642bf6f427805daf52d6e52619fe0637648fe27017062d898f3bf891419d"},
{file = "psycopg2-2.8.4-cp38-cp38-win32.whl", hash = "sha256:4212ca404c4445dc5746c0d68db27d2cbfb87b523fe233dc84ecd24062e35677"},
{file = "psycopg2-2.8.4-cp38-cp38-win_amd64.whl", hash = "sha256:92a07dfd4d7c325dd177548c4134052d4842222833576c8391aab6f74038fc3f"},
{file = "psycopg2-2.8.4.tar.gz", hash = "sha256:f898e5cc0a662a9e12bde6f931263a1bbd350cfb18e1d5336a12927851825bb6"},
]
pymysql = [
{file = "PyMySQL-0.9.3-py2.py3-none-any.whl", hash = "sha256:3943fbbbc1e902f41daf7f9165519f140c4451c179380677e6a848587042561a"},
{file = "PyMySQL-0.9.3.tar.gz", hash = "sha256:d8c059dcd81dedb85a9f034d5e22dcb4442c0b201908bede99e306d65ea7c8e7"},
]
requests = [
{file = "requests-2.23.0-py2.py3-none-any.whl", hash = "sha256:43999036bfa82904b6af1d99e4882b560e5e2c68e5c4b0aa03b655f3d7d73fee"},
{file = "requests-2.23.0.tar.gz", hash = "sha256:b3f43d496c6daba4493e7c431722aeb7dbc6288f52a6e04e7b6023b0247817e6"},
]
sentry-sdk = [
{file = "sentry-sdk-0.14.2.tar.gz", hash = "sha256:480eee754e60bcae983787a9a13bc8f155a111aef199afaa4f289d6a76aa622a"},
{file = "sentry_sdk-0.14.2-py2.py3-none-any.whl", hash = "sha256:a920387dc3ee252a66679d0afecd34479fb6fc52c2bc20763793ed69e5b0dcc0"},
]
sonic-client = []
spacy = [
{file = "spacy-2.2.3-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:ce7fad73de7aed7ca2ee7c2404c77c72005f67ca95edae6f19f08947fb0f8ab3"},
{file = "spacy-2.2.3-cp35-cp35m-win_amd64.whl", hash = "sha256:3c83c061597b5dc94c939c511d3b72c2971257204f21976afc117a350e8fa92b"},
{file = "spacy-2.2.3-cp36-cp36m-macosx_10_6_intel.whl", hash = "sha256:708d25c7212bd20d1268c6559e191d221e88e68e152fb98b82c388d16dfdd3d7"},
{file = "spacy-2.2.3-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:d6a2804c457ce74f0d3bf1f4cdb00cbcd228e9da5f0bdbbbe0a856afe12db37e"},
{file = "spacy-2.2.3-cp36-cp36m-win_amd64.whl", hash = "sha256:6971359e43841ff9ed87e1af5e87ea74d6fdb01fe54807d3e4c6a2a3798d18a4"},
{file = "spacy-2.2.3-cp37-cp37m-macosx_10_6_intel.whl", hash = "sha256:713811c96396c6bb86a1da2bbbe02d874385e74dde6617a84d61d99e9d2b1105"},
{file = "spacy-2.2.3-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:d8791f5f69800d702b8e9457418af2cd29789b82697d17ad66df98922f081d1b"},
{file = "spacy-2.2.3-cp37-cp37m-win_amd64.whl", hash = "sha256:8d1ce99fc30d634b63b15d98c49b96d6a40b0d2048d5dad0f2bb31d3f6dc5ef0"},
{file = "spacy-2.2.3-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:2cb77315522cc422df7750dac778f13d8079f409b4842cf74a54ffe3b84ee5c6"},
{file = "spacy-2.2.3-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:9afdec1aeb21dbeccfd4d702f12fe8bab88e4d7cd410785bf17f6b186cbc73e8"},
{file = "spacy-2.2.3-cp38-cp38-win_amd64.whl", hash = "sha256:7fa02ababbb3762277b81873204d78583008b408ddf6fc0ef977b38d3b462b85"},
{file = "spacy-2.2.3.tar.gz", hash = "sha256:1d14c9e7d65b2cecd56c566d9ffac8adbcb9ce2cff2274cbfdcf5468cd940e6a"},
]
srsly = [
{file = "srsly-1.0.1-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:ca1ec20ea6e14ad56ccaa84aa6c79d6e51fccf32e0040372b4d06c6e5dbb7fee"},
{file = "srsly-1.0.1-cp35-cp35m-win_amd64.whl", hash = "sha256:c6bdf53a87770139c6a9d75b3e664505bd81c022312fafca35ed38714e4ecdf1"},
{file = "srsly-1.0.1-cp36-cp36m-macosx_10_6_intel.whl", hash = "sha256:c82e6dc3727454edc6ccdb1d07d5bc0aab3f43539fb8d9f973cf769135d2c7e4"},
{file = "srsly-1.0.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:d5c0c718b2f67fc425d9bb3cc26b6141cb2f53251cdc145f58b70095241a3308"},
{file = "srsly-1.0.1-cp36-cp36m-win_amd64.whl", hash = "sha256:4ce9d6ab6d1c617150455ef5ba8abd5107a8e65956f06c2efc86697f4cb4b431"},
{file = "srsly-1.0.1-cp37-cp37m-macosx_10_6_intel.whl", hash = "sha256:de329ba0ff451308d59e40c39372f5231e7c364f4933d7457788203630bdede2"},
{file = "srsly-1.0.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:3ceae42dbbda49b57a4937e0ca28f56c2a121c89008cc7ec09e0a9d8d705c03e"},
{file = "srsly-1.0.1-cp37-cp37m-win_amd64.whl", hash = "sha256:a672ffaa77680f355933cf424739ae9ecff767908a374ad194692b53040fda01"},
{file = "srsly-1.0.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:1c4354095f63f59fc52a4362960faaddebcfa7a240f07209eb50e8f9ec39e700"},
{file = "srsly-1.0.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:51c47f98dc06d5c2d1d7806cd38dcc834ab9906dc12170bc21105e5a9590a6fd"},
{file = "srsly-1.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:abe3d98d9ea8f7dac898119cd9861466c49cfe0f16287c9f859e0d4cab43a7a4"},
{file = "srsly-1.0.1.tar.gz", hash = "sha256:1102b4984f9f56364540e47d83fac3e7543903dfbb92f0d0e5dd3bfd40528934"},
]
srt = [
{file = "srt-3.0.0.tar.gz", hash = "sha256:deed9a52b1f1bc2c290f0de49c2204a892952d972a2a08bc5a08861e240a05c2"},
]
thinc = [
{file = "thinc-7.3.1-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:bad16bcc608ec4d74c680d85aa9bf43cfc776ac12ca3b7e699d7283fd0177bca"},
{file = "thinc-7.3.1-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:93cb9d184115a8890321dd7f5d94a0d8235dc2fca54d92a9c1c051234a7af43e"},
{file = "thinc-7.3.1-cp35-cp35m-win_amd64.whl", hash = "sha256:8833246f1c8b95143c91e310728bf64af8972a9d8653252efa1b4c9036837569"},
{file = "thinc-7.3.1-cp36-cp36m-macosx_10_6_intel.whl", hash = "sha256:30790a1a496a8a84fe300edf50df50454dbdb625b41b203739fbc03112a4d3b6"},
{file = "thinc-7.3.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:650fbead603bd7e73a61fd2c1b69202ad7a8eb70d4ebe7c5484b8788e828b6e0"},
{file = "thinc-7.3.1-cp36-cp36m-win_amd64.whl", hash = "sha256:1dbaec0628040a1f8d66147fadbf7775ad6dfe4c681424b2e20479c1e54dc3c1"},
{file = "thinc-7.3.1-cp37-cp37m-macosx_10_6_intel.whl", hash = "sha256:801f32f6c048de7e9f6d406342080e6348d0bb02beb1412811f9150a26661691"},
{file = "thinc-7.3.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:713adad69c108dbdc145276d077c4a80f3df31a39b3fc574782dcb64b1def815"},
{file = "thinc-7.3.1-cp37-cp37m-win_amd64.whl", hash = "sha256:56b67887930df87c28af2cc4d046c6bc3e80ed4ff3e57208a4fb7a348d12a580"},
{file = "thinc-7.3.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:20b6ed4a8112342b433b9b3ca23b59322d07e32a9232d3cca19b0353e213eadb"},
{file = "thinc-7.3.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:f19a36cdfdbef75109f505313c16a7b154b9bbf83dd177e9ddd43430dc523bb0"},
{file = "thinc-7.3.1-cp38-cp38-win_amd64.whl", hash = "sha256:abe0d00cbb2cc831f4462e41f97aeb754b275a723a1335cdce7ac9224001d567"},
{file = "thinc-7.3.1.tar.gz", hash = "sha256:ce81d6b2372057e10f9d7cb505942df67a803f270d69959d44d372e8e3792bb9"},
]
tqdm = [
{file = "tqdm-4.43.0-py2.py3-none-any.whl", hash = "sha256:0d8b5afb66e23d80433102e9bd8b5c8b65d34c2a2255b2de58d97bd2ea8170fd"},
{file = "tqdm-4.43.0.tar.gz", hash = "sha256:f35fb121bafa030bd94e74fcfd44f3c2830039a2ddef7fc87ef1c2d205237b24"},
]
urllib3 = [
{file = "urllib3-1.25.8-py2.py3-none-any.whl", hash = "sha256:2f3db8b19923a873b3e5256dc9c2dedfa883e33d87c690d9c7913e1f40673cdc"},
{file = "urllib3-1.25.8.tar.gz", hash = "sha256:87716c2d2a7121198ebcb7ce7cccf6ce5e9ba539041cfbaeecfb641dc0bf6acc"},
]
wasabi = [
{file = "wasabi-0.6.0-py3-none-any.whl", hash = "sha256:da1f100e0025fe1e50fd67fa5b0b05df902187d5c65c86dc110974ab856d1f05"},
{file = "wasabi-0.6.0.tar.gz", hash = "sha256:b8dd3e963cd693fde1eb6bfbecf51790171aa3534fa299faf35cf269f2fd6063"},
]
werkzeug = [
{file = "Werkzeug-1.0.0-py2.py3-none-any.whl", hash = "sha256:6dc65cf9091cf750012f56f2cad759fa9e879f511b5ff8685e456b4e3bf90d16"},
{file = "Werkzeug-1.0.0.tar.gz", hash = "sha256:169ba8a33788476292d04186ab33b01d6add475033dfc07215e6d219cc077096"},
]
youtube-dl = [
{file = "youtube_dl-2020.2.16-py2.py3-none-any.whl", hash = "sha256:3ba5a9258a33b537392f3dfd3f8868631c63a437d17524555922020ba19c4102"},
{file = "youtube_dl-2020.2.16.tar.gz", hash = "sha256:b98d240c928a1bd0412b270ccf0d776aae5448672ea374e0af45f6daa3984009"},
]

36
psqlsearch.py Normal file
View file

@ -0,0 +1,36 @@
import logging
from datetime import datetime
from peewee import SQL, fn, Alias
from psycopg2._psycopg import cursor
from models import Line, Person, Episode, db
from utils import milliseconds_to_td
logger = logging.getLogger('peewee')
logger.addHandler(logging.StreamHandler())
logger.setLevel(logging.DEBUG)
terms = "where a bunch of us nerdy-ass actors"
start_time = datetime.now()
a = Alias(fn.ts_rank(Line.search_text, fn.plainto_tsquery('english', terms)), "rank")
results = Line.select(Line, Person, Episode, a).where(
(Line.search_text.match(terms, language="english", plain=True))
&
(Episode.episode_number <= 100)
&
(Episode.season == 2)
).order_by(SQL("rank DESC")).join(Person).switch(Line).join(Episode).limit(100)
end_time = datetime.now()
print(end_time - start_time)
# results = Line.full_text_search(terms)
if len(results) == 0:
result: cursor = db.execute_sql("select plainto_tsquery('english',%s)", [terms])
parsed = result.fetchone()[0]
if not parsed:
raise ValueError("only stop words were used")
else:
print(parsed)
for line in results:
print(line.episode.name, milliseconds_to_td(line.starttime), line.rank, line.person.name + ": " + line.text)

25
pyproject.toml Normal file
View file

@ -0,0 +1,25 @@
[tool.poetry]
name = "cr-search"
version = "0.1.0"
description = ""
authors = ["Lukas Winkler <git@lw1.at>"]
[tool.poetry.dependencies]
python = "^3.8"
peewee = "^3.13.1"
PyMySQL = "^0.9.3"
srt = "^3.0.0"
sonic-client = {path = "python-sonic-client"}
psycopg2 = "^2.8.4"
youtube-dl = "^2020.2.16"
spacy = "^2.2.3"
en-core-web-sm = {url = "https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.2.5/en_core_web_sm-2.2.5.tar.gz"}
progress = "^1.5"
flask = "^1.1.1"
sentry_sdk = "^0.14.2"
[tool.poetry.dev-dependencies]
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

23
search.py Normal file
View file

@ -0,0 +1,23 @@
import logging
from sonic import SearchClient
from models import Line, Episode, Person
from utils import milliseconds_to_td
logger = logging.getLogger('peewee')
logger.addHandler(logging.StreamHandler())
logger.setLevel(logging.DEBUG)
with SearchClient("127.0.0.1", 1491, "SecretPassword") as querycl:
results = querycl.query("crsearch", "crsearch", "gnome", lang="eng")
real_results = []
for rs in results:
r = int(rs)
real_results.extend([r - 1, r, r + 1])
lines = Line.select(Line, Person, Episode).where(Line.id << real_results).join(Person).switch(Line).join(Episode)
for line in lines:
print(line.episode.name, milliseconds_to_td(line.starttime), line.person.name + ": " + line.text)
results = querycl.suggest("crsearch", "crsearch", "regular")
print(results)

94
server.py Normal file
View file

@ -0,0 +1,94 @@
from flask import request, jsonify, Response
from peewee import fn, Alias, SQL, DoesNotExist
from playhouse.shortcuts import model_to_dict
from psycopg2._psycopg import cursor
from app import app
from models import *
def add_cors(response):
header = response.headers
header['Access-Control-Allow-Origin'] = '*'
return response
@app.route("/suggest")
def question():
query:str = request.args.get('query')
until = request.args.get('until')
if not query or not until:
return "no suggest query", 400
phrases = Phrase.select().where((Phrase.until_episode == until) & (fn.LOWER(Phrase.text) % ("%" + query.lower() + "%"))).order_by(
Phrase.count.desc()).limit(10)
return jsonify([p.text for p in phrases])
@app.route("/search")
def search():
query = request.args.get('query')
until = request.args.get('until')
if not query or not until:
return "no suggest query", 400
a = Alias(fn.ts_rank(Line.search_text, fn.plainto_tsquery('english', query)), "rank")
results = Line.select(Line, Person, Episode, a).where(
(Line.search_text.match(query, language="english", plain=True))
&
(Episode.episode_number <= until)
&
(Episode.season == 2)
).order_by(SQL("rank DESC")).join(Person).switch(Line).join(Episode).limit(20)
if len(results) == 0:
result: cursor = db.execute_sql("select plainto_tsquery('english',%s)", [query])
parsed = result.fetchone()[0]
if not parsed:
return jsonify({"status": "warning", "message": "Only stop words were used"})
else:
a: Response = jsonify({"status": "warning", "message": f"No results were found for \"{parsed}\""})
a.status_code = 404
return a
data = []
d: Line
ri = 0
for d in results:
entry = model_to_dict(d, extra_attrs=["rank"], exclude=[Line.search_text])
entry["rank"] = float(entry["rank"])
data.append({"centerID": d.id, "resultID": ri, "offset": 1, "lines": [entry]})
ri += 1
return jsonify(data)
@app.route("/expand")
def expand():
center_id = request.args.get('centerID')
offset = int(request.args.get('offset', 1))
if not center_id:
return "no central line ID", 400
try:
center: Line = Line.select().where(Line.id == center_id).get()
except DoesNotExist:
return "not found", 404
lines = Line.select().where(
(Line.episode == center.episode) & (Line.order << [center.order - offset, center.order + offset])
)
l: Line
data = []
for l in lines:
entry = model_to_dict(l, exclude=[Line.search_text])
data.append(entry)
return jsonify(data)
if __name__ == "__main__":
app.debug = True
app.after_request(add_cors)
app.run()

65
stopwords.py Normal file
View file

@ -0,0 +1,65 @@
STOP_WORDS = set(
"""
a about above across after afterwards again against all almost alone along
already also although always am among amongst amount an and another any anyhow
anyone anything anyway anywhere are around as at
back be became because become becomes becoming been before beforehand behind
being below beside besides between beyond both bottom but by
call can cannot ca could
did do does doing done down due during
each eight either eleven else elsewhere empty enough even ever every
everyone everything everywhere except
few fifteen fifty first five for former formerly forty four from front full
further
get give go
had has have he hence her here hereafter hereby herein hereupon hers herself
him himself his how however hundred
i if in indeed into is it its itself
keep
last latter latterly least less
just
made make many may me meanwhile might mine more moreover most mostly move much
must my myself
name namely neither never nevertheless next nine no nobody none noone nor not
nothing now nowhere
of off often on once one only onto or other others otherwise our ours ourselves
out over own
part per perhaps please put
quite
rather re really regarding
same say see seem seemed seeming seems serious several she should show side
since six sixty so some somehow someone something sometime sometimes somewhere
still such
take ten than that the their them themselves then thence there thereafter
thereby therefore therein thereupon these they third this those though three
through throughout thru thus to together too top toward towards twelve twenty
two
under until up unless upon us used using
various very very via was we well were what whatever when whence whenever where
whereafter whereas whereby wherein whereupon wherever whether which while
whither who whoever whole whom whose why will with within without would
yet you your yours yourself yourselves
""".split()
)

69
subtitlewrapper.py Normal file
View file

@ -0,0 +1,69 @@
from datetime import timedelta
from pyvtt import WebVTTItem, from_string, WebVTTTime
from srt import Subtitle as SrtSubtitle
from srt import parse
class SubtitleList:
def __init__(self, text: str, srt: bool):
self.srt = srt
self.list = []
if srt:
data = parse(text)
d: SrtSubtitle
for d in data:
self.list.append(Subtitle(srt=d))
else:
data = from_string(text)
i = 0
v: WebVTTItem
for v in data:
i += 1
self.list.append(Subtitle(vtt=v, i=i))
def __iter__(self):
yield from self.list
class Subtitle:
def __init__(self, srt: SrtSubtitle = None, vtt: WebVTTItem = None, i: int = None):
if srt:
self.is_srt = True
self.srt = srt
else:
self.is_srt = False
self.vtt = vtt
self.i = i
@staticmethod
def vtttime_to_td(vt: WebVTTTime) -> timedelta:
return timedelta(hours=vt.hours, minutes=vt.minutes, seconds=vt.seconds, milliseconds=vt.milliseconds)
@property
def content(self) -> str:
if self.is_srt:
return self.srt.content
else:
return self.vtt.text
@property
def index(self) -> int:
if self.is_srt:
return self.srt.index
else:
return self.i
@property
def start(self) -> timedelta:
if self.is_srt:
return self.srt.start
else:
return self.vtttime_to_td(self.vtt.start)
@property
def end(self) -> timedelta:
if self.is_srt:
return self.srt.end
else:
return self.vtttime_to_td(self.vtt.end)

28
typo.py Normal file
View file

@ -0,0 +1,28 @@
typos = {
"Matt": {"Mat", "Mattt", "\"Matt"},
"Sam": {"San", "Nott", "Sma", "Sasm", "Sm"},
"Travis": {"Tarvis", "Travs", "Travia", "Traivs"},
"Taliesin": {"Taiesin", "Talisin", "Talisen", "Taleisn", "Talisein"},
"Marisha": {"Beau", "Mariasha", "Maisha", "Marisa", "Marish", "Marihsa", "Marsha", "Marsisha", "Marishaa"},
"Laura": {"Lauda", "Lauren", "Larua", "Laur"},
"Liam": {"Caleb", "Laim"},
"Ashley": {"Ashly", "Ashely", "Ashey"},
"All": {"Everyone", "Everybody"},
"Mark": {"Marik"},
"Brian": {"Brain"}
}
replacements = {}
for correct, typoset in typos.items():
for typo in typoset:
replacements[typo] = correct
def fix_typo(text: str) -> str:
for search, replace in replacements.items():
if text == search.upper():
text = replace.upper()
return text
if __name__ == '__main__':
print(fix_typo("San"))

16
utils.py Normal file
View file

@ -0,0 +1,16 @@
from datetime import timedelta
from pathlib import Path
srtdir = Path("./data/subtitles/")
def td_to_milliseconds(td: timedelta) -> int:
return int(td.total_seconds() * 1000)
def milliseconds_to_td(ms: int) -> timedelta:
return timedelta(milliseconds=ms)
def get_filename(campaign: int, episode: int) -> Path:
return srtdir / f"C{campaign}E{episode}.srt"

21
web/.gitignore vendored Normal file
View file

@ -0,0 +1,21 @@
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

24
web/README.md Normal file
View file

@ -0,0 +1,24 @@
# web
## Project setup
```
yarn install
```
### Compiles and hot-reloads for development
```
yarn serve
```
### Compiles and minifies for production
```
yarn build
```
### Lints and fixes files
```
yarn lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).

5
web/babel.config.js Normal file
View file

@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/app'
]
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

428
web/fonts/LICENSE Normal file
View file

@ -0,0 +1,428 @@
Attribution-ShareAlike 4.0 International
=======================================================================
Creative Commons Corporation ("Creative Commons") is not a law firm and
does not provide legal services or legal advice. Distribution of
Creative Commons public licenses does not create a lawyer-client or
other relationship. Creative Commons makes its licenses and related
information available on an "as-is" basis. Creative Commons gives no
warranties regarding its licenses, any material licensed under their
terms and conditions, or any related information. Creative Commons
disclaims all liability for damages resulting from their use to the
fullest extent possible.
Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms and
conditions that creators and other rights holders may use to share
original works of authorship and other material subject to copyright
and certain other rights specified in the public license below. The
following considerations are for informational purposes only, are not
exhaustive, and do not form part of our licenses.
Considerations for licensors: Our public licenses are
intended for use by those authorized to give the public
permission to use material in ways otherwise restricted by
copyright and certain other rights. Our licenses are
irrevocable. Licensors should read and understand the terms
and conditions of the license they choose before applying it.
Licensors should also secure all rights necessary before
applying our licenses so that the public can reuse the
material as expected. Licensors should clearly mark any
material not subject to the license. This includes other CC-
licensed material, or material used under an exception or
limitation to copyright. More considerations for licensors:
wiki.creativecommons.org/Considerations_for_licensors
Considerations for the public: By using one of our public
licenses, a licensor grants the public permission to use the
licensed material under specified terms and conditions. If
the licensor's permission is not necessary for any reason--for
example, because of any applicable exception or limitation to
copyright--then that use is not regulated by the license. Our
licenses grant only permissions under copyright and certain
other rights that a licensor has authority to grant. Use of
the licensed material may still be restricted for other
reasons, including because others have copyright or other
rights in the material. A licensor may make special requests,
such as asking that all changes be marked or described.
Although not required by our licenses, you are encouraged to
respect those requests where reasonable. More_considerations
for the public:
wiki.creativecommons.org/Considerations_for_licensees
=======================================================================
Creative Commons Attribution-ShareAlike 4.0 International Public
License
By exercising the Licensed Rights (defined below), You accept and agree
to be bound by the terms and conditions of this Creative Commons
Attribution-ShareAlike 4.0 International Public License ("Public
License"). To the extent this Public License may be interpreted as a
contract, You are granted the Licensed Rights in consideration of Your
acceptance of these terms and conditions, and the Licensor grants You
such rights in consideration of benefits the Licensor receives from
making the Licensed Material available under these terms and
conditions.
Section 1 -- Definitions.
a. Adapted Material means material subject to Copyright and Similar
Rights that is derived from or based upon the Licensed Material
and in which the Licensed Material is translated, altered,
arranged, transformed, or otherwise modified in a manner requiring
permission under the Copyright and Similar Rights held by the
Licensor. For purposes of this Public License, where the Licensed
Material is a musical work, performance, or sound recording,
Adapted Material is always produced where the Licensed Material is
synched in timed relation with a moving image.
b. Adapter's License means the license You apply to Your Copyright
and Similar Rights in Your contributions to Adapted Material in
accordance with the terms and conditions of this Public License.
c. BY-SA Compatible License means a license listed at
creativecommons.org/compatiblelicenses, approved by Creative
Commons as essentially the equivalent of this Public License.
d. Copyright and Similar Rights means copyright and/or similar rights
closely related to copyright including, without limitation,
performance, broadcast, sound recording, and Sui Generis Database
Rights, without regard to how the rights are labeled or
categorized. For purposes of this Public License, the rights
specified in Section 2(b)(1)-(2) are not Copyright and Similar
Rights.
e. Effective Technological Measures means those measures that, in the
absence of proper authority, may not be circumvented under laws
fulfilling obligations under Article 11 of the WIPO Copyright
Treaty adopted on December 20, 1996, and/or similar international
agreements.
f. Exceptions and Limitations means fair use, fair dealing, and/or
any other exception or limitation to Copyright and Similar Rights
that applies to Your use of the Licensed Material.
g. License Elements means the license attributes listed in the name
of a Creative Commons Public License. The License Elements of this
Public License are Attribution and ShareAlike.
h. Licensed Material means the artistic or literary work, database,
or other material to which the Licensor applied this Public
License.
i. Licensed Rights means the rights granted to You subject to the
terms and conditions of this Public License, which are limited to
all Copyright and Similar Rights that apply to Your use of the
Licensed Material and that the Licensor has authority to license.
j. Licensor means the individual(s) or entity(ies) granting rights
under this Public License.
k. Share means to provide material to the public by any means or
process that requires permission under the Licensed Rights, such
as reproduction, public display, public performance, distribution,
dissemination, communication, or importation, and to make material
available to the public including in ways that members of the
public may access the material from a place and at a time
individually chosen by them.
l. Sui Generis Database Rights means rights other than copyright
resulting from Directive 96/9/EC of the European Parliament and of
the Council of 11 March 1996 on the legal protection of databases,
as amended and/or succeeded, as well as other essentially
equivalent rights anywhere in the world.
m. You means the individual or entity exercising the Licensed Rights
under this Public License. Your has a corresponding meaning.
Section 2 -- Scope.
a. License grant.
1. Subject to the terms and conditions of this Public License,
the Licensor hereby grants You a worldwide, royalty-free,
non-sublicensable, non-exclusive, irrevocable license to
exercise the Licensed Rights in the Licensed Material to:
a. reproduce and Share the Licensed Material, in whole or
in part; and
b. produce, reproduce, and Share Adapted Material.
2. Exceptions and Limitations. For the avoidance of doubt, where
Exceptions and Limitations apply to Your use, this Public
License does not apply, and You do not need to comply with
its terms and conditions.
3. Term. The term of this Public License is specified in Section
6(a).
4. Media and formats; technical modifications allowed. The
Licensor authorizes You to exercise the Licensed Rights in
all media and formats whether now known or hereafter created,
and to make technical modifications necessary to do so. The
Licensor waives and/or agrees not to assert any right or
authority to forbid You from making technical modifications
necessary to exercise the Licensed Rights, including
technical modifications necessary to circumvent Effective
Technological Measures. For purposes of this Public License,
simply making modifications authorized by this Section 2(a)
(4) never produces Adapted Material.
5. Downstream recipients.
a. Offer from the Licensor -- Licensed Material. Every
recipient of the Licensed Material automatically
receives an offer from the Licensor to exercise the
Licensed Rights under the terms and conditions of this
Public License.
b. Additional offer from the Licensor -- Adapted Material.
Every recipient of Adapted Material from You
automatically receives an offer from the Licensor to
exercise the Licensed Rights in the Adapted Material
under the conditions of the Adapter's License You apply.
c. No downstream restrictions. You may not offer or impose
any additional or different terms or conditions on, or
apply any Effective Technological Measures to, the
Licensed Material if doing so restricts exercise of the
Licensed Rights by any recipient of the Licensed
Material.
6. No endorsement. Nothing in this Public License constitutes or
may be construed as permission to assert or imply that You
are, or that Your use of the Licensed Material is, connected
with, or sponsored, endorsed, or granted official status by,
the Licensor or others designated to receive attribution as
provided in Section 3(a)(1)(A)(i).
b. Other rights.
1. Moral rights, such as the right of integrity, are not
licensed under this Public License, nor are publicity,
privacy, and/or other similar personality rights; however, to
the extent possible, the Licensor waives and/or agrees not to
assert any such rights held by the Licensor to the limited
extent necessary to allow You to exercise the Licensed
Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this
Public License.
3. To the extent possible, the Licensor waives any right to
collect royalties from You for the exercise of the Licensed
Rights, whether directly or through a collecting society
under any voluntary or waivable statutory or compulsory
licensing scheme. In all other cases the Licensor expressly
reserves any right to collect such royalties.
Section 3 -- License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the
following conditions.
a. Attribution.
1. If You Share the Licensed Material (including in modified
form), You must:
a. retain the following if it is supplied by the Licensor
with the Licensed Material:
i. identification of the creator(s) of the Licensed
Material and any others designated to receive
attribution, in any reasonable manner requested by
the Licensor (including by pseudonym if
designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of
warranties;
v. a URI or hyperlink to the Licensed Material to the
extent reasonably practicable;
b. indicate if You modified the Licensed Material and
retain an indication of any previous modifications; and
c. indicate the Licensed Material is licensed under this
Public License, and include the text of, or the URI or
hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any
reasonable manner based on the medium, means, and context in
which You Share the Licensed Material. For example, it may be
reasonable to satisfy the conditions by providing a URI or
hyperlink to a resource that includes the required
information.
3. If requested by the Licensor, You must remove any of the
information required by Section 3(a)(1)(A) to the extent
reasonably practicable.
b. ShareAlike.
In addition to the conditions in Section 3(a), if You Share
Adapted Material You produce, the following conditions also apply.
1. The Adapter's License You apply must be a Creative Commons
license with the same License Elements, this version or
later, or a BY-SA Compatible License.
2. You must include the text of, or the URI or hyperlink to, the
Adapter's License You apply. You may satisfy this condition
in any reasonable manner based on the medium, means, and
context in which You Share Adapted Material.
3. You may not offer or impose any additional or different terms
or conditions on, or apply any Effective Technological
Measures to, Adapted Material that restrict exercise of the
rights granted under the Adapter's License You apply.
Section 4 -- Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that
apply to Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
to extract, reuse, reproduce, and Share all or a substantial
portion of the contents of the database;
b. if You include all or a substantial portion of the database
contents in a database in which You have Sui Generis Database
Rights, then the database in which You have Sui Generis Database
Rights (but not its individual contents) is Adapted Material,
including for purposes of Section 3(b); and
c. You must comply with the conditions in Section 3(a) if You Share
all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not
replace Your obligations under this Public License where the Licensed
Rights include other Copyright and Similar Rights.
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
c. The disclaimer of warranties and limitation of liability provided
above shall be interpreted in a manner that, to the extent
possible, most closely approximates an absolute disclaimer and
waiver of all liability.
Section 6 -- Term and Termination.
a. This Public License applies for the term of the Copyright and
Similar Rights licensed here. However, if You fail to comply with
this Public License, then Your rights under this Public License
terminate automatically.
b. Where Your right to use the Licensed Material has terminated under
Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided
it is cured within 30 days of Your discovery of the
violation; or
2. upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any
right the Licensor may have to seek remedies for Your violations
of this Public License.
c. For the avoidance of doubt, the Licensor may also offer the
Licensed Material under separate terms or conditions or stop
distributing the Licensed Material at any time; however, doing so
will not terminate this Public License.
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
License.
Section 7 -- Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different
terms or conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the
Licensed Material not stated herein are separate from and
independent of the terms and conditions of this Public License.
Section 8 -- Interpretation.
a. For the avoidance of doubt, this Public License does not, and
shall not be interpreted to, reduce, limit, restrict, or impose
conditions on any use of the Licensed Material that could lawfully
be made without permission under this Public License.
b. To the extent possible, if any provision of this Public License is
deemed unenforceable, it shall be automatically reformed to the
minimum extent necessary to make it enforceable. If the provision
cannot be reformed, it shall be severed from this Public License
without affecting the enforceability of the remaining terms and
conditions.
c. No term or condition of this Public License will be waived and no
failure to comply consented to unless expressly agreed to by the
Licensor.
d. Nothing in this Public License constitutes or may be interpreted
as a limitation upon, or waiver of, any privileges and immunities
that apply to the Licensor or You, including from the legal
processes of any jurisdiction or authority.
=======================================================================
Creative Commons is not a party to its public
licenses. Notwithstanding, Creative Commons may elect to apply one of
its public licenses to material it publishes and in those instances
will be considered the “Licensor.” The text of the Creative Commons
public licenses is dedicated to the public domain under the CC0 Public
Domain Dedication. Except for the limited purpose of indicating that
material is shared under a Creative Commons public license or as
otherwise permitted by the Creative Commons policies published at
creativecommons.org/policies, Creative Commons does not authorize the
use of the trademark "Creative Commons" or any other trademark or logo
of Creative Commons without its prior written consent including,
without limitation, in connection with any unauthorized modifications
to any of its public licenses or any other arrangements,
understandings, or agreements concerning use of licensed material. For
the avoidance of doubt, this paragraph does not form part of the
public licenses.
Creative Commons may be contacted at creativecommons.org.

Binary file not shown.

Binary file not shown.

9
web/fonts/README.md Normal file
View file

@ -0,0 +1,9 @@
# Fonts
This is a fork of https://github.com/jonathonf/solbera-dnd-fonts
CC-BY-SA-4.0
by Solbera and Ryrok
added woff2 files

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

39
web/package.json Normal file
View file

@ -0,0 +1,39 @@
{
"name": "web",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"@trevoreyre/autocomplete-vue": "^2.1.1",
"@types/lodash": "^4.14.149",
"bootstrap": "^4.4.1",
"bootstrap-vue": "^2.5.0",
"core-js": "^2.6.5",
"lodash": "^4.17.15",
"vue": "^2.6.10",
"vue-router": "^3.0.3",
"vue-youtube": "^1.4.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.12.0",
"@vue/cli-plugin-typescript": "^3.12.0",
"@vue/cli-service": "^3.12.0",
"node-sass": "^4.12.0",
"sass-loader": "^8.0.0",
"typescript": "^3.4.3",
"vue-template-compiler": "^2.6.10"
},
"postcss": {
"plugins": {
"autoprefixer": {}
}
},
"browserslist": [
"> 1%",
"last 2 versions"
]
}

17
web/public/index.html Normal file
View file

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<!-- <link rel="icon" href="<%= BASE_URL %>favicon.ico">-->
<title>web</title>
</head>
<body>
<noscript>
<strong>We're sorry but web doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

20
web/src/App.vue Normal file
View file

@ -0,0 +1,20 @@
<template>
<div id="app">
<div class="container">
<router-view/>
</div>
</div>
</template>
<style lang="scss">
#nav {
padding: 30px;
a {
font-weight: bold;
color: #2c3e50;
&.router-link-exact-active {
color: #42b983;
}
}
}
</style>

View file

@ -0,0 +1,45 @@
// strongly inspired by
// https://github.com/trevoreyre/autocomplete/blob/master/packages/style.css
.autocomplete-input {
@extend .form-control;
}
.autocomplete-result-list {
background: url("assets/Old_papertest.jpg");
list-style: none;
padding: 0;
border: solid 2px $border-color;
}
/* Loading spinner */
.autocomplete[data-loading="true"]::after {
content: "";
border: 3px solid rgba(0, 0, 0, 0.12);
border-right: 3px solid rgba(0, 0, 0, 0.48);
border-radius: 100%;
width: 20px;
height: 20px;
position: absolute;
right: 12px;
top: 50%;
transform: translateY(-50%);
animation: rotate 1s infinite linear;
}
.autocomplete-result {
padding: 0 10px;
&:hover,
&[aria-selected="true"] {
background-color: rgba(0, 0, 0, 0.06);
}
}
@keyframes rotate {
from {
transform: translateY(-50%) rotate(0deg);
}
to {
transform: translateY(-50%) rotate(359deg);
}
}

5
web/src/_colors.scss Normal file
View file

@ -0,0 +1,5 @@
$background-color: #EEE5CE;
$border-color: #c9ad6a;
$headings-color: #58180D;
$primary: $headings-color;

164
web/src/_fonts.scss Normal file
View file

@ -0,0 +1,164 @@
@font-face {
font-family: "Bookinsanity";
src: url("../fonts/Bookinsanity/Bookinsanity.woff2") format("woff2"),
url("../fonts/Bookinsanity/Bookinsanity.otf") format("opentype");
font-weight: normal;
}
@font-face {
font-family: "Bookinsanity";
src: url("../fonts/Bookinsanity/Bookinsanity Bold Italic.woff2") format("woff2"),
url("../fonts/Bookinsanity/Bookinsanity Bold Italic.otf") format("opentype");
font-weight: bold;
}
@font-face {
font-family: "Bookinsanity";
src: url("../fonts/Bookinsanity/Bookinsanity Bold.woff2") format("woff2"),
url("../fonts/Bookinsanity/Bookinsanity Bold.otf") format("opentype");
font-weight: bold;
font-style: normal;
}
@font-face {
font-family: "Bookinsanity";
src: url("../fonts/Bookinsanity/Bookinsanity Italic.woff2") format("woff2"),
url("../fonts/Bookinsanity/Bookinsanity Italic.otf") format("opentype");
font-weight: normal;
font-style: italic;
}
@font-face {
font-family: "Zatanna Misdirection";
src: url("../fonts/Zatanna Misdirection/Zatanna Misdirection.woff2") format("woff2"),
url("../fonts/Zatanna Misdirection/Zatanna Misdirection.otf") format("opentype");
font-weight: normal;
}
@font-face {
font-family: "Zatanna Misdirection";
src: url("../fonts/Zatanna Misdirection/Zatanna Misdirection Bold Italic.woff2") format("woff2"),
url("../fonts/Zatanna Misdirection/Zatanna Misdirection Bold Italic.otf") format("opentype");
font-weight: bold;
}
@font-face {
font-family: "Zatanna Misdirection";
src: url("../fonts/Zatanna Misdirection/Zatanna Misdirection Bold.woff2") format("woff2"),
url("../fonts/Zatanna Misdirection/Zatanna Misdirection Bold.otf") format("opentype");
font-weight: bold;
font-style: normal;
}
@font-face {
font-family: "Zatanna Misdirection";
src: url("../fonts/Zatanna Misdirection/Zatanna Misdirection Italic.woff2") format("woff2"),
url("../fonts/Zatanna Misdirection/Zatanna Misdirection Italic.otf") format("opentype");
font-weight: normal;
font-style: italic;
}
@font-face {
font-family: "Nodesto Caps Condensed";
src: url("../fonts/Nodesto Caps Condensed/Nodesto Caps Condensed.woff2") format("woff2"),
url("../fonts/Nodesto Caps Condensed/Nodesto Caps Condensed.otf") format("opentype");
font-weight: normal;
}
@font-face {
font-family: "Nodesto Caps Condensed";
src: url("../fonts/Nodesto Caps Condensed/Nodesto Caps Condensed Bold Italic.woff2") format("woff2"),
url("../fonts/Nodesto Caps Condensed/Nodesto Caps Condensed Bold Italic.otf") format("opentype");
font-weight: bold;
}
@font-face {
font-family: "Nodesto Caps Condensed";
src: url("../fonts/Nodesto Caps Condensed/Nodesto Caps Condensed Bold.woff2") format("woff2"),
url("../fonts/Nodesto Caps Condensed/Nodesto Caps Condensed Bold.otf") format("opentype");
font-weight: bold;
font-style: normal;
}
@font-face {
font-family: "Nodesto Caps Condensed";
src: url("../fonts/Nodesto Caps Condensed/Nodesto Caps Condensed Italic.woff2") format("woff2"),
url("../fonts/Nodesto Caps Condensed/Nodesto Caps Condensed Italic.otf") format("opentype");
font-weight: normal;
font-style: italic;
}
@font-face {
font-family: "Mr Eaves Small Caps";
src: url("../fonts/Mr Eaves/Mr Eaves Small Caps.woff2") format("woff2"),
url("../fonts/Mr Eaves/Mr Eaves Small Caps.otf") format("opentype");
font-weight: normal;
}
@font-face {
font-family: "Scaly Sans";
src: url("../fonts/Scaly Sans/Scaly Sans.woff2") format("woff2"),
url("../fonts/Scaly Sans/Scaly Sans.otf") format("opentype");
font-weight: normal;
}
@font-face {
font-family: "Scaly Sans";
src: url("../fonts/Scaly Sans/Scaly Sans Bold Italic.woff2") format("woff2"),
url("../fonts/Scaly Sans/Scaly Sans Bold Italic.otf") format("opentype");
font-weight: bold;
font-style: italic;
}
@font-face {
font-family: "Scaly Sans";
src: url("../fonts/Scaly Sans/Scaly Sans Bold.woff2") format("woff2"),
url("../fonts/Scaly Sans/Scaly Sans Bold.otf") format("opentype");
font-weight: bold;
font-style: normal;
}
@font-face {
font-family: "Scaly Sans";
src: url("../fonts/Scaly Sans/Scaly Sans Italic.woff2") format("woff2"),
url("../fonts/Scaly Sans/Scaly Sans Italic.otf") format("opentype");
font-weight: normal;
font-style: italic;
}
@font-face {
font-family: "Scaly Sans Caps";
src: url("../fonts/Scaly Sans Caps/Scaly Sans Caps.woff2") format("woff2"),
url("../fonts/Scaly Sans Caps/Scaly Sans Caps.otf") format("opentype");
font-weight: normal;
}
@font-face {
font-family: "Scaly Sans Caps";
src: url("../fonts/Scaly Sans Caps/Scaly Sans Caps Bold Italic.woff2") format("woff2"),
url("../fonts/Scaly Sans Caps/Scaly Sans Caps Bold Italic.otf") format("opentype");
font-weight: bold;
}
@font-face {
font-family: "Scaly Sans Caps";
src: url("../fonts/Scaly Sans Caps/Scaly Sans Caps Bold.woff2") format("woff2"),
url("../fonts/Scaly Sans Caps/Scaly Sans Caps Bold.otf") format("opentype");
font-weight: bold;
font-style: normal;
}
@font-face {
font-family: "Scaly Sans Caps";
src: url("../fonts/Scaly Sans Caps/Scaly Sans Caps Italic.woff2") format("woff2"),
url("../fonts/Scaly Sans Caps/Scaly Sans Caps Italic.otf") format("opentype");
font-weight: normal;
font-style: italic;
}
@font-face {
font-family: "Solbera Imitation";
src: url("../fonts/Solbera Imitation/Solbera Imitation.woff2") format("woff2"),
url("../fonts/Solbera Imitation/Solbera Imitation.otf") format("opentype");
font-weight: normal;
}

14
web/src/_videoframe.scss Normal file
View file

@ -0,0 +1,14 @@
.ytwrapper {
font-family: "Mr Eaves Small Caps", serif;
position: fixed;
z-index: 100;
bottom: 0;
right: 0;
background: url("assets/Old_papertest.jpg");
border: 2px solid $border-color;
button {
display: block;
width: 100%;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 KiB

94
web/src/custom.scss Normal file
View file

@ -0,0 +1,94 @@
@import "colors";
@import '~bootstrap';
@import '~bootstrap-vue';
@import "fonts";
@import "videoframe";
@import "autocomplete";
body {
background: $background-color;
background: url("assets/Old_papertest.jpg");
font-family: "Scaly Sans", sans-serif;
}
.title {
h1 {
font-size: 4rem;
text-align: center;
}
span {
font-size: 2rem;
font-style: italic;
}
font-family: "Nodesto Caps Condensed", cursive;
}
.inputlist, .inputlist input {
font-family: "Mr Eaves Small Caps";
font-weight: bold;
font-size: 2rem;
}
.inputlist {
display: flex;
flex-wrap: wrap;
align-items: center;
input {
background: transparent;
color: $body-color;
&:focus, &:active {
background: transparent;
color: $body-color;
}
}
input[type=number] {
max-width: 5rem;
}
}
.entry {
.person {
font-weight: bold;
}
.line {
padding-left: 5px;
border-left: solid 5px $background-color;
&.note {
font-style: italic;
}
}
.title {
font-size: .529cm;
border-bottom: 2px solid $border-color;
margin-top: .2em;
margin-bottom: .2em;
font-family: "Mr Eaves Small Caps", serif;
font-weight: 800;
color: $headings-color;
display: flex;
justify-content: space-between;
button {
font-family: serif;
}
}
}
p {
font-family: "Bookinsanity", serif;
}
pre {
white-space: pre-wrap;
}

106
web/src/index.d.ts vendored Normal file
View file

@ -0,0 +1,106 @@
// Type definitions for @trevoreyre/autocomplete 2.0
// Project: https://github.com/trevoreyre/autocomplete/, https://autocomplete.trevoreyre.com/
// Definitions by: versedi <https://github.com/versedi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// from https://github.com/versedi/DefinitelyTyped/tree/trevoreyre/autocomplete-js/types/trevoreyre__autocomplete-js
export as namespace Autocomplete;
/**
* Creates a props object with overridden toString function. toString returns an attributes
* string in the format: `key1="value1" key2="value2"` for easy use in an HTML string.
*/
export class Props {
/**
* @param index string
* @param selectedIndex string
* @param baseClass string
*/
constructor(index: string, selectedIndex: string, baseClass: string);
toString(): string;
}
// --------------------------------------------------------------------------------------
// Options Interfaces
// --------------------------------------------------------------------------------------
export interface AutocompleteOptions {
/**
* The search function to be executed on user input. Can be a synchronous function or a Promise.
* @param input
*/
search(input: string): object | Promise<object>;
/**
* Controls whether first result should be highlighted after input
* Defaults to false, optional
*/
autoSelect?: boolean;
/**
* Sets the value of the calling component's input element
*/
setValue?(): () => void;
/**
* Sets attributes on the calling component's input element
*/
setAttribute?(): () => void;
/**
* Fired when the results list is updated. Receives results (Array), and selectedIndex (Number) as arguments.
*/
onUpdate?(): () => void;
/**
* Fired when user submits result. Receives result as argument.
* @param result
*/
onSubmit(result: object): void;
/**
*
* @param result
* @param props
*/
renderResult(result: object, props: Props): string;
/**
* Fired when the results list is shown
*/
onShow?(): () => void;
/**
* Fired when the results list is hidden
*/
onHide?(): () => void;
/**
* Fired if search is a Promise and hasn't resolved yet
*/
onLoading?(): () => void;
/**
* Fired after asynchronous search function resolves
*/
onLoaded?(): () => void;
}
export interface EventHandlers {
handleInput: () => void;
handleKeyDown: () => void;
handleBlur: () => void;
handleResultMouseDown: () => void;
handleResultClick: () => void;
}
// --------------------------------------------------------------------------------------
// Autocomplete
// --------------------------------------------------------------------------------------
declare global {
class Autocomplete<TElement = HTMLElement> {
constructor(inputSelector: string, options?: AutocompleteOptions);
options: AutocompleteOptions;
}
}

36
web/src/interfaces.ts Normal file
View file

@ -0,0 +1,36 @@
export interface Person {
"id": number;
"name": string;
"color": string;
}
export interface Episode {
"episode_number": number;
"id": number;
"season": number;
"youtube_id": string;
}
export interface Line {
"id": number;
"order": number;
"ismeta": boolean;
"isnote": boolean;
"starttime": number;
"endtime": number;
"text": string;
"person": Person;
"episode": Episode;
}
export interface Result {
"resultID": number;
"centerID": number;
"offset": number;
"lines": Line[];
}
export interface ServerMessage {
status: string;
message: string;
}

14
web/src/main.ts Normal file
View file

@ -0,0 +1,14 @@
import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import {BootstrapVue, IconsPlugin} from "bootstrap-vue";
import "./custom.scss";
Vue.config.productionTip = false;
new Vue({
router,
render: (h) => h(App),
}).$mount("#app");
Vue.use(BootstrapVue);

30
web/src/router.ts Normal file
View file

@ -0,0 +1,30 @@
import Vue from "vue";
import Router from "vue-router";
import Home from "./views/Home.vue";
Vue.use(Router);
export default new Router({
mode: "history",
base: process.env.BASE_URL,
routes: [
{
path: "/",
redirect: "/search/",
},
{
path: "/search/:keyword?",
name: "search",
component: Home,
props: true,
},
{
path: "/about",
name: "about",
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () => import(/* webpackChunkName: "about" */ "./views/About.vue"),
},
],
});

13
web/src/shims-tsx.d.ts vendored Normal file
View file

@ -0,0 +1,13 @@
import Vue, { VNode } from 'vue';
declare global {
namespace JSX {
// tslint:disable no-empty-interface
interface Element extends VNode {}
// tslint:disable no-empty-interface
interface ElementClass extends Vue {}
interface IntrinsicElements {
[elem: string]: any;
}
}
}

4
web/src/shims-vue.d.ts vendored Normal file
View file

@ -0,0 +1,4 @@
declare module '*.vue' {
import Vue from 'vue';
export default Vue;
}

5
web/src/views/About.vue Normal file
View file

@ -0,0 +1,5 @@
<template>
<div class="about">
<h1>This is an about page</h1>
</div>
</template>

207
web/src/views/Home.vue Normal file
View file

@ -0,0 +1,207 @@
<template>
<div class="home">
<div class="title">
<h1>Critical Role Search</h1>
<span>Find your favourite Critical Role quote!</span>
</div>
<div v-if="showYT" class="ytwrapper">
<button class="btn" @click="closeVideo">Hide</button>
<youtube :nocookie="true" ref="youtube" @ready="playVideo(false)"></youtube>
</div>
<div class="inputlist">
<span>Search for</span>
<autocomplete :defaultValue="keyword" :search="suggest" @submit="handleSubmit"
ref="searchInput"></autocomplete>
<span>up to episode </span>
<input title="search until episode number"
class="form-control" type="number" v-model="episode"
min="1" max="300">
</div>
<b-alert v-if="error" show :variant="error.status">{{error.message}}</b-alert>
<div class="entry" v-for="result in searchResult">
<div class="title">
<div>{{episodeName(firstLine(result))}} {{formatTimestamp(firstLine(result).starttime)}}</div>
<div class="buttons">
<button class="btn" @click="playVideo(result)">
<b-icon-play-fill></b-icon-play-fill>
</button>
<button class="btn" v-if="result.offset<10" @click="expand(result)">
+
</button>
</div>
</div>
<p :class="{line:true,note:line.isnote|line.ismeta}" :style="{borderLeftColor:getColor(line)}"
v-for="line in result.lines" :key="line.id">
<span v-if="line.person" class="person">{{line.person.name}}: </span><span v-html="line.text"></span>
</p>
</div>
<pre>{{searchResult}}</pre>
</div>
</template>
<script lang="ts">
import Vue from "vue";
import HelloWorld from "@/components/HelloWorld.vue"; // @ is an alias to /src
// @ts-ignore
import Autocomplete from "@trevoreyre/autocomplete-vue";
// import "@trevoreyre/autocomplete-vue/dist/style.css";
import {Line, Result, ServerMessage} from "@/interfaces";
import {BAlert} from "bootstrap-vue";
// @ts-ignore
import VueYoutube from "vue-youtube";
import {debounce} from "lodash";
import {BIcon, BIconPlayFill} from "bootstrap-vue";
Vue.use(VueYoutube);
export default Vue.extend({
name: "home",
components: {
Autocomplete,
BAlert,
BIcon,
BIconPlayFill,
},
props: {
keyword: String
},
data() {
return {
searchResult: [] as Result[],
episode: 10,
error: undefined as ServerMessage | undefined,
ytVideoID: undefined as string | undefined,
showYT: false,
ytResult: undefined as Result | undefined
};
},
mounted(): void {
document.title = "CR Search";
if (localStorage.episode) {
this.episode = localStorage.episode;
}
if (this.keyword) {
this.search(this.keyword);
}
},
methods: {
suggest(input: string) {
const url = "http://127.0.0.1:5000/suggest?query=" + input + "&until=" + this.episode;
return new Promise(resolve => {
if (input.length < 1) {
return resolve([]);
}
fetch(url)
.then(response => response.json())
.then((data: string[]) => {
resolve(data);
});
});
},
handleSubmit(result: string) {
// @ts-ignore
const q = result || this.$refs.searchInput.value;
this.handleSearch(q);
},
handleSearch(keyword: string) {
this.$router.replace({name: "search", params: {keyword: keyword}});
},
search(keyword: string): void {
if (!keyword) {
return;
}
const url = "http://127.0.0.1:5000/search?query=" + keyword + "&until=" + this.episode;
fetch(url)
.then(response => response.json())
.then((data) => {
if (data.status) {
this.error = data;
this.searchResult = [];
} else {
this.error = undefined;
this.searchResult = data;
}
});
},
expand(result: Result) {
const offset = result.offset ? result.offset : 1;
const url = "http://127.0.0.1:5000/expand?centerID=" + result.centerID + "&offset=" + offset;
fetch(url)
.then(response => response.json())
.then((data: Line[]) => {
this.searchResult[result.resultID].lines.push(...data);
this.searchResult[result.resultID].lines.sort(function(a, b) {
return a.order - b.order;
});
this.searchResult[result.resultID].offset = offset + 1;
});
},
firstLine(result: Result): Line {
return result.lines[0];
},
episodeName(line: Line): string {
return `C${line.episode.season}E${line.episode.episode_number}`;
},
formatTimestamp(ts: number) {
return new Date(ts).toISOString().substr(11, 8);
},
getColor(line: Line): string {
if (line.ismeta) {
return "pink";
} else if (line.isnote) {
return "purple";
}
return line.person.color;
},
playVideo: function(result: Result): void {
console.info(!!result);
if (!result && this.ytResult) {
result = this.ytResult;
}
const firstLine = this.firstLine(result);
const newYtVideoID = firstLine.episode.youtube_id;
if (!this.$refs.youtube) {
this.showYT = true;
this.ytResult = result;
} else {
const player = this.$refs.youtube.player;
if (firstLine) {
if (this.ytVideoID === newYtVideoID) {
console.log("just seek");
player.seekTo(firstLine.starttime / 1000);
} else {
player.loadVideoById(
newYtVideoID,
firstLine.starttime / 1000,
firstLine.endtime / 1000
);
this.ytVideoID = newYtVideoID;
}
}
}
},
closeVideo(): void {
this.showYT = false;
this.ytVideoID = undefined;
this.ytResult = undefined;
}
},
watch: {
episode: debounce(function(newValue: number): void {
localStorage.episode = newValue;
// @ts-ignore
this.search(this.keyword);
}, 300),
keyword(val: string): void {
this.search(this.keyword);
}
},
});
</script>

38
web/tsconfig.json Normal file
View file

@ -0,0 +1,38 @@
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"strict": true,
"jsx": "preserve",
"importHelpers": true,
"moduleResolution": "node",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"baseUrl": ".",
"types": [
"webpack-env"
],
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
},
"include": [
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.vue",
"tests/**/*.ts",
"tests/**/*.tsx"
],
"exclude": [
"node_modules"
]
}

19
web/tslint.json Normal file
View file

@ -0,0 +1,19 @@
{
"defaultSeverity": "warning",
"extends": [
"tslint:recommended"
],
"linterOptions": {
"exclude": [
"node_modules/**"
]
},
"rules": {
"indent": [true, "spaces", 2],
"interface-name": false,
"no-consecutive-blank-lines": false,
"object-literal-sort-keys": false,
"ordered-imports": false,
"quotemark": [true, "double"]
}
}

8240
web/yarn.lock Normal file

File diff suppressed because it is too large Load diff