Skip to content

Conversation

@Dariiiii
Copy link
Collaborator

@Dariiiii Dariiiii commented Mar 6, 2025

No description provided.

@github-actions github-actions bot added the has conflicts if new merge has conflicts label Mar 10, 2025
@github-actions github-actions bot removed the has conflicts if new merge has conflicts label Apr 10, 2025
'image_size': image_size
})
images_collection.insert_one(image.pack())
print(str(check_id) + " " + str(caption))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Удалите отладочные комментари

return None

def save_image_to_db(check_id, image_data, caption, image_size):
image = Image({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

возможно, полезно будет сохранять ещё какую-то информацию об изображении (страница, где она расположена или другая информация, которая поможет найти это изображение в тексте?)

image = Image({
'check_id': check_id,
'image_data': image_data,
'caption': caption,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

откуда берется подпись / что она из себя представляет? есть ли у всех изображений - или это подпись "Рис. 2 - ...", которую кто-то может не указать?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Да, это подпись "Рис. 2 - ..."
Подпись извлекается в файле docx_uploader.py в строках 273-285

Comment on lines +35 to +39
if self.laplacian_score < self.min_laplacian:
deny_list.append(f"Изображение с подписью '{img.caption}' имеет низкий показатель лапласиана: {self.laplacian_score} (минимум {self.min_laplacian}).<br>")

if self.entropy_score < self.min_entropy:
deny_list.append(f"Изображение с подписью '{img.caption}' имеет низкую энтропию: {self.entropy_score} (минимум {self.min_entropy}).<br>")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Рядовой студент точно не будет знать (или гуглить), кто такое лапласиан и энтропия - возможно, стоит сделать пояснение (= пользователь должен понять, что и как ему исправить)

if self.entropy_score < self.min_entropy:
deny_list.append(f"Изображение с подписью '{img.caption}' имеет низкую энтропию: {self.entropy_score} (минимум {self.min_entropy}).<br>")
else:
return answer(False, 'Изображения не найдены!')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Гипотетически работа может быть без рисунков (и вроде как это не будет нарушением)

Comment on lines +30 to +41
check = Check({
'filename': basename(new_filepath),
})

file_id = 0
file = files_info_collection.find_one({'name': basename(new_filepath)})
if file:
file_id = file['_id']

check_id = add_check(file_id, check)
presentation.extract_images_with_captions(check_id)
file_object = presentation
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не совсем понимаю происходящее, но проверки по имени файла (и затем поиск её по нему) - не подходит, поскольку студенты могут загружать файл с одним и тем же названием по несколько раз (при этом содержимое разное)

Comment on lines +53 to 65
check = Check({
'filename': basename(new_filepath),
})

file_id = 0
file = files_info_collection.find_one({'name': basename(new_filepath)})
if file:
file_id = file['_id']

check_id = add_check(file_id, check)
docx.parse()
docx.extract_images_with_captions(check_id)
file_object = docx
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

избавьтесь от дублирования кода (с блоком выше)


# Извлечение бинарных данных изображения
image_streams = run._element.findall('.//a:blip', namespaces={
'a': 'http://schemas.openxmlformats.org/drawingml/2006/main'})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Правильно ли я понимаю, что 2006 тут и дальше - это год какого-то стандарта? не может ли в документе быть другого? (и вдруг мы что-то пропустим)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Да, 2006 в пространствах имен указывает на год, когда были определены стандарты Office Open XML.
Эти стандарты остаются актуальными и в более поздних версиях Office, включая Office 2016, Office 2019, Office 2021 и Microsoft 365, так что должны ничего не пропустить.

@HadronCollider
Copy link
Collaborator

Перенесен в #656

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants