Compare commits

..

No commits in common. "master" and "master" have entirely different histories.

5 changed files with 0 additions and 1169 deletions

View File

@ -1,87 +0,0 @@
6
5
7
8
13
10
15
14
10
7
14
10
5
19
0
0
0
13
3
19
2
12
16
2
14
12
1
16
11
5
15
15
9
18
0
4
5
6
1
8
10
17
4
8
6
3
4
5
9
9
14
7
15
12
17
2
5
5
15
18
4
5
15
13
10
18
15
6
7
4
13
3
6
15
5
14
14
17
8
19
7
14
7
19
15
18
19
1 6
2 5
3 7
4 8
5 13
6 10
7 15
8 14
9 10
10 7
11 14
12 10
13 5
14 19
15 0
16 0
17 0
18 13
19 3
20 19
21 2
22 12
23 16
24 2
25 14
26 12
27 1
28 16
29 11
30 5
31 15
32 15
33 9
34 18
35 0
36 4
37 5
38 6
39 1
40 8
41 10
42 17
43 4
44 8
45 6
46 3
47 4
48 5
49 9
50 9
51 14
52 7
53 15
54 12
55 17
56 2
57 5
58 5
59 15
60 18
61 4
62 5
63 15
64 13
65 10
66 18
67 15
68 6
69 7
70 4
71 13
72 3
73 6
74 15
75 5
76 14
77 14
78 17
79 8
80 19
81 7
82 14
83 7
84 19
85 15
86 18
87 19

BIN
geval

Binary file not shown.

View File

@ -1,41 +0,0 @@
from sklearn.feature_extraction.text import TfidfVectorizer
import numpy as np
import sklearn.metrics
from sklearn.cluster import KMeans
# Lista z https://github.com/bieli/stopwords/blob/master/polish.stopwords.txt
def remove_stop_words(document, stopwords):
return " ".join([word for word in document.split() if word not in stopwords])
def write_predictions_to_file(predictions, file):
with open(file, "w") as out_file:
for prediction in predictions:
out_file.write(str(prediction) + '\n')
def load_stop_words():
with open('stopwords.txt') as stopwords_file:
stopwords = []
for stopword in stopwords_file.readlines():
# Remove whitespaces from words, to remove all stop words
stopwords.append(stopword.strip())
return stopwords
def load_tsv_file(file):
stopwords = load_stop_words()
with open(file) as in_file:
documents = []
for document in in_file.readlines():
documents.append(remove_stop_words(document, stopwords))
return documents
def prepare_prediction(catalog):
documents = load_tsv_file(catalog + "/in.tsv")
document_vectors = TfidfVectorizer().fit_transform(documents)
# Z n_clusters w okolicy 20 uzyskiwałem wyniki pokroju 0.85 (według Geval). Jednakże, z n_clusters 50 wyniki było
# przy każdym uruchomieniu zbliżone do siebie. Przy n = 20 wachają się od 0.7 do 0.85
predictions = KMeans(n_clusters=20, max_iter=1000).fit_predict(document_vectors)
write_predictions_to_file(predictions, catalog + "/out.tsv")
prepare_prediction("dev-0")
prepare_prediction("test-A")

View File

@ -1,350 +0,0 @@
a
aby
ach
acz
aczkolwiek
aj
albo
ale
alez
ależ
ani
az
bardziej
bardzo
beda
bedzie
bez
deda
będą
bede
będę
będzie
bo
bowiem
by
byc
być
byl
byla
byli
bylo
byly
był
była
było
były
bynajmniej
cala
cali
caly
cała
cały
ci
cie
ciebie
cię
co
cokolwiek
cos
coś
czasami
czasem
czemu
czy
czyli
daleko
dla
dlaczego
dlatego
do
dobrze
dokad
dokąd
dosc
dość
duzo
dużo
dwa
dwaj
dwie
dwoje
dzis
dzisiaj
dziś
gdy
gdyby
gdyz
gdyż
gdzie
gdziekolwiek
gdzies
gdzieś
go
i
ich
ile
im
inna
inne
inny
innych
iz
ja
jak
jakas
jakaś
jakby
jaki
jakichs
jakichś
jakie
jakis
jakiś
jakiz
jakiż
jakkolwiek
jako
jakos
jakoś
je
jeden
jedna
jednak
jednakze
jednakże
jedno
jego
jej
jemu
jesli
jest
jestem
jeszcze
jeśli
jezeli
jeżeli
juz
już
kazdy
każdy
kiedy
kilka
kims
kimś
kto
ktokolwiek
ktora
ktore
ktorego
ktorej
ktory
ktorych
ktorym
ktorzy
ktos
ktoś
która
które
którego
której
który
których
którym
którzy
ku
lat
lecz
lub
ma