-
Notifications
You must be signed in to change notification settings - Fork 6
/
english.py
50 lines (41 loc) · 1.56 KB
/
english.py
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from ..base import Reader, Patterns
__all__ = ['ManipurPDF']
class ManipurPatterns(Patterns):
part_patterns = dict(
main=r'Page3\n(.*)\nSUMMARY OF ELECTORS',
addition=None,
correction=None,
deletion=None,
)
box_patterns = dict(
main=r'(\d+\nName of Elector:(.*?(?=\n\d+\nName of Elector:)|.*))',
deletion=None
)
general_patterns = dict(
state=r'\nState : ([^\n]+)',
acName=r'\nAssembly Constituency :\n([^\n]+)',
pcName=r'Constituency is located :\n(.*?)(?=\nPart No. :)',
partNo=r'\nPart No. : +(\d+)',
year=r'Year of Revision :\n(\d+)',
mainTown=r'([^\n]+)(?=\n\d+\n\d+\n\d+\n[^\n]+\nPanchayat :)',
mandal=r'(?<=\n)([^0-9\n]+)\n[^\n]+(?=\n\d{6}\n)',
policeStation=r'([^\n]+)\nPanchayat :\n',
district=r'([^\n]+)\n\d{6}\n',
stationName=r'\nTotal\n[\d/]+ -([^\n]+)',
stationAddress=r'\n\d{6}\n(.+?)(?=(\n[^\n]+){8}\nPanchayat :)',
netMale=r'\nPanchayat :\n(\d+)',
netFemale=r'\nPanchayat :\n\d+\n(\d+)',
netTotal=r'\nPanchayat :\n\d+\n\d+\n(\d+)'
)
elector_patterns = dict(
number=r'^(\d+)',
name=r'(?<=Sex:\n)(.+?)(?=\n(Female|Male)\n)',
relativeName=r'(?<=[Mm]ale\n)(.+?)(?=\n\d+\n\d+\n[A-Z]{1,5}[0-9\/]+)',
house=r'(?<=\n)(\d+)\n\d+\n[A-Z]{1,5}[0-9\/]+',
age=r'(?<=\n)(\d+)\n[A-Z]{1,5}[0-9\/]+',
sex=r'(Male|Female)'
)
class ManipurPDF(Reader):
pat = ManipurPatterns()
def __init__(self, path):
super(ManipurPDF, self).__init__(path)