Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
macaon_data
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Franck Dary
macaon_data
Commits
b17524f7
Commit
b17524f7
authored
4 years ago
by
Franck Dary
Browse files
Options
Downloads
Patches
Plain Diff
Added script to pretrain embeddings on w2v
parent
d92690d4
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
UD_any/data/Makefile
+4
-1
4 additions, 1 deletion
UD_any/data/Makefile
UD_any/data/pretrainEmbeddings.py
+22
-0
22 additions, 0 deletions
UD_any/data/pretrainEmbeddings.py
with
26 additions
and
1 deletion
UD_any/data/Makefile
+
4
−
1
View file @
b17524f7
...
...
@@ -12,7 +12,7 @@ TEST_FILES=$(shell find $(CORPUS) -type f -name '*test*.conllu')
THRESHOLD
=
10
FPLM_FILENAME
=
fplm
all
:
tokenizer.ts segmenter.ts texts all_no_test.conllu columns
all
:
tokenizer.ts segmenter.ts texts all_no_test.conllu columns
pretrain
rm
-f
col_
*
\.
txt
rm
-f
all_no_test.conllu
...
...
@@ -49,6 +49,9 @@ columns: all_no_test.conllu $(MCD)
texts
:
./getRawText.py
$(
CONLL2TXT
)
$(
TRAIN_FILES
)
$(
DEV_FILES
)
$(
TEST_FILES
)
pretrain
:
texts
./pretrainEmbeddings.py
$(
shell find
$(
CORPUS
)
-type
f
-name
'*train*.txt'
)
64
$(FPLM_FILENAME)
:
all_no_test.conllu $(MCD)
$(
SCRIPTS
)
/conllu2fplm.py
$<
$(
MCD
)
>
$@
...
...
This diff is collapsed.
Click to expand it.
UD_any/data/pretrainEmbeddings.py
0 → 100755
+
22
−
0
View file @
b17524f7
#! /usr/bin/env python3
import
sys
import
os
import
subprocess
def
printUsageAndExit
()
:
print
(
"
USAGE : %s file.conllu embeddingsSize
"
%
sys
.
argv
[
0
],
file
=
sys
.
stderr
)
exit
(
1
)
if
__name__
==
"
__main__
"
:
if
len
(
sys
.
argv
)
!=
3
:
printUsageAndExit
()
pathToFile
=
sys
.
argv
[
1
]
embeddingsSize
=
int
(
sys
.
argv
[
2
])
splited
=
os
.
path
.
splitext
(
pathToFile
)
target
=
splited
[
0
]
+
"
.w2v
"
p
=
subprocess
.
Popen
(
"
word2vec -cbow 0 -size %s -window 10 -negative 5 -hs 0 -sample 1e-1 -threads 2 -binary 0 -iter 15 -min-count 2 -train %s -output %s
"
%
(
embeddingsSize
,
pathToFile
,
target
),
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
shell
=
True
)
p
.
wait
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment