def coffeeCompile(filename):
    bashCommand = 'coffee -cb "{}"'.format(filename)
    color.red("bashCommand")
    print(bashCommand)

    #    process = subprocess.Popen(bashCommand, stdout=subprocess.PIPE)
    #    output = process.communicate()[0]

    #    import subprocess
    # subprocess.Popen(bashCommand)
    bash.run_script(bashCommand)
Exemplo n.º 2
0
def execute_rouge(rouge_path, peer_path, model_path, output_path):
    if not os.path.exists(os.path.join(
            output_path,
            "Peer",
    )):
        os.makedirs(os.path.join(
            output_path,
            "Peer",
        ))
    if not os.path.exists(os.path.join(
            output_path,
            "Model",
    )):
        os.makedirs(os.path.join(
            output_path,
            "Model",
        ))
    for summary in os.listdir(peer_path):
        print("Loading peer : " + summary)
        summary_sent = []
        # if os.path.isfile(os.path.join(peer_path, summary)):
        with open(os.path.join(peer_path, summary)) as f:
            for sen in f:
                summary_sent.append(sen)
        write_generated_summary(os.path.join(output_path, "Peer"), summary,
                                summary_sent)
        for file in os.listdir(model_path):
            prog = re.compile(summary[:7] + ".sum")
            # prog = re.compile(summary[:5] + summary[-2:])
            if (prog.match(file) is not None):
                print("Loading models : " + file)
                model_sent = []
                with open(os.path.join(model_path, file)) as f:
                    for sen in f:
                        model_sent.append(sen)
                write_model_summary(os.path.join(output_path, "Model"), file,
                                    model_sent)
    write_settings_xml(peer_path, output_path, "Model", "Peer")

    print("Run cmd : " + os.path.join(
        ".", rouge_path, "ROUGE-1.5.5.pl -e " +
        rouge_path, "data -n 3 -x -m -c 95 -r" + "1000 -f A -p 0.5 -t 0 -a " +
        output_path, "rouge_settings.xml"))
    sys.stdout, sys.stderr = bash.run_script(
        os.path.join(
            ".", rouge_path, "ROUGE-1.5.5.pl -e " + rouge_path,
            "data -n 2 -x -m -c 95 -r" + "1000 -f A -p 0.5 -t 0 -a " +
            output_path, "rouge_settings.xml"))
Exemplo n.º 3
0
 def test_ls(self):
     (out, err) = bash.run_script("echo 'Hello'")
     self.assertEqual(out, b"Hello\n")
     print(out)