attachment_filename -> download_name
This commit is contained in:
@@ -132,7 +132,7 @@ def get_conllu(file_id): # noqa: E501
|
||||
:rtype: str
|
||||
"""
|
||||
try:
|
||||
return send_file(util.get_conllu_file_path_by_id(file_id), attachment_filename=f'{file_id}.conllu')
|
||||
return send_file(util.get_conllu_file_path_by_id(file_id), download_name=f'{file_id}.conllu')
|
||||
except FileNotFoundError as e:
|
||||
return "The conllu with this ID doesn't exist.", 404
|
||||
|
||||
@@ -148,7 +148,7 @@ def get_file(file_id): # noqa: E501
|
||||
:rtype: List[bytearray]
|
||||
"""
|
||||
try:
|
||||
return send_file(util.get_original_file_path_by_id(file_id), attachment_filename=f'{file_id}.xml')
|
||||
return send_file(util.get_original_file_path_by_id(file_id), download_name=f'{file_id}.xml')
|
||||
except FileNotFoundError as e:
|
||||
return "The file with this ID doesn't exist.", 404
|
||||
|
||||
@@ -164,6 +164,6 @@ def oss_besedilo_po_id_get(file_id): # noqa: E501
|
||||
:rtype: str
|
||||
"""
|
||||
try:
|
||||
return send_file(util.get_original_file_path_by_id(file_id), attachment_filename=f'{file_id}.xml')
|
||||
return send_file(util.get_original_file_path_by_id(file_id), download_name=f'{file_id}.xml')
|
||||
except FileNotFoundError as e:
|
||||
return "The file with this ID doesn't exist.", 404
|
||||
|
||||
@@ -175,8 +175,10 @@ def get_files_by_keywords(kljucnebesede):
|
||||
kljucnebesede = [k.lower() for k in kljucnebesede]
|
||||
# Temporary solution until connection with mariadb is fixed
|
||||
ngrams_path = "classla_OS2022/ngrams/" if is_docker() else "../mnt/ssd/ds_ftp/classla_OS2022/ngrams/"
|
||||
print("Looping trough ngrams")
|
||||
for path, dirs, files, in os.walk(ngrams_path):
|
||||
for _file in files:
|
||||
for i, _file in enumerate(files):
|
||||
if i % 200 == 0: print(f"{i}/{len(files)}")
|
||||
file = f'{ngrams_path}{_file}'
|
||||
data = pd.read_csv(file, sep='\t')
|
||||
amount = len(data[data['ngram_len'] == 1 & data['gram_text'].str.lower().isin(kljucnebesede)])
|
||||
|
||||
Reference in New Issue
Block a user