- Popravljena swagger definicija in json (/oznaciBesedilo ni delal)

- Dodani resourci za classlo
- Priprava util-ov za podatkovno bazo (se v zelo surovem stanju)
- Dodan docker-compose, ki bo potreben za nadaljni development
- Popravilejni controllerji
This commit is contained in:
Kristjan Žagar
2022-07-08 15:54:52 +02:00
parent aa2946ee4a
commit c8e4f7da17
10 changed files with 472 additions and 254 deletions
@@ -1,7 +1,9 @@
import connexion
import six
from swagger_server.models.oznaci_besedilo_body import OznaciBesediloBody # noqa: E501
from swagger_server import util
from swagger_server.classla import cl_utils
def get_text(body): # noqa: E501
@@ -9,11 +11,13 @@ def get_text(body): # noqa: E501
# noqa: E501
:param body:
:param body:
:type body: dict | bytes
:rtype: str
"""
if connexion.request.is_json:
body = str.from_dict(connexion.request.get_json()) # noqa: E501
return 'do some magic!'
body = OznaciBesediloBody.from_dict(connexion.request.get_json()) # noqa: E501
conllu = cl_utils.raw_text_to_conllu(body.besedilo)
return conllu
+14 -1
View File
@@ -1,8 +1,11 @@
import connexion
import six
import os
from swagger_server.models.terminoloski_kandidat import TerminoloskiKandidat # noqa: E501
from swagger_server import util
from flask import send_file
from swagger_server.db_utils import Ngrams_Manager
def get_conllu(file_id): # noqa: E501
@@ -15,7 +18,17 @@ def get_conllu(file_id): # noqa: E501
:rtype: str
"""
return 'do some magic!'
file_path = util.get_conllu_path_by_id(file_id)
a = Ngrams_Manager.get_by_file_id(file_id)
print(a)
try:
return send_file(file_path, attachment_filename=f'{file_id}.conllu', as_attachment=True)
except Exception as e:
if "The system cannot find the file specified" in str(e):
return "The conllu with this ID doesn't exist.", 404
return str(e), 400
def get_conllus(leta, vrste, kljucnebesede, cerifpodrocja): # noqa: E501