<commit_before>#!/usr/bin/env python3

import re
import ezodf

paragraphRe=re.compile(r'Пункт N (?P<paragraphNumber>\d+(?:\.\d+)*)')

doc=ezodf.opendoc('assembly/3765.odt')
for obj in doc.body:
	if type(obj) is ezodf.text.Paragraph:
		print('text paragraph {')
		for line in obj.plaintext().splitlines():
			m=paragraphRe.match(line)
			if m:
				print('=== paragraph',m.group('paragraphNumber'),'===')
			print('text line:',line)
		print('}')
	elif type(obj) is ezodf.table.Table:
		print('table',obj.nrows(),'x',obj.ncols())<commit_msg>detect amendments<commit_after>#!/usr/bin/env python3

import re
import ezodf

paragraphRe=re.compile(r'Пункт N (?P<paragraphNumber>\d+(?:\.\d+)*)')
amendTextRe=re.compile(r'(?P<paragraphNumber>(?:\d+\.)+) В текстовую часть')
amendAppendixRe=re.compile(r'(?P<paragraphNumber>(?:\d+\.)+) В приложение (?P<appendixNumber>\d+)')

doc=ezodf.opendoc('assembly/3765.odt')
for obj in doc.body:
	if type(obj) is ezodf.text.Paragraph:
		print('text paragraph {')
		for line in obj.plaintext().splitlines():
			m=paragraphRe.match(line)
			if m:
				print('=== paragraph',m.group('paragraphNumber'),'===')
			m=amendTextRe.match(line)
			if m:
				print('=== amendment',m.group('paragraphNumber'),'for text ===')
			m=amendAppendixRe.match(line)
			if m:
				print('=== amendment',m.group('paragraphNumber'),'for appendix',m.group('appendixNumber'),'===')
				if m.group('appendixNumber') in ('3','4'):
					print('===*** got to process it ***===')
			print('text line:',line)
		print('}')
	elif type(obj) is ezodf.table.Table:
		print('table',obj.nrows(),'x',obj.ncols())
{'fraction_non_alphanumeric': 0.223125, 'fraction_numerical': 0.0075, 'mean_word_length': 5.481781376518219, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1800618', 'n_tokens_mistral': 672, 'n_tokens_neox': 610, 'n_words': 103}