This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def loadGloveModel(gloveFile): | |
# via https://stackoverflow.com/a/38230349 | |
# output: dict (word -> embedding) | |
print("Loading Glove Model", file=sys.stderr) | |
model = {} | |
for i, line in enumerate(gloveFile, start=1): | |
if i % 100000 == 0: | |
print("load {} data".format(i), file=sys.stderr) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
infile_fullpath = os.path.abspath(args.path_infile) | |
infile_dir = os.path.dirname(infile_fullpath) | |
infile_filename = os.path.basename(infile_fullpath) | |
infile_filename_without_extension, infile_filename_extension = os.path.splitext(infile_filename) |