示例#1
0
def make_feats(ids2fnames, dest_dir, with_lsa=True):
    for data_id, input_fname in ids2fnames.items():
        print "creating training features for", data_id
        data_dir = data_id[9:] if data_id.startswith("surprise.") else data_id
        out_dir = join(dest_dir, data_dir)
        if not exists(out_dir):
            makedirs(out_dir)

        tl.generate_feats_ntnu(input_fname, out_dir, with_lsa=with_lsa)
示例#2
0
                     '../_data/lsa-matrices/wiki-matrix-sts.txt')

with_lsa = True


dest_dir = "../out/STS2012-train"

for data_id in sts12.train_ids:
    print "creating training features for", data_id
    data_dir= data_id[9:] if data_id.startswith("surprise.") else data_id
    out_dir = join(dest_dir, data_dir)
    if not exists(out_dir):
        makedirs(out_dir)
    
    tl.generate_feats_ntnu(
        sts12.train_input_fnames[data_id], 
        out_dir,
        with_lsa=with_lsa)

dest_dir = "../out/STS2012-test"

for data_id in sts12.test_ids:
    print "creating test features for", data_id
    data_dir= data_id[9:] if data_id.startswith("surprise.") else data_id
    out_dir = join(dest_dir, data_dir)
    if not exists(out_dir):
        makedirs(out_dir)
    
    tl.generate_feats_ntnu(
        sts12.test_input_fnames[data_id], 
        out_dir,
        with_lsa=with_lsa)