Skip to content
Snippets Groups Projects
Commit 4c716375 authored by Franck Dary's avatar Franck Dary
Browse files

Fixed script concatW2V

parent 7b65bf7f
No related branches found
No related tags found
No related merge requests found
......@@ -2,17 +2,27 @@
import sys
hadFirst = False
nbLines = 0
embSize = None
for filename in sys.argv[1:] :
prefix = filename.split('/')[-1].split('.')[0]
for line in open(filename, "r") :
line = line.strip()
splited = line.split()
if len(splited) == 2 :
if hadFirst :
continue
hadFirst = True
print(line)
if embSize is None :
embSize = int(splited[1])
elif embSize != int(splited[1]) :
print("ERROR : incompatibles embedings sizes %d and %d"%(embSize, int(splited[1])), file=sys.stderr)
exit(1)
else :
nbLines += 1
print(nbLines, embSize)
for filename in sys.argv[1:] :
prefix = filename.split('/')[-1].split('.')[0]
for line in open(filename, "r") :
line = line.strip()
splited = line.split()
if len(splited) > 2 :
print(prefix+"_"+line)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment