Skip to content
Snippets Groups Projects
Commit 47b5a23f authored by Malo Revel's avatar Malo Revel
Browse files

Add main

parent e30566a6
Branches
No related tags found
No related merge requests found
main.py 0 → 100644
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}")
...@@ -163,11 +163,11 @@ def main_scorer(path_target, path_output): ...@@ -163,11 +163,11 @@ def main_scorer(path_target, path_output):
scores_actions = Scores() scores_actions = Scores()
scores_global = Scores() scores_global = Scores()
for fname in os.listdir(path_odrl): for fname in os.listdir(path_target):
if fname.endswith(".ttl"): if fname.endswith(".ttl"):
odrl_target = ODRL() odrl_target = ODRL()
odrl_target.parse(path_odrl + fname) odrl_target.parse(path_target + fname)
odrl_output = ODRL() odrl_output = ODRL()
odrl_output.parse(path_output + fname) odrl_output.parse(path_output + fname)
...@@ -186,7 +186,9 @@ if __name__ == "__main__": ...@@ -186,7 +186,9 @@ if __name__ == "__main__":
exit(1) exit(1)
path_target = sys.argv[1] path_target = sys.argv[1]
if path_target[-1] != "/": path_target += "/"
path_output = sys.argv[2] path_output = sys.argv[2]
if path_output[-1] != "/": path_output += "/"
scores_modalities, scores_actions, scores_global = main_scorer(path_target, path_output) scores_modalities, scores_actions, scores_global = main_scorer(path_target, path_output)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment