示例#1
0
 def create_db(self):
     path = self.get_db_path()
     ds = DataStorage(path)
     ds.create_db()
     return ds, path
示例#2
0
import csv
import re
import logging
import json
import datetime

from ktokenizer import KTokenizer, tokenize
from compositedict import CompositeDictionary
from datastorage import DataStorage
from settings import Settings
from googledict import GoogleDictionary

app = Flask(__name__)

datastorage = DataStorage("../_kreader_files/kreader.db")
datastorage.create_db()

ktokenizer = None
composite_dict = CompositeDictionary(True)
google_dict = GoogleDictionary()

Textdesc = namedtuple('Textdesc', ['id', 'title', 'total_words', 'unique_words'])
Worddesc = namedtuple('Worddesc', ['id', 'word', 'definitions', 'added_min_ago', 'title',
                                   'left_context', 'context_word', 'right_context'])

@app.teardown_request
def remove_session(ex=None):
    datastorage.remove_session()

@app.route("/")
def start_page():