This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"username": "Reddit username", | |
"client_id": "Register a developer script on Reddit", | |
"client_secret": "See the above", | |
"password": "Your Reddit password" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import re | |
WEBNOVEL_SUBPATH = "《凡人修仙传》.txt" | |
WEBNOVEL_ENGLISH = "A Record of a Mortal's Journey to Immortality" | |
LEVELS = ["炼气", "筑基", "结丹", "元婴", "化神", "炼虚", "合体", "大乘"] | |
LEVELS_ENG = ["Qi Condensation", "Foundation Establishment", "Core Formation", "Nascent Soul", "Deity Transformation", | |
"Spatial Tempering", "Body Integration", "Grand Ascension"] | |
##### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@app.after_request | |
def refresh_expiring_jwts(response): | |
""" | |
Here we are supporting the implicit cookie refresh mechanism. | |
If a not-yet-expired access cookie (token) is sent with a request, it will be replaced | |
with one that is newly created, also for two weeks. | |
(Note that this will not work just by opening the app, the user also needs to do some actions). | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# generates a graph of the percentage known words of a text at every step | |
import argparse | |
from LAC import LAC | |
from plotly.subplots import make_subplots | |
import plotly.graph_objects as go | |
from collections import Counter | |
parser = argparse.ArgumentParser( | |
"Display a graph of your comprehension every *x* of a Chinese text file." | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup | |
from requests.adapters import HTTPAdapter | |
from requests.packages.urllib3.util.retry import Retry | |
session = requests.Session() | |
retry = Retry(connect=3, backoff_factor=0.5) | |
adapter = HTTPAdapter(max_retries=retry) | |
session.mount('http://', adapter) | |
session.mount('https://', adapter) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re, jieba, argparse | |
from collections import Counter | |
from re import compile as _Re | |
parser = argparse.ArgumentParser( | |
description="Calculates percentage comprehension of a text file based on known words." | |
) | |
parser.add_argument( | |
"-k", | |
"--known", |