Dodana vrsta oz. semafor pri obdelovanju conllu datotek

This commit is contained in:
Kikimanox
2022-07-11 15:27:46 +02:00
parent b78e657266
commit 763ca8a7c6
2 changed files with 11 additions and 11 deletions
+6 -10
View File
@@ -18,17 +18,10 @@ def get_conllu(file_id): # noqa: E501
:rtype: str
"""
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 send_file(util.get_conllu_path_by_id(file_id), attachment_filename=f'{file_id}.conllu')
except FileNotFoundError as e:
return "The conllu with this ID doesn't exist.", 404
return str(e), 400
def get_conllus(leta, vrste, kljucnebesede, cerifpodrocja): # noqa: E501
@@ -149,4 +142,7 @@ def oss_besedilo_po_id_get(file_id): # noqa: E501
:rtype: str
"""
return 'do some magic!'
try:
return send_file(util.get_original_file_by_id(file_id), attachment_filename=f'{file_id}.conllu')
except FileNotFoundError as e:
return "The conllu with this ID doesn't exist.", 404
+4
View File
@@ -144,3 +144,7 @@ def _deserialize_dict(data, boxed_type):
def get_conllu_path_by_id(file_id):
return f'..\\mnt\\ssd\\ds_ftp\\classla_OS2022\\conll\\rsdo_doc-{file_id}.plainText.conllu'
def get_original_file_by_id(file_id):
return f'..\\mnt\\ssd\\ds_ftp\\classla_OS2022\\conll\\rsdo_doc-{file_id}.xml'