File size: 899 Bytes
3478195
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import re
from docx import Document
from helpers import get_doc_blocks


def get_fz93_doc(doc):
    fz93_docx = set()
    paragraphs = get_doc_blocks(doc)
    fz93_doc_regex = ["части 1 статьи 93 Федерального закона",
                      "ч. 1 ст. 93",
                      "частью 1 статьи 93 Федерального закона"]

    for docpara in paragraphs:
        for val in fz93_doc_regex:
            fz93_docx.update(
                re.findall(val, docpara)
            )
    #doc = Document(file_name_doc)
    for table in doc.tables:
        for row in table.rows:
            for cell in row.cells:
                for para in cell.paragraphs:
                    for val in fz93_doc_regex:
                        fz93_docx.update(
                            re.findall(val, para.text)
                        )
    return fz93_docx