DGurgurov commited on
Commit
8682de4
1 Parent(s): 6c796a3

Upload 5 files

Browse files
.gitattributes CHANGED
@@ -53,3 +53,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
53
  *.jpg filter=lfs diff=lfs merge=lfs -text
54
  *.jpeg filter=lfs diff=lfs merge=lfs -text
55
  *.webp filter=lfs diff=lfs merge=lfs -text
 
 
 
 
53
  *.jpg filter=lfs diff=lfs merge=lfs -text
54
  *.jpeg filter=lfs diff=lfs merge=lfs -text
55
  *.webp filter=lfs diff=lfs merge=lfs -text
56
+ maltese_glove_10.txt filter=lfs diff=lfs merge=lfs -text
57
+ mt_word2vec.txt filter=lfs diff=lfs merge=lfs -text
58
+ ppmi_embeddings.txt filter=lfs diff=lfs merge=lfs -text
maltese_glove_10.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5b8e3e71dd1b3f65251ac3e6c877298107a6349a6d308bb3976daf7854575cda
3
+ size 2037838610
mt_glove.sh ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ # Makes programs, downloads sample data, trains a GloVe model, and then evaluates it.
5
+ # One optional argument can specify the language used for eval script: matlab, octave or [default] python
6
+
7
+ make
8
+ if [ ! -e text8 ]; then
9
+ if hash wget 2>/dev/null; then
10
+ wget http://mattmahoney.net/dc/text8.zip
11
+ else
12
+ curl -O http://mattmahoney.net/dc/text8.zip
13
+ fi
14
+ unzip text8.zip
15
+ rm text8.zip
16
+ fi
17
+
18
+ CORPUS=korpus_malti_tok.txt
19
+ VOCAB_FILE=vocab.txt
20
+ COOCCURRENCE_FILE=cooccurrence.bin
21
+ COOCCURRENCE_SHUF_FILE=cooccurrence.shuf.bin
22
+ BUILDDIR=build
23
+ SAVE_FILE=maltese_glove_10
24
+ VERBOSE=2
25
+ MEMORY=4.0
26
+ VOCAB_MIN_COUNT=5
27
+ VECTOR_SIZE=300
28
+ MAX_ITER=15
29
+ WINDOW_SIZE=10
30
+ BINARY=2
31
+ NUM_THREADS=8
32
+ X_MAX=10
33
+ if hash python 2>/dev/null; then
34
+ PYTHON=python
35
+ else
36
+ PYTHON=python3
37
+ fi
38
+
39
+ echo
40
+ echo "$ $BUILDDIR/vocab_count -min-count $VOCAB_MIN_COUNT -verbose $VERBOSE < $CORPUS > $VOCAB_FILE"
41
+ $BUILDDIR/vocab_count -min-count $VOCAB_MIN_COUNT -verbose $VERBOSE < $CORPUS > $VOCAB_FILE
42
+ echo "$ $BUILDDIR/cooccur -memory $MEMORY -vocab-file $VOCAB_FILE -verbose $VERBOSE -window-size $WINDOW_SIZE < $CORPUS > $COOCCURRENCE_FILE"
43
+ $BUILDDIR/cooccur -memory $MEMORY -vocab-file $VOCAB_FILE -verbose $VERBOSE -window-size $WINDOW_SIZE < $CORPUS > $COOCCURRENCE_FILE
44
+ echo "$ $BUILDDIR/shuffle -memory $MEMORY -verbose $VERBOSE < $COOCCURRENCE_FILE > $COOCCURRENCE_SHUF_FILE"
45
+ $BUILDDIR/shuffle -memory $MEMORY -verbose $VERBOSE < $COOCCURRENCE_FILE > $COOCCURRENCE_SHUF_FILE
46
+ echo "$ $BUILDDIR/glove -save-file $SAVE_FILE -threads $NUM_THREADS -input-file $COOCCURRENCE_SHUF_FILE -x-max $X_MAX -iter $MAX_ITER -vector-size $VECTOR_SIZE -binary $BINARY -vocab-file $VOCAB_FILE -verbose $VERBOSE"
47
+ $BUILDDIR/glove -save-file $SAVE_FILE -threads $NUM_THREADS -input-file $COOCCURRENCE_SHUF_FILE -x-max $X_MAX -iter $MAX_ITER -vector-size $VECTOR_SIZE -binary $BINARY -vocab-file $VOCAB_FILE -verbose $VERBOSE
48
+ if [ "$CORPUS" = 'text8' ]; then
49
+ if [ "$1" = 'matlab' ]; then
50
+ matlab -nodisplay -nodesktop -nojvm -nosplash < ./eval/matlab/read_and_evaluate.m 1>&2
51
+ elif [ "$1" = 'octave' ]; then
52
+ octave < ./eval/octave/read_and_evaluate_octave.m 1>&2
53
+ else
54
+ echo "$ $PYTHON eval/python/evaluate.py"
55
+ $PYTHON eval/python/evaluate.py
56
+ fi
57
+ fi
mt_word2vec.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ from gensim.models import Word2Vec
3
+ import gensim
4
+
5
+ def tokenize_sentence(sentence):
6
+ return sentence.split()
7
+
8
+ with open('korpus_malti_tok.txt', 'r', encoding='utf-8') as file:
9
+ sentences = file.read().splitlines()
10
+
11
+ data = [tokenize_sentence(sentence) for sentence in sentences]
12
+
13
+ model = Word2Vec(data,
14
+ vector_size=300,
15
+ window=10,
16
+ min_count=20,
17
+ workers=16,
18
+ sample=1e-5,
19
+ alpha=0.03,
20
+ min_alpha=0.0007,
21
+ negative=20)
22
+
23
+ model.build_vocab(data, progress_per=1000)
24
+ print(model.corpus_count)
25
+
26
+ model.train(data, total_examples=model.corpus_count, epochs=15)
27
+
28
+ model.wv.save_word2vec_format('mt_word2vec_2.txt', binary=False)
29
+
30
+ print('Émbeddings successfully trained!')
mt_word2vec.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9da95cfe3cd190183d04791e46250a6acb7304d4923d4d2a9e829efcd84ae82a
3
+ size 5011712325
ppmi_embeddings.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9c2443277bb1dca66914231951a196aa710e0d4f894e0802e7d1faf5557272ea
3
+ size 102048632