コード例 #1
0
ファイル: compute-distortion.py プロジェクト: KurtAhn/SLCV
def c


if __name__ == '__main__':
    p = ArgumentParser()
    p.add_argument('-c', '--config', dest='config', required=True)
    p.add_argument('-s', '--senlst', dest='senlst', required=True)
    p.add_argument('-d', '--directory', dest='directory', required=True)
    a = p.parse_args()

    load_config(a.config)
    from __init__ import *
    import acoustic as ax

    with open(a.senlst) as f:
        sentences = [l.rstrip() for l in f]

    for sentence in sentences:
コード例 #2
0
ファイル: prune-dictionary.py プロジェクト: KurtAhn/SLCV
#!/usr/bin/env python
from __init__ import load_config
from os import path
import numpy as np
from argparse import ArgumentParser


if __name__ == '__main__':
    p = ArgumentParser()
    p.add_argument('-c', '--config', dest='config', required=True)
    p.add_argument('-s', '--senlst', dest='senlst', required=True)
    p.add_argument('-w', '--whole', dest='whole', required=True)
    p.add_argument('-p', '--pruned', dest='pruned', required=True)
    a = p.parse_args()

    load_config(a.config)
    from __init__ import *
    import acoustic as ax
    import dataset as ds

    with open(a.senlst) as f:
        sentences = [l.rstrip() for l in f if l]

    print2('Loading whole vocabulary')
    with open(path.join(EMBDIR, a.whole+'.vcb')) as f:
        whole_vocab = [l.rstrip() for l in f]
    whole_vocab = {t: n for n, t in enumerate(whole_vocab)}

    print2('Loading embedding')
    with open(path.join(EMBDIR, a.whole+'.dim')) as f:
        whole_embed_shape = tuple(int(t) for t in next(f).rstrip().split())