Skip to content

Commit

Permalink
added literature check and fix it for VKR
Browse files Browse the repository at this point in the history
  • Loading branch information
MarinaProsche committed Sep 29, 2024
1 parent 1041198 commit 4e62d4e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
17 changes: 12 additions & 5 deletions app/main/checks/report_checks/banned_words_in_literature.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import re

from .style_check_settings import StyleCheckSettings
from ..base_check import BaseReportCriterion, answer, morph


Expand All @@ -15,14 +15,21 @@ def __init__(self, file_info, banned_words=["wikipedia"], headers_map=None):
self.banned_words = [morph.normal_forms(word)[0] for word in banned_words]
self.name_pattern = r'список[ \t]*(использованных|использованной|)[ \t]*(источников|литературы)'
if headers_map:
self.requirement_header = headers_map
self.config = headers_map
else:
self.requirement_header ='список использованных источников'
self.config = 'VKR_HEADERS' if (self.file_type['report_type'] == 'VKR') else 'LR_HEADERS'

def late_init_vkr(self):
self.literature_header = self.file.find_literature_vkr(self.file_type['report_type'], self.requirement_header)
self.headers_page = self.file.find_header_page(self.file_type['report_type'])
self.lit_page = self.file.find_literature_page(self.file_type['report_type'])
self.lit_page = self.file.find_literature_page(self.file_type['report_type'])
self.headers = self.file.make_chapters(self.file_type['report_type'])
self.headers_main = self.file.get_main_headers(self.file_type['report_type'])
if not self.headers_main in StyleCheckSettings.CONFIGS.get(self.config):
self.headers_main = 'any_header'
if 'literature_header' in StyleCheckSettings.CONFIGS.get(self.config).get(self.headers_main):
self.literature_header = self.file.find_literature_vkr(self.file_type['report_type'], StyleCheckSettings.CONFIGS[self.config][self.headers_main]['literature_header'])
else:
self.literature_header = self.file.find_literature_vkr(self.file_type['report_type'], 'список использованных источников')

def check(self):
if self.file.page_counter() < 4:
Expand Down
5 changes: 5 additions & 0 deletions app/main/checks/report_checks/literature_references.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ def late_init_vkr(self):
else:
if 'any_header' in StyleCheckSettings.CONFIGS.get(self.config):
self.min_ref = StyleCheckSettings.CONFIGS.get(self.config)['any_header']['min_ref_for_literature_references_check']
self.headers_main = 'any_header'
self.max_ref = StyleCheckSettings.CONFIGS.get(self.config)['any_header']['mах_ref_for_literature_references_check']
if 'literature_header' in StyleCheckSettings.CONFIGS.get(self.config).get(self.headers_main):
self.literature_header = self.file.find_literature_vkr(self.file_type['report_type'], StyleCheckSettings.CONFIGS[self.config][self.headers_main]['literature_header'])
else:
self.literature_header = self.file.find_literature_vkr(self.file_type['report_type'], 'список использованных источников')

def check(self):
if self.file.page_counter() < 4:
Expand Down
5 changes: 3 additions & 2 deletions app/main/checks/report_checks/style_check_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class StyleCheckSettings:
{
"style": HEADER_1_STYLE,
"docx_style": ["heading 2"],
"headers": ["ВВЕДЕНИЕ", "ЗАКЛЮЧЕНИЕ", "СПИСОК ИСПОЛЬЗОВАННЫХ ИСТОЧНИКОВ"],
"headers": ["введение", "заключение", "список использованных источников"],
"unify_regex": None,
"regex": HEADER_REGEX,
"banned_words": STD_BANNED_WORDS,
Expand All @@ -139,12 +139,13 @@ class StyleCheckSettings:
"style": HEADER_1_STYLE,
"docx_style": ["heading 2"],
"headers": ["постановка задачи", "результаты работы в весеннем семестре", "описание предполагаемого метода решения",
"план работы на осенний семестр", "список использованных источников"],
"план работы на осенний семестр", "список литературы"],
"unify_regex": None,
"regex": HEADER_REGEX,
"banned_words": ['wikipedia', 'wikipedia.org'],
'min_count_for_banned_words_check': 3,
'max_count_for_banned_words_check': 6,
'literature_header': 'список литературы',
'min_ref_for_literature_references_check': STD_MIN_LIT_REF,
'mах_ref_for_literature_references_check': STD_MAX_LIT_REF,
'template_name': ('^\d+_[А-Яа-я]+\_[А-Я]{2}_NIR2', '1111_Иванов_ИИ_NIR2')
Expand Down

0 comments on commit 4e62d4e

Please sign in to comment.