From 431c7279cf303368bd92a987aae41bc556da45dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Lamercerie?= <aurelien.lamercerie@tetras-libre.fr> Date: Mon, 22 Aug 2022 09:48:01 +0200 Subject: [PATCH] New module: propbank_analyzer --- lib/propbank_analyzer.py | 72 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 lib/propbank_analyzer.py diff --git a/lib/propbank_analyzer.py b/lib/propbank_analyzer.py new file mode 100644 index 00000000..0d5ae238 --- /dev/null +++ b/lib/propbank_analyzer.py @@ -0,0 +1,72 @@ +#!/usr/bin/python3.10 +# -*-coding:Utf-8 -* + +#============================================================================== +# C.M. Tool: prop +#------------------------------------------------------------------------------ +# Module to analyze PropBank frames +#============================================================================== + +#============================================================================== +# Importing required modules +#============================================================================== + +import sys +import glob + + +#============================================================================== +# Parameters +#============================================================================== + +# Input/Output Directories +INPUT_DIR = "../inputData/" +OUTPUT_DIR = "../outputData/" + +# Data +PROPBANK_FRAMES_DIR = "../propbankFrames/" + + + +#============================================================================== +# Functions to find the XML description corresponding to a roleset +#============================================================================== + +def find_frame_filepath(lemma): + """ Find the Frame XML filepath corresponding to a given lemma + """ + + target_file = PROPBANK_FRAMES_DIR + lemma + '.xml' + filepath = glob.glob(target_file, recursive=True) + + return filepath + + + + + + +#============================================================================== +# Main function +#============================================================================== + +def main(lemma): + + # -- Prepare the sentences to be converted + print("\n" + "[CMT] Finding frame") + print("-- lemma: " + lemma) + filepath = find_frame_filepath(lemma) + print(filepath) + + + # -- Ending print + print("\n" + "[SSC] Done") + + +if __name__ == "__main__": + main(sys.argv[1]) + + + + + -- GitLab