state jurisdiction final

This commit is contained in:
Sebastian 2022-05-04 01:38:21 +02:00
parent 3ad79fb78c
commit 3cba9bb6a5
7 changed files with 39 additions and 39 deletions

View File

@ -2,7 +2,7 @@
"cells": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 56, "execution_count": 64,
"id": "8b07c9a5-e5cf-4cf9-a6d9-e784eb109fef", "id": "8b07c9a5-e5cf-4cf9-a6d9-e784eb109fef",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -12,7 +12,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 57, "execution_count": 65,
"id": "fce94c21-6792-4938-bf2c-3f46ecf2f954", "id": "fce94c21-6792-4938-bf2c-3f46ecf2f954",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -21,12 +21,12 @@
" 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', \n", " 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', \n",
" 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', 'Nebraska', 'Nevada', 'New Hampshire', 'New Jersey', \n", " 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', 'Nebraska', 'Nevada', 'New Hampshire', 'New Jersey', \n",
" 'New Mexico', 'New York', 'North Carolina', 'North Dakota', 'Ohio', 'Oklahoma', 'Pennsylvania', 'Rhode Island', 'South Carolina', \n", " 'New Mexico', 'New York', 'North Carolina', 'North Dakota', 'Ohio', 'Oklahoma', 'Pennsylvania', 'Rhode Island', 'South Carolina', \n",
" 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming']" " 'South Dakota', 'Tennessee', 'Texas', 'Vermont', 'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming']"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 58, "execution_count": 66,
"id": "eb1815f2-1876-4437-833a-ff22de81685e", "id": "eb1815f2-1876-4437-833a-ff22de81685e",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -38,7 +38,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 59, "execution_count": 67,
"id": "8729062d-87b8-4111-a216-8500334f54b6", "id": "8729062d-87b8-4111-a216-8500334f54b6",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -52,7 +52,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 60, "execution_count": 68,
"id": "ea8069f7-de8e-454c-8eac-9fb7cc0df626", "id": "ea8069f7-de8e-454c-8eac-9fb7cc0df626",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -68,7 +68,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 61, "execution_count": 69,
"id": "ade45bfb-9eaa-4b2b-bba1-6cfcaf0a9ce6", "id": "ade45bfb-9eaa-4b2b-bba1-6cfcaf0a9ce6",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -80,7 +80,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 62, "execution_count": 63,
"id": "594a25a9-a0ce-4de9-82c8-df50a4ecac39", "id": "594a25a9-a0ce-4de9-82c8-df50a4ecac39",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [

View File

@ -1,23 +1,23 @@
#!/usr/bin/env python #!/usr/bin/env python
# coding: utf-8 # coding: utf-8
# In[56]: # In[64]:
import re import re
# In[57]: # In[65]:
states = ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', states = ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia',
'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland',
'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', 'Nebraska', 'Nevada', 'New Hampshire', 'New Jersey', 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', 'Nebraska', 'Nevada', 'New Hampshire', 'New Jersey',
'New Mexico', 'New York', 'North Carolina', 'North Dakota', 'Ohio', 'Oklahoma', 'Pennsylvania', 'Rhode Island', 'South Carolina', 'New Mexico', 'New York', 'North Carolina', 'North Dakota', 'Ohio', 'Oklahoma', 'Pennsylvania', 'Rhode Island', 'South Carolina',
'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming'] 'South Dakota', 'Tennessee', 'Texas', 'Vermont', 'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming']
# In[58]: # In[66]:
def counter(text_in, query): def counter(text_in, query):
@ -25,7 +25,7 @@ def counter(text_in, query):
return len(pattern.findall(text_in, re.IGNORECASE)) return len(pattern.findall(text_in, re.IGNORECASE))
# In[59]: # In[67]:
def state_prediction(text_in): def state_prediction(text_in):
@ -35,7 +35,7 @@ def state_prediction(text_in):
return max(state_dict, key=state_dict.get) return max(state_dict, key=state_dict.get)
# In[60]: # In[68]:
def jurisdiction(path_in, path_out): def jurisdiction(path_in, path_out):
@ -47,7 +47,7 @@ def jurisdiction(path_in, path_out):
file_out.close() file_out.close()
# In[61]: # In[69]:
jurisdiction('dev-0/in.tsv', 'dev-0/out.tsv') jurisdiction('dev-0/in.tsv', 'dev-0/out.tsv')
@ -55,8 +55,8 @@ jurisdiction('train/in.tsv', 'train/out.tsv')
jurisdiction('test-A/in.tsv', 'test-A/out.tsv') jurisdiction('test-A/in.tsv', 'test-A/out.tsv')
# In[62]: # In[63]:
# get_ipython().system('jupyter nbconvert --to script run.ipynb') # get_ipython().system('jupyter nbconvert --to script run.ipynb')
#

View File

@ -63,7 +63,7 @@ jurisdiction=Ohio
jurisdiction=California jurisdiction=California
jurisdiction=New_York jurisdiction=New_York
jurisdiction=California jurisdiction=California
jurisdiction=Utah jurisdiction=Delaware
jurisdiction=Delaware jurisdiction=Delaware
jurisdiction=Washington jurisdiction=Washington
jurisdiction=Virginia jurisdiction=Virginia

1 jurisdiction=New_York
63 jurisdiction=California
64 jurisdiction=New_York
65 jurisdiction=California
66 jurisdiction=Utah jurisdiction=Delaware
67 jurisdiction=Delaware
68 jurisdiction=Washington
69 jurisdiction=Virginia

View File

@ -2,7 +2,7 @@
"cells": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 56, "execution_count": 64,
"id": "8b07c9a5-e5cf-4cf9-a6d9-e784eb109fef", "id": "8b07c9a5-e5cf-4cf9-a6d9-e784eb109fef",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -12,7 +12,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 57, "execution_count": 65,
"id": "fce94c21-6792-4938-bf2c-3f46ecf2f954", "id": "fce94c21-6792-4938-bf2c-3f46ecf2f954",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -21,12 +21,12 @@
" 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', \n", " 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', \n",
" 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', 'Nebraska', 'Nevada', 'New Hampshire', 'New Jersey', \n", " 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', 'Nebraska', 'Nevada', 'New Hampshire', 'New Jersey', \n",
" 'New Mexico', 'New York', 'North Carolina', 'North Dakota', 'Ohio', 'Oklahoma', 'Pennsylvania', 'Rhode Island', 'South Carolina', \n", " 'New Mexico', 'New York', 'North Carolina', 'North Dakota', 'Ohio', 'Oklahoma', 'Pennsylvania', 'Rhode Island', 'South Carolina', \n",
" 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming']" " 'South Dakota', 'Tennessee', 'Texas', 'Vermont', 'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming']"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 58, "execution_count": 66,
"id": "eb1815f2-1876-4437-833a-ff22de81685e", "id": "eb1815f2-1876-4437-833a-ff22de81685e",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -38,7 +38,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 59, "execution_count": 67,
"id": "8729062d-87b8-4111-a216-8500334f54b6", "id": "8729062d-87b8-4111-a216-8500334f54b6",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -52,7 +52,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 60, "execution_count": 68,
"id": "ea8069f7-de8e-454c-8eac-9fb7cc0df626", "id": "ea8069f7-de8e-454c-8eac-9fb7cc0df626",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -68,7 +68,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 61, "execution_count": 69,
"id": "ade45bfb-9eaa-4b2b-bba1-6cfcaf0a9ce6", "id": "ade45bfb-9eaa-4b2b-bba1-6cfcaf0a9ce6",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -80,7 +80,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 62, "execution_count": 63,
"id": "594a25a9-a0ce-4de9-82c8-df50a4ecac39", "id": "594a25a9-a0ce-4de9-82c8-df50a4ecac39",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [

18
run.py
View File

@ -1,23 +1,23 @@
#!/usr/bin/env python #!/usr/bin/env python
# coding: utf-8 # coding: utf-8
# In[56]: # In[64]:
import re import re
# In[57]: # In[65]:
states = ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', states = ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia',
'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland',
'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', 'Nebraska', 'Nevada', 'New Hampshire', 'New Jersey', 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', 'Nebraska', 'Nevada', 'New Hampshire', 'New Jersey',
'New Mexico', 'New York', 'North Carolina', 'North Dakota', 'Ohio', 'Oklahoma', 'Pennsylvania', 'Rhode Island', 'South Carolina', 'New Mexico', 'New York', 'North Carolina', 'North Dakota', 'Ohio', 'Oklahoma', 'Pennsylvania', 'Rhode Island', 'South Carolina',
'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming'] 'South Dakota', 'Tennessee', 'Texas', 'Vermont', 'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming']
# In[58]: # In[66]:
def counter(text_in, query): def counter(text_in, query):
@ -25,7 +25,7 @@ def counter(text_in, query):
return len(pattern.findall(text_in, re.IGNORECASE)) return len(pattern.findall(text_in, re.IGNORECASE))
# In[59]: # In[67]:
def state_prediction(text_in): def state_prediction(text_in):
@ -35,7 +35,7 @@ def state_prediction(text_in):
return max(state_dict, key=state_dict.get) return max(state_dict, key=state_dict.get)
# In[60]: # In[68]:
def jurisdiction(path_in, path_out): def jurisdiction(path_in, path_out):
@ -47,7 +47,7 @@ def jurisdiction(path_in, path_out):
file_out.close() file_out.close()
# In[61]: # In[69]:
jurisdiction('dev-0/in.tsv', 'dev-0/out.tsv') jurisdiction('dev-0/in.tsv', 'dev-0/out.tsv')
@ -55,8 +55,8 @@ jurisdiction('train/in.tsv', 'train/out.tsv')
jurisdiction('test-A/in.tsv', 'test-A/out.tsv') jurisdiction('test-A/in.tsv', 'test-A/out.tsv')
# In[62]: # In[63]:
# get_ipython().system('jupyter nbconvert --to script run.ipynb') # get_ipython().system('jupyter nbconvert --to script run.ipynb')
#

View File

@ -106,9 +106,9 @@ jurisdiction=California
jurisdiction=Connecticut jurisdiction=Connecticut
jurisdiction=Maryland jurisdiction=Maryland
jurisdiction=Delaware jurisdiction=Delaware
jurisdiction=Utah jurisdiction=Alabama
jurisdiction=California jurisdiction=California
jurisdiction=Utah jurisdiction=Nevada
jurisdiction=Colorado jurisdiction=Colorado
jurisdiction=Delaware jurisdiction=Delaware
jurisdiction=New_York jurisdiction=New_York

1 jurisdiction=Ohio
106 jurisdiction=Connecticut
107 jurisdiction=Maryland
108 jurisdiction=Delaware
109 jurisdiction=Utah jurisdiction=Alabama
110 jurisdiction=California
111 jurisdiction=Utah jurisdiction=Nevada
112 jurisdiction=Colorado
113 jurisdiction=Delaware
114 jurisdiction=New_York

View File

@ -92,7 +92,7 @@ jurisdiction=Alabama
jurisdiction=Delaware jurisdiction=Delaware
jurisdiction=Delaware jurisdiction=Delaware
jurisdiction=Connecticut jurisdiction=Connecticut
jurisdiction=Utah jurisdiction=Alabama
jurisdiction=Texas jurisdiction=Texas
jurisdiction=Delaware jurisdiction=Delaware
jurisdiction=Ohio jurisdiction=Ohio
@ -147,7 +147,7 @@ jurisdiction=Delaware
jurisdiction=Delaware jurisdiction=Delaware
jurisdiction=Massachusetts jurisdiction=Massachusetts
jurisdiction=Massachusetts jurisdiction=Massachusetts
jurisdiction=Utah jurisdiction=Alabama
jurisdiction=Washington jurisdiction=Washington
jurisdiction=Texas jurisdiction=Texas
jurisdiction=California jurisdiction=California

1 jurisdiction=Alabama
92 jurisdiction=Delaware
93 jurisdiction=Delaware
94 jurisdiction=Connecticut
95 jurisdiction=Utah jurisdiction=Alabama
96 jurisdiction=Texas
97 jurisdiction=Delaware
98 jurisdiction=Ohio
147 jurisdiction=Delaware
148 jurisdiction=Massachusetts
149 jurisdiction=Massachusetts
150 jurisdiction=Utah jurisdiction=Alabama
151 jurisdiction=Washington
152 jurisdiction=Texas
153 jurisdiction=California