Dodana vrsta oz. semafor pri obdelovanju conllu datotek
This commit is contained in:
@@ -18,17 +18,10 @@ def get_conllu(file_id): # noqa: E501
|
|||||||
|
|
||||||
:rtype: str
|
:rtype: str
|
||||||
"""
|
"""
|
||||||
file_path = util.get_conllu_path_by_id(file_id)
|
|
||||||
|
|
||||||
a = Ngrams_Manager.get_by_file_id(file_id)
|
|
||||||
print(a)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return send_file(file_path, attachment_filename=f'{file_id}.conllu', as_attachment=True)
|
return send_file(util.get_conllu_path_by_id(file_id), attachment_filename=f'{file_id}.conllu')
|
||||||
except Exception as e:
|
except FileNotFoundError as e:
|
||||||
if "The system cannot find the file specified" in str(e):
|
|
||||||
return "The conllu with this ID doesn't exist.", 404
|
return "The conllu with this ID doesn't exist.", 404
|
||||||
return str(e), 400
|
|
||||||
|
|
||||||
|
|
||||||
def get_conllus(leta, vrste, kljucnebesede, cerifpodrocja): # noqa: E501
|
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
|
: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
|
||||||
|
|||||||
@@ -144,3 +144,7 @@ def _deserialize_dict(data, boxed_type):
|
|||||||
|
|
||||||
def get_conllu_path_by_id(file_id):
|
def get_conllu_path_by_id(file_id):
|
||||||
return f'..\\mnt\\ssd\\ds_ftp\\classla_OS2022\\conll\\rsdo_doc-{file_id}.plainText.conllu'
|
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'
|
||||||
|
|||||||
Reference in New Issue
Block a user