diff --git a/README.md b/README.md index 646a2d3..5928d53 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ rm ud-treebanks-v2.2.tgz ## Prepare Embeddings ### fastText -The fastText embeddings can be downloaded on the Facebook fastText [repo](https://github.com/facebookresearch/fastText/blob/master/docs/pretrained-vectors.md) (Note that there are different versions of pretrained fastText embeddings in the fastText repo, but the embeddings must be downloaded from the given link since the alignment matrices (from [here](https://github.com/Babylonpartners/fastText_multilingual)) we used are learned on this specific version of fastText embeddings. Download the fastText model `bin` file and put it into the `fastText_data` folder. +The fastText embeddings can be downloaded in the Facebook fastText [repo](https://github.com/facebookresearch/fastText/blob/master/docs/pretrained-vectors.md) (Note that there are different versions of pretrained fastText embeddings in the fastText repo, but the embeddings must be downloaded from the given link since the alignment matrices (from [here](https://github.com/Babylonpartners/fastText_multilingual)) we used are learned on this specific version of fastText embeddings). Download the fastText model `bin` file and put it into the `fastText_data` folder. Take English language as an example to preprocess the fastText embeddings: ``` diff --git a/modules/logger.py b/modules/logger.py new file mode 100644 index 0000000..dd25ef9 --- /dev/null +++ b/modules/logger.py @@ -0,0 +1,26 @@ +#! /usr/bin/env python +# -*- coding: utf-8 -*- +# vim:fenc=utf-8 +# +# Copyright © 2019-05-29 Junxian +# +# Distributed under terms of the MIT license. + +""" +Logger class files +""" +import sys + +class Logger(object): + def __init__(self, output_file): + self.terminal = sys.stdout + self.log = open(output_file, "w") + + def write(self, message): + print(message, end="", file=self.terminal, flush=True) + print(message, end="", file=self.log, flush=True) + + def flush(self): + self.terminal.flush() + self.log.flush() +