Esempio n. 1
0
import collections
import numpy as np
import sys
import pprint
import re
import codifier
import database
import math
import pickle
import string

# spacy
import spacy
try:
    import el_small
    nlp = el_small.load(max_length=2000000)
except:
    import el_core_web_sm
    nlp = el_core_web_sm.load(max_length=2000000)

sys.path.insert(0, '../resources')
import greek_lemmas

db = database.Database()


def contains_digit_or_num(i):
    return any(j.isdigit() or j in string.punctuation for j in i)


def process_topics(H, W, feature_names, data_samples, no_top_words,
Esempio n. 2
0
logger = logging.getLogger()
logger.disabled = True

# Import local modules
sys.path.insert(0, './')

from codifier import *
import helpers
autocomplete_laws = sorted(list(codifier.keys()))
autocomplete_topics = codifier.topic_keys()
autocomplete_ = autocomplete_laws + autocomplete_topics

# NLP Related packages
import spacy
import el_small
nlp = el_small.load()
import syntax

app = Flask(__name__)
application = app  # for gunicorn


# Unicode API Wrapper
class UnicodeApi(Api):
    def __init__(self, *args, **kwargs):
        super(UnicodeApi, self).__init__(*args, **kwargs)
        self.app.config['RESTFUL_JSON'] = {'ensure_ascii': False}

        self.representations = {
            'application/json; charset=utf-8': output_json,
        }