frames and slots from db

This commit is contained in:
2019-04-02 21:51:44 +02:00
parent 1f83f96267
commit ca942344d7
5 changed files with 45 additions and 6 deletions

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from flask import Flask, render_template, request, url_for, redirect
from valency import Frame, Slot
from valency.Frame import Frame, Slot, frames_from_db_entry
from valency.reduce_functions import reduce_functions
"""
@@ -39,6 +39,7 @@ CORPORA = ["ssj", "kres"]
app_index = {c: {} for c in CORPORA}
log = logging.getLogger(__name__)
valdb = None
app = Flask(__name__)
@@ -50,6 +51,18 @@ app = Flask(__name__)
CORS(app)
# DEV -------------------------------.
@app.route("/api/dev")
def api_dev():
cur = valdb.kres.find({"sid": "F0015940.37.2"})
frames = []
for ent in cur:
frames += frames_from_db_entry(ent)
return json.dumps([x.to_json() for x in frames])
# DEV -------------------------------^
# INDEX SELECTION -------------------.
@app.route("/api/words/<corpus>")