diff options
author | Marcin Junczys-Dowmunt <junczys@amu.edu.pl> | 2016-05-01 17:07:54 +0300 |
---|---|---|
committer | Marcin Junczys-Dowmunt <junczys@amu.edu.pl> | 2016-05-01 17:07:54 +0300 |
commit | ef5d9ff364c26cb085810023521d2f289789d75f (patch) | |
tree | 91e7416372097b02dc87a71e68079e5bc01322c6 /scripts | |
parent | 1d31867acf0808478cb3811f7af61d0011e58361 (diff) |
xample configuration in README
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/json2yaml.py | 6 | ||||
-rw-r--r--[-rwxr-xr-x] | scripts/pkl2json.py (renamed from scripts/vocab2txt.py) | 5 | ||||
-rw-r--r-- | scripts/pkl2yaml.py | 9 |
3 files changed, 17 insertions, 3 deletions
diff --git a/scripts/json2yaml.py b/scripts/json2yaml.py new file mode 100644 index 00000000..ff6b395c --- /dev/null +++ b/scripts/json2yaml.py @@ -0,0 +1,6 @@ +import sys +import json +import yaml + +yaml.safe_dump(json.load(sys.stdin), sys.stdout, + default_flow_style=False, allow_unicode=True)
\ No newline at end of file diff --git a/scripts/vocab2txt.py b/scripts/pkl2json.py index cfe26f06..05f672fe 100755..100644 --- a/scripts/vocab2txt.py +++ b/scripts/pkl2json.py @@ -1,9 +1,8 @@ #!/usr/bin/env python import sys import cPickle +import json import operator d = cPickle.load(open(sys.argv[1], 'r')) -sorted_d = sorted(d.items(), key=operator.itemgetter(1)) -for p in sorted_d: - print p[0] +json.dump(d, sys.stdout)
\ No newline at end of file diff --git a/scripts/pkl2yaml.py b/scripts/pkl2yaml.py new file mode 100644 index 00000000..0070566e --- /dev/null +++ b/scripts/pkl2yaml.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python +import sys +import cPickle +import yaml +import operator + +d = cPickle.load(open(sys.argv[1], 'r')) +yaml.safe_dump(d, sys.stdout, + default_flow_style=False, allow_unicode=True)
\ No newline at end of file |