-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parsing codexes #26
Parsing codexes #26
Conversation
…ltaneously divide into punkts and abzats.
…ort the division of articles into smaller parts than the article parts themselves.
web_crawler/law_codes.py
Outdated
encoding='utf-8') as file: | ||
file.write(doc_id + '\n') | ||
# print('ok') | ||
# pathToFile = f'{cls.CODE_PART_KEY}.json' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Опять много комментариев с кодом)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Удалил неиспользуемое. Остальные нужны, в тех местах непосредственно будет продолжена разработка.
codes = {'КОАПРФ', 'НКРФ', 'ГКРФ', 'УКРФ'} | ||
get_content(codes) | ||
print(f"\nCodes processing spent {time.time()-start_time} seconds.\n") | ||
input("press any key...") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Так норм, но если дальше потребуется расширение, нужно применять паттерны. Куча if-выражений всегда является признаком "кода с запахом", думаю, тут КА может хорошо зайти. Ну, а пока так оставим.
@@ -135,7 +135,7 @@ def get_decision_headers(pagesNumber=None, sourcePrefix='КСРФ'): | |||
page = html.document_fromstring(get_page_html_by_num( | |||
driver, template, i)) | |||
if True: # debug print: | |||
print(f"Pages downloaded: {i-1}/{pagesNumber}") | |||
print(f"Pages downloaded: {i-1}/{pagesNumber}", end='\r') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Почему именно end='\r'?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Возврат каретки. Чтобы при обновлении строки менялся номер, а не выводилась новая строка.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ок, понял
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тогда удали неиспользуемый код и сливай.
Pull Request
Описание
Парсинг кодексов (ГК, НК, КоАП, УК), ниже частей пока не делит. Так же сохраняет редакции в файл в виде json-строк. Использование обычного json невозможно из-за объема данных.
Закрытые issues
closes #21
closes #22
closes #23
Дополнительная информация
Под кодексы нужно обновить модели в базе, так как добавились новые поля. Описаны будут на скриншотах ниже.
Также из-за объема кодексов они хранятся не в json-файле, а в файле, где каждая строка — корректный json, если эти строки объединить, то получился бы исходный json-файл.
Ссылка на ГК, НК, КоАП, УК https://yadi.sk/d/tLWbHXdSAIzxMw
Скриншот 1. Как это выглядит в файле
Скриншот 2. Кодекс, редакция
Скриншот 3. Подробнее про cons_selected_info
Скриншот 4. Некоторая дополнительная информация