Find jurisdiction

This commit is contained in:
theta00 2022-05-03 14:52:01 +02:00
parent c2c7bf069b
commit e3b81c05f4
3 changed files with 339 additions and 0 deletions

83
dev-0/out.tsv Normal file
View File

@ -0,0 +1,83 @@
jurisdiction=Delaware
jurisdiction=Georgia
jurisdiction=Delaware
jurisdiction=Massachusetts
jurisdiction=Delaware
jurisdiction=Washington
jurisdiction=California
jurisdiction=New_Jersey
jurisdiction=California
jurisdiction=Delaware
jurisdiction=Delaware
jurisdiction=Delaware
jurisdiction=Delaware
jurisdiction=Delaware
jurisdiction=Massachusetts
jurisdiction=Delaware
jurisdiction=Delaware
jurisdiction=Delaware
jurisdiction=Delaware
jurisdiction=Minnesota
jurisdiction=Delaware
jurisdiction=Virginia
jurisdiction=North_Carolina
jurisdiction=Arizona
jurisdiction=Indiana
jurisdiction=New_Jersey
jurisdiction=California
jurisdiction=Delaware
jurisdiction=Georgia
jurisdiction=Delaware
jurisdiction=Nevada
jurisdiction=California
jurisdiction=Minnesota
jurisdiction=Delaware
jurisdiction=Kentucky
jurisdiction=Minnesota
jurisdiction=Delaware
jurisdiction=Michigan
jurisdiction=Delaware
jurisdiction=Minnesota
jurisdiction=California
jurisdiction=Delaware
jurisdiction=Illinois
jurisdiction=Minnesota
jurisdiction=Texas
jurisdiction=Delaware
jurisdiction=Delaware
jurisdiction=Delaware
jurisdiction=Georgia
jurisdiction=Delaware
jurisdiction=Oregon
jurisdiction=Delaware
jurisdiction=Delaware
jurisdiction=California
jurisdiction=California
jurisdiction=California
jurisdiction=Delaware
jurisdiction=Delaware
jurisdiction=Delaware
jurisdiction=Idaho
jurisdiction=Washington
jurisdiction=Delaware
jurisdiction=New_York
jurisdiction=Delaware
jurisdiction=Delaware
jurisdiction=Oregon
jurisdiction=Washington
jurisdiction=Virginia
jurisdiction=Delaware
jurisdiction=New_York
jurisdiction=Delaware
jurisdiction=Idaho
jurisdiction=Delaware
jurisdiction=Texas
jurisdiction=Delaware
jurisdiction=Washington
jurisdiction=New_York
jurisdiction=Washington
jurisdiction=Pennsylvania
jurisdiction=Delaware
jurisdiction=Illinois
1 jurisdiction=Delaware
2 jurisdiction=Georgia
3 jurisdiction=Delaware
4 jurisdiction=Massachusetts
5 jurisdiction=Delaware
6 jurisdiction=Washington
7 jurisdiction=California
8 jurisdiction=New_Jersey
9 jurisdiction=California
10 jurisdiction=Delaware
11 jurisdiction=Delaware
12 jurisdiction=Delaware
13 jurisdiction=Delaware
14 jurisdiction=Delaware
15 jurisdiction=Massachusetts
16 jurisdiction=Delaware
17 jurisdiction=Delaware
18 jurisdiction=Delaware
19 jurisdiction=Delaware
20 jurisdiction=Minnesota
21 jurisdiction=Delaware
22 jurisdiction=Virginia
23 jurisdiction=North_Carolina
24 jurisdiction=Arizona
25 jurisdiction=Indiana
26 jurisdiction=New_Jersey
27 jurisdiction=California
28 jurisdiction=Delaware
29 jurisdiction=Georgia
30 jurisdiction=Delaware
31 jurisdiction=Nevada
32 jurisdiction=California
33 jurisdiction=Minnesota
34 jurisdiction=Delaware
35 jurisdiction=Kentucky
36 jurisdiction=Minnesota
37 jurisdiction=Delaware
38 jurisdiction=Michigan
39 jurisdiction=Delaware
40 jurisdiction=Minnesota
41 jurisdiction=California
42 jurisdiction=Delaware
43 jurisdiction=Illinois
44 jurisdiction=Minnesota
45 jurisdiction=Texas
46 jurisdiction=Delaware
47 jurisdiction=Delaware
48 jurisdiction=Delaware
49 jurisdiction=Georgia
50 jurisdiction=Delaware
51 jurisdiction=Oregon
52 jurisdiction=Delaware
53 jurisdiction=Delaware
54 jurisdiction=California
55 jurisdiction=California
56 jurisdiction=California
57 jurisdiction=Delaware
58 jurisdiction=Delaware
59 jurisdiction=Delaware
60 jurisdiction=Idaho
61 jurisdiction=Washington
62 jurisdiction=Delaware
63 jurisdiction=New_York
64 jurisdiction=Delaware
65 jurisdiction=Delaware
66 jurisdiction=Oregon
67 jurisdiction=Washington
68 jurisdiction=Virginia
69 jurisdiction=Delaware
70 jurisdiction=New_York
71 jurisdiction=Delaware
72 jurisdiction=Idaho
73 jurisdiction=Delaware
74 jurisdiction=Texas
75 jurisdiction=Delaware
76 jurisdiction=Washington
77 jurisdiction=New_York
78 jurisdiction=Washington
79 jurisdiction=Pennsylvania
80 jurisdiction=Delaware
81 jurisdiction=Illinois

53
run.py Normal file
View File

@ -0,0 +1,53 @@
#!/usr/bin/env python
# coding: utf-8
# In[13]:
import re
# In[1]:
state_names = ["Alaska", "Alabama", "Arkansas", "American Samoa", "Arizona", "California", "Colorado", "Connecticut", "District ", "of Columbia", "Delaware", "Florida", "Georgia", "Guam", "Hawaii", "Iowa", "Idaho", "Illinois", "Indiana", "Kansas", "Kentucky", "Louisiana", "Massachusetts", "Maryland", "Maine", "Michigan", "Minnesota", "Missouri", "Mississippi", "Montana", "North Carolina", "North Dakota", "Nebraska", "New Hampshire", "New Jersey", "New Mexico", "Nevada", "New York", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Puerto Rico", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Virginia", "Virgin Islands", "Vermont", "Washington", "Wisconsin", "West Virginia", "Wyoming"]
regex = re.compile(r'\b(' + '|'.join(state_names) + r')\b')
# In[43]:
with open('dev-0/in.tsv', 'r', encoding='utf8') as file:
lines = file.readlines()
# In[44]:
with open('dev-0/out.tsv', 'w') as file:
for line in lines:
jur = regex.search(line)
if jur:
file.write('jurisdiction=' + jur.group().replace(' ', '_') +'\n')
else:
file.write('\n')
# In[41]:
with open('test-A/in.tsv', 'r', encoding='utf8') as file:
lines = file.readlines()
# In[42]:
with open('test-A/out.tsv', 'w') as file:
for line in lines:
jur = regex.search(line)
if jur:
file.write('jurisdiction=' + jur.group().replace(' ', '_') +'\n')
else:
file.write('\n')

203
test-A/out.tsv Normal file
View File

@ -0,0 +1,203 @@
jurisdiction=Ohio
jurisdiction=Delaware
jurisdiction=Indiana
jurisdiction=Delaware
jurisdiction=Nevada
jurisdiction=Utah
jurisdiction=Delaware
jurisdiction=Maryland
jurisdiction=Delaware
jurisdiction=New_York
jurisdiction=California
jurisdiction=Delaware
jurisdiction=New_York
jurisdiction=Georgia
jurisdiction=Texas
jurisdiction=California
jurisdiction=Washington
jurisdiction=Florida
jurisdiction=Delaware
jurisdiction=Florida
jurisdiction=New_York
jurisdiction=California
jurisdiction=Florida
jurisdiction=New_York
jurisdiction=Washington
jurisdiction=Texas
jurisdiction=Delaware
jurisdiction=Delaware
jurisdiction=Washington
jurisdiction=Delaware
jurisdiction=Nevada
jurisdiction=Delaware
jurisdiction=California
jurisdiction=Delaware
jurisdiction=California
jurisdiction=Virginia
jurisdiction=Delaware
jurisdiction=Florida
jurisdiction=California
jurisdiction=Virginia
jurisdiction=Pennsylvania
jurisdiction=Delaware
jurisdiction=Vermont
jurisdiction=Virginia
jurisdiction=California
jurisdiction=Delaware
jurisdiction=Delaware
jurisdiction=New_Jersey
jurisdiction=Delaware
jurisdiction=Texas
jurisdiction=Massachusetts
jurisdiction=Delaware
jurisdiction=New_York
jurisdiction=Delaware
jurisdiction=Pennsylvania
jurisdiction=District_
jurisdiction=California
jurisdiction=Delaware
jurisdiction=Delaware
jurisdiction=Delaware
jurisdiction=Massachusetts
jurisdiction=Connecticut
jurisdiction=California
jurisdiction=Texas
jurisdiction=Delaware
jurisdiction=District_
jurisdiction=Delaware
jurisdiction=Oregon
jurisdiction=Minnesota
jurisdiction=Delaware
jurisdiction=Texas
jurisdiction=Colorado
jurisdiction=Colorado
jurisdiction=Nevada
jurisdiction=Delaware
jurisdiction=Kansas
jurisdiction=Wisconsin
jurisdiction=New_Jersey
jurisdiction=New_York
jurisdiction=Delaware
jurisdiction=Virginia
jurisdiction=Delaware
jurisdiction=Nevada
jurisdiction=Delaware
jurisdiction=New_Jersey
jurisdiction=Delaware
jurisdiction=Minnesota
jurisdiction=Connecticut
jurisdiction=North_Carolina
jurisdiction=Delaware
jurisdiction=Florida
jurisdiction=Washington
jurisdiction=Ohio
jurisdiction=New_York
jurisdiction=Georgia
jurisdiction=New_York
jurisdiction=Delaware
jurisdiction=Colorado
jurisdiction=Delaware
jurisdiction=Delaware
jurisdiction=Ohio
jurisdiction=Minnesota
jurisdiction=Delaware
jurisdiction=California
jurisdiction=Connecticut
jurisdiction=Maryland
jurisdiction=Delaware
jurisdiction=Utah
jurisdiction=Delaware
jurisdiction=Utah
jurisdiction=Colorado
jurisdiction=Delaware
jurisdiction=Delaware
jurisdiction=California
jurisdiction=Delaware
jurisdiction=Virginia
jurisdiction=Delaware
jurisdiction=Texas
jurisdiction=Massachusetts
jurisdiction=Colorado
jurisdiction=New_York
jurisdiction=Michigan
jurisdiction=Pennsylvania
jurisdiction=New_York
jurisdiction=Delaware
jurisdiction=Texas
jurisdiction=Minnesota
jurisdiction=Ohio
jurisdiction=Oregon
jurisdiction=New_Jersey
jurisdiction=Florida
jurisdiction=Oregon
jurisdiction=Massachusetts
jurisdiction=Delaware
jurisdiction=California
jurisdiction=Maryland
jurisdiction=Illinois
jurisdiction=California
jurisdiction=Virginia
jurisdiction=Tennessee
jurisdiction=Delaware
jurisdiction=Delaware
jurisdiction=Minnesota
jurisdiction=Ohio
jurisdiction=Delaware
jurisdiction=New_Jersey
jurisdiction=Nevada
jurisdiction=Indiana
jurisdiction=Virginia
jurisdiction=Delaware
jurisdiction=New_York
jurisdiction=Delaware
jurisdiction=New_York
jurisdiction=Delaware
jurisdiction=Louisiana
jurisdiction=Georgia
jurisdiction=New_York
jurisdiction=New_York
jurisdiction=Oregon
jurisdiction=Nevada
jurisdiction=Delaware
jurisdiction=North_Carolina
jurisdiction=Florida
jurisdiction=Georgia
jurisdiction=California
jurisdiction=New_York
jurisdiction=New_York
jurisdiction=Delaware
jurisdiction=Georgia
jurisdiction=New_Jersey
jurisdiction=Minnesota
jurisdiction=North_Carolina
jurisdiction=Delaware
jurisdiction=Kentucky
jurisdiction=Nevada
jurisdiction=Missouri
jurisdiction=Utah
jurisdiction=Connecticut
jurisdiction=Delaware
jurisdiction=Delaware
jurisdiction=Delaware
jurisdiction=Georgia
jurisdiction=Delaware
jurisdiction=Washington
jurisdiction=California
jurisdiction=California
jurisdiction=Maryland
jurisdiction=Delaware
jurisdiction=Delaware
jurisdiction=Pennsylvania
jurisdiction=Delaware
jurisdiction=Delaware
jurisdiction=District_
jurisdiction=Indiana
jurisdiction=Nevada
jurisdiction=Nevada
jurisdiction=Delaware
jurisdiction=California
jurisdiction=Colorado
1 jurisdiction=Ohio
2 jurisdiction=Delaware
3 jurisdiction=Indiana
4 jurisdiction=Delaware
5 jurisdiction=Nevada
6 jurisdiction=Utah
7 jurisdiction=Delaware
8 jurisdiction=Maryland
9 jurisdiction=Delaware
10 jurisdiction=New_York
11 jurisdiction=California
12 jurisdiction=Delaware
13 jurisdiction=New_York
14 jurisdiction=Georgia
15 jurisdiction=Texas
16 jurisdiction=California
17 jurisdiction=Washington
18 jurisdiction=Florida
19 jurisdiction=Delaware
20 jurisdiction=Florida
21 jurisdiction=New_York
22 jurisdiction=California
23 jurisdiction=Florida
24 jurisdiction=New_York
25 jurisdiction=Washington
26 jurisdiction=Texas
27 jurisdiction=Delaware
28 jurisdiction=Delaware
29 jurisdiction=Washington
30 jurisdiction=Delaware
31 jurisdiction=Nevada
32 jurisdiction=Delaware
33 jurisdiction=California
34 jurisdiction=Delaware
35 jurisdiction=California
36 jurisdiction=Virginia
37 jurisdiction=Delaware
38 jurisdiction=Florida
39 jurisdiction=California
40 jurisdiction=Virginia
41 jurisdiction=Pennsylvania
42 jurisdiction=Delaware
43 jurisdiction=Vermont
44 jurisdiction=Virginia
45 jurisdiction=California
46 jurisdiction=Delaware
47 jurisdiction=Delaware
48 jurisdiction=New_Jersey
49 jurisdiction=Delaware
50 jurisdiction=Texas
51 jurisdiction=Massachusetts
52 jurisdiction=Delaware
53 jurisdiction=New_York
54 jurisdiction=Delaware
55 jurisdiction=Pennsylvania
56 jurisdiction=District_
57 jurisdiction=California
58 jurisdiction=Delaware
59 jurisdiction=Delaware
60 jurisdiction=Delaware
61 jurisdiction=Massachusetts
62 jurisdiction=Connecticut
63 jurisdiction=California
64 jurisdiction=Texas
65 jurisdiction=Delaware
66 jurisdiction=District_
67 jurisdiction=Delaware
68 jurisdiction=Oregon
69 jurisdiction=Minnesota
70 jurisdiction=Delaware
71 jurisdiction=Texas
72 jurisdiction=Colorado
73 jurisdiction=Colorado
74 jurisdiction=Nevada
75 jurisdiction=Delaware
76 jurisdiction=Kansas
77 jurisdiction=Wisconsin
78 jurisdiction=New_Jersey
79 jurisdiction=New_York
80 jurisdiction=Delaware
81 jurisdiction=Virginia
82 jurisdiction=Delaware
83 jurisdiction=Nevada
84 jurisdiction=Delaware
85 jurisdiction=New_Jersey
86 jurisdiction=Delaware
87 jurisdiction=Minnesota
88 jurisdiction=Connecticut
89 jurisdiction=North_Carolina
90 jurisdiction=Delaware
91 jurisdiction=Florida
92 jurisdiction=Washington
93 jurisdiction=Ohio
94 jurisdiction=New_York
95 jurisdiction=Georgia
96 jurisdiction=New_York
97 jurisdiction=Delaware
98 jurisdiction=Colorado
99 jurisdiction=Delaware
100 jurisdiction=Delaware
101 jurisdiction=Ohio
102 jurisdiction=Minnesota
103 jurisdiction=Delaware
104 jurisdiction=California
105 jurisdiction=Connecticut
106 jurisdiction=Maryland
107 jurisdiction=Delaware
108 jurisdiction=Utah
109 jurisdiction=Delaware
110 jurisdiction=Utah
111 jurisdiction=Colorado
112 jurisdiction=Delaware
113 jurisdiction=Delaware
114 jurisdiction=California
115 jurisdiction=Delaware
116 jurisdiction=Virginia
117 jurisdiction=Delaware
118 jurisdiction=Texas
119 jurisdiction=Massachusetts
120 jurisdiction=Colorado
121 jurisdiction=New_York
122 jurisdiction=Michigan
123 jurisdiction=Pennsylvania
124 jurisdiction=New_York
125 jurisdiction=Delaware
126 jurisdiction=Texas
127 jurisdiction=Minnesota
128 jurisdiction=Ohio
129 jurisdiction=Oregon
130 jurisdiction=New_Jersey
131 jurisdiction=Florida
132 jurisdiction=Oregon
133 jurisdiction=Massachusetts
134 jurisdiction=Delaware
135 jurisdiction=California
136 jurisdiction=Maryland
137 jurisdiction=Illinois
138 jurisdiction=California
139 jurisdiction=Virginia
140 jurisdiction=Tennessee
141 jurisdiction=Delaware
142 jurisdiction=Delaware
143 jurisdiction=Minnesota
144 jurisdiction=Ohio
145 jurisdiction=Delaware
146 jurisdiction=New_Jersey
147 jurisdiction=Nevada
148 jurisdiction=Indiana
149 jurisdiction=Virginia
150 jurisdiction=Delaware
151 jurisdiction=New_York
152 jurisdiction=Delaware
153 jurisdiction=New_York
154 jurisdiction=Delaware
155 jurisdiction=Louisiana
156 jurisdiction=Georgia
157 jurisdiction=New_York
158 jurisdiction=New_York
159 jurisdiction=Oregon
160 jurisdiction=Nevada
161 jurisdiction=Delaware
162 jurisdiction=North_Carolina
163 jurisdiction=Florida
164 jurisdiction=Georgia
165 jurisdiction=California
166 jurisdiction=New_York
167 jurisdiction=New_York
168 jurisdiction=Delaware
169 jurisdiction=Georgia
170 jurisdiction=New_Jersey
171 jurisdiction=Minnesota
172 jurisdiction=North_Carolina
173 jurisdiction=Delaware
174 jurisdiction=Kentucky
175 jurisdiction=Nevada
176 jurisdiction=Missouri
177 jurisdiction=Utah
178 jurisdiction=Connecticut
179 jurisdiction=Delaware
180 jurisdiction=Delaware
181 jurisdiction=Delaware
182 jurisdiction=Georgia
183 jurisdiction=Delaware
184 jurisdiction=Washington
185 jurisdiction=California
186 jurisdiction=California
187 jurisdiction=Maryland
188 jurisdiction=Delaware
189 jurisdiction=Delaware
190 jurisdiction=Pennsylvania
191 jurisdiction=Delaware
192 jurisdiction=Delaware
193 jurisdiction=District_
194 jurisdiction=Indiana
195 jurisdiction=Nevada
196 jurisdiction=Nevada
197 jurisdiction=Delaware
198 jurisdiction=California
199 jurisdiction=Colorado