run script
This commit is contained in:
parent
bc77db7100
commit
a31ba94b93
70
run.py
Normal file
70
run.py
Normal file
@ -0,0 +1,70 @@
|
||||
import random
|
||||
|
||||
woman_words = ['ciąży', 'miesiączki', 'ciasto', 'ciążę', 'zadowolona', 'ciąża', 'ciazy', 'antykoncepcyjne',
|
||||
'ginekologa', 'wysublimowany', 'płakałam', 'płakać', 'depresja', 'tabletki', 'depresje', 'porodzie',
|
||||
'mąż', 'misiek', 'miesiączkę', 'krwawienie', 'ciasta', ':)',
|
||||
'Shih', 'Tzu', 'troszkę', 'julkaust@wp.pl', 'wigoru.', 'młodej', 'kolezanka', 'kolezankami', 'koleżanką',
|
||||
'przyjaciółki', 'przyjaciółka', 'przyjaciółkami', 'pomadka',
|
||||
'kosmetyczka', 'okres', 'paznokcie', 'włosy', 'usta', 'lekarz', 'lekarza', 'dziecko', 'dzieci', 'wino', 'sukienka',
|
||||
'sukienke', 'torebka', 'torebkę', 'makijaż', 'pomadka', 'wesele', 'slub', 'weselu']
|
||||
|
||||
man_words = ['windows', 'gb', 'mb', 'meczu', 'pc', 'opony', 'apple', 'iphone', 'zwiast', 'hd', 'ubunt',
|
||||
'system', 'serwer', 'youtub', 'sfd', 'kfd', 'elektr', 'autoce', 'dobrep', 'merced', 'bmw',
|
||||
'audi', 'porsch', 'gry', 'gra','gram', 'cs', 'counte', 'piłka', 'mecz', 'gol', 'bramka', 'linux',
|
||||
'robota','felga','lagi' 'żona', 'żona', 'żony', 'żonie', 'żoną', 'zona', 'zony', 'zonie', 'komput', 'inform'
|
||||
'sserwer', 'ziom', 'ziomków', 'ziomkow', 'kumpel', 'kolega', 'kolegą', 'kolegi', 'pad']
|
||||
|
||||
def normalize(woman_words, man_words):
|
||||
woman_norm = []
|
||||
man_norm = []
|
||||
for i in woman_words:
|
||||
woman_norm.append(i.lower())
|
||||
for i in man_words:
|
||||
man_norm.append(i.lower())
|
||||
return woman_norm, man_norm
|
||||
|
||||
def guess(woman_words_norm, man_words_norm, dane):
|
||||
result = []
|
||||
for s in dane:
|
||||
man_count = 0
|
||||
woman_count = 0
|
||||
t = s.split()
|
||||
for w in t:
|
||||
if w in man_words_norm:
|
||||
man_count += 1
|
||||
elif w in woman_words_norm:
|
||||
woman_count += 1
|
||||
if man_count >= woman_count:
|
||||
result.append('1')
|
||||
else:
|
||||
result.append('0')
|
||||
return result
|
||||
|
||||
woman_words_norm, man_words_norm = normalize(woman_words, man_words)
|
||||
|
||||
dane1 = []
|
||||
with open('dev-0/in.tsv') as data:
|
||||
for idx, line in enumerate(data.readlines()):
|
||||
dane1.append(line.replace('\n', ''))
|
||||
result1 = guess(woman_words_norm, man_words_norm, dane1)
|
||||
with open('dev-0/out.tsv', 'w') as file:
|
||||
for r in result1:
|
||||
file.write(r + "\n")
|
||||
|
||||
dane2 = []
|
||||
with open('dev-1/in.tsv') as data:
|
||||
for idx, line in enumerate(data.readlines()):
|
||||
dane2.append(line.replace('\n', ''))
|
||||
result2 = guess(woman_words_norm, man_words_norm, dane2)
|
||||
with open('dev-1/out.tsv', 'w') as file:
|
||||
for r in result2:
|
||||
file.write(r + "\n")
|
||||
|
||||
dane3 = []
|
||||
with open('test-A/in.tsv') as data:
|
||||
for idx, line in enumerate(data.readlines()):
|
||||
dane3.append(line.replace('\n', ''))
|
||||
result3 = guess(woman_words_norm, man_words_norm, dane3)
|
||||
with open('test-A/out.tsv', 'w') as file:
|
||||
for r in result3:
|
||||
file.write(r + "\n")
|
Loading…
Reference in New Issue
Block a user