This commit is contained in:
Adrian Charkiewicz 2022-04-13 17:18:35 +02:00
parent e310d99b89
commit dc70173122
3 changed files with 137422 additions and 89 deletions

View File

@ -3,7 +3,7 @@
{
"cell_type": "code",
"execution_count": 90,
"id": "5b55a105",
"id": "7dc5e391",
"metadata": {},
"outputs": [],
"source": [
@ -14,7 +14,7 @@
{
"cell_type": "code",
"execution_count": 91,
"id": "9364cf2c",
"id": "a0825c64",
"metadata": {},
"outputs": [],
"source": [
@ -24,7 +24,7 @@
{
"cell_type": "code",
"execution_count": 139,
"id": "9d3f7db9",
"id": "4b9092a6",
"metadata": {},
"outputs": [],
"source": [
@ -34,7 +34,7 @@
{
"cell_type": "code",
"execution_count": 94,
"id": "5062478d",
"id": "56c39aa1",
"metadata": {},
"outputs": [
{
@ -54,7 +54,7 @@
{
"cell_type": "code",
"execution_count": 158,
"id": "5eca7aab",
"id": "d7b300ca",
"metadata": {},
"outputs": [],
"source": [
@ -67,7 +67,7 @@
{
"cell_type": "code",
"execution_count": 159,
"id": "0bdd1845",
"id": "31b5864b",
"metadata": {},
"outputs": [],
"source": [
@ -82,7 +82,7 @@
{
"cell_type": "code",
"execution_count": 160,
"id": "b36bbd92",
"id": "c1f02d77",
"metadata": {},
"outputs": [],
"source": [
@ -94,7 +94,7 @@
{
"cell_type": "code",
"execution_count": 161,
"id": "ccbad95c",
"id": "6edfd944",
"metadata": {},
"outputs": [],
"source": [
@ -109,7 +109,7 @@
{
"cell_type": "code",
"execution_count": 162,
"id": "02ee0acf",
"id": "40369c2b",
"metadata": {},
"outputs": [],
"source": [
@ -124,7 +124,7 @@
{
"cell_type": "code",
"execution_count": 163,
"id": "db803a58",
"id": "e296921c",
"metadata": {},
"outputs": [
{
@ -141,87 +141,14 @@
},
{
"cell_type": "code",
"execution_count": 164,
"id": "e1a15db7",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['cierpi',\n",
" 'na',\n",
" 'strasz',\n",
" 'lagi',\n",
" '',\n",
" 'kilkan',\n",
" 'sekund',\n",
" 'lub',\n",
" 'dłużej',\n",
" 'czarne',\n",
" 'ekranu',\n",
" 'przy',\n",
" 'próbie',\n",
" 'przełą',\n",
" 'się',\n",
" '/',\n",
" 'urucho',\n",
" 'prawie',\n",
" 'każdej',\n",
" 'aplika',\n",
" 'dodatk',\n",
" 'telefo',\n",
" 'mi',\n",
" 'się',\n",
" 'wyłącz',\n",
" 'czasem',\n",
" 'bez',\n",
" 'powodu',\n",
" '',\n",
" 'sam',\n",
" 'z',\n",
" 'siebie',\n",
" 'albo',\n",
" 'reseto',\n",
" 'ostatn',\n",
" 'nawet',\n",
" 'przegl',\n",
" 'zaczęł',\n",
" 'się',\n",
" 'często',\n",
" 'zawies',\n",
" 'i',\n",
" 'androi',\n",
" 'propon',\n",
" 'wymusz',\n",
" 'zamkni',\n",
" 'do',\n",
" 'tego',\n",
" 'te',\n",
" 'proble',\n",
" 'z',\n",
" 'połącz',\n",
" 'do',\n",
" 'komput',\n",
" 'przez',\n",
" 'usb.']"
]
},
"execution_count": 164,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"trimmed_docs[0]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7403c1bb",
"execution_count": 167,
"id": "fee431a4",
"metadata": {},
"outputs": [],
"source": []
"source": [
"df = pd.DataFrame(result)\n",
"df.to_csv('out.tsv', sep = '\\t')"
]
}
],
"metadata": {

91
dev-0/model.py Normal file
View File

@ -0,0 +1,91 @@
#!/usr/bin/env python
# coding: utf-8
# In[90]:
import pandas as pd
import csv
# In[91]:
tsv_data = pd.read_csv('in.tsv', sep='\t',header=None, quoting=csv.QUOTE_NONE)[0]
# In[139]:
expected = pd.read_csv('expected.tsv', sep='\t',header=None)[0]
# In[94]:
print(len(expected))
print(len(tsv_data))
# In[158]:
male={'silnik', 'windows', 'gb', 'mb', 'mecz', 'pc', 'opony', 'apple', 'iphone', 'zwiastuny', 'hd', 'ubuntu', 'system', 'serwer'}
female={'ciąża', 'miesiączki', 'ciasto', 'ciąże', 'zadowolona', 'antykoncepcyjne', 'ginekologia', 'tabletki', 'porodzie', 'mąż', 'krwawienie', 'ciasta'}
male = {x[:6].lower() for x in male}
female = {x[:6].lower() for x in female}
# In[159]:
trimmed_docs=[]
for document in tsv_data:
new_doc=[]
for word in str(document).lower().split():
new_doc.append(word[:6])
trimmed_docs.append(new_doc)
# In[160]:
male_or_female=[]
for doc in trimmed_docs:
male_or_female.append((len(male&set(doc)), len(female&set(doc))))
# In[161]:
answers=[]
for i in male_or_female:
if i[0]>i[1]:
answers.append(1)
else:
answers.append(0)
# In[162]:
result=[]
for i in range(len(answers)):
if answers[i]==expected[i]:
result.append(1)
else:
result.append(0)
# In[163]:
print(f'Predykcja modelu wynosi {sum(result)/len(result)*100:.6f}%')
# In[167]:
df = pd.DataFrame(result)
df.to_csv('out.tsv', sep = '\t')

137315
dev-0/out.tsv Normal file

File diff suppressed because it is too large Load Diff