diff --git a/main.py b/main.py new file mode 100644 index 0000000000000000000000000000000000000000..fae859322c430de013a4bf59ac2db557854c07c7 --- /dev/null +++ b/main.py @@ -0,0 +1,33 @@ +import stats +import scorer + +import os +import sys + +if __name__ == "__main__": + + if len(sys.argv) < 4: + print(f"Usage:\n\t$ python3 {sys.argv[0]} <corpus_sentences_path> <corpus_odrl_path> <output_odrl_path>") + print("Where:\n\t<corpus_sentences_path> is the path to the .txt source of the corpus") + print("\t<corpus_odrl_path> is the path to the .ttl data of the corpus") + print("\t<output_odrl_path> is the path to the .ttl output of the system on the corpus source") + exit(1) + + path_sentences = sys.argv[1] + if path_sentences[-1] != "/": path_sentences += "/" + path_target = sys.argv[2] + if path_target[-1] != "/": path_target += "/" + path_output = sys.argv[3] + if path_output[-1] != "/": path_output += "/" + + statistics = stats.main_stats(path_sentences, path_target) + + scores_modalities, scores_actions, scores_global = scorer.main_scorer(path_target, path_output) + + print(f"Corpus source: {path_sentences}\nCorpus data: {path_target}\nSystem output: {path_output}\n") + print("############ STATS ############\n") + print(statistics) + print("\n############ SCORES ###########\n") + print(f"# Modality scores:\n{scores_modalities}") + print(f"# Actions scores:\n{scores_actions}") + print(f"# Global scores:\n{scores_global}") diff --git a/scorer.py b/scorer.py index 513e3ad362efa9726da42e57c5fcb6d850127e47..5c4ce1f8320e8ac1d072026c22e965953b4f8c89 100644 --- a/scorer.py +++ b/scorer.py @@ -163,11 +163,11 @@ def main_scorer(path_target, path_output): scores_actions = Scores() scores_global = Scores() - for fname in os.listdir(path_odrl): + for fname in os.listdir(path_target): if fname.endswith(".ttl"): odrl_target = ODRL() - odrl_target.parse(path_odrl + fname) + odrl_target.parse(path_target + fname) odrl_output = ODRL() odrl_output.parse(path_output + fname) @@ -186,7 +186,9 @@ if __name__ == "__main__": exit(1) path_target = sys.argv[1] + if path_target[-1] != "/": path_target += "/" path_output = sys.argv[2] + if path_output[-1] != "/": path_output += "/" scores_modalities, scores_actions, scores_global = main_scorer(path_target, path_output)