From c3a9eb30ce6b2168fd2683cf3b51fb9fefdab3d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Lamercerie?= <aurelien.lamercerie@tetras-libre.fr> Date: Wed, 28 Jun 2023 11:40:28 +0200 Subject: [PATCH] Update requirements and gitignore --- .gitignore | 2 ++ requirements.txt | 1 + tests/amrbatch.log | 49 ++++++++++++++++++++----------------- tests/test_amrbatch_main.py | 11 +++++---- 4 files changed, 36 insertions(+), 27 deletions(-) diff --git a/.gitignore b/.gitignore index ae5b8471..91bbeb49 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ __pycache__ *catalog-v001.xml venv/* amr_models/* +*.ipynb_checkpoints/ +tests/output/* diff --git a/requirements.txt b/requirements.txt index 3d9c233e..ca2076b2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,3 +6,4 @@ rdflib graphviz bs4 lxml +multiprocessing-logging diff --git a/tests/amrbatch.log b/tests/amrbatch.log index da46843a..22602ec5 100644 --- a/tests/amrbatch.log +++ b/tests/amrbatch.log @@ -6,14 +6,14 @@ === Preparation === - INFO - -- base reference: test - INFO - -- input filepath: /home/lamenji/Workspace/Tetras/amrbatch/tests/input/test.txt -- INFO - -- output dirpath: /home/lamenji/Workspace/Tetras/amrbatch/tests/output/Test-20230314/ +- INFO - -- output dirpath: /home/lamenji/Workspace/Tetras/amrbatch/tests/output/Test-20230628/ - INFO - -- Reading input line set to recover a list of work data - DEBUG - *** sentence 1 *** -<work_data.WorkData object at 0x7f5207109ba0> +The sun is a star. - DEBUG - *** sentence 2 *** -<work_data.WorkData object at 0x7f52071087f0> +Earth is a planet. - INFO - ----- number of sentences: 2 -- DEBUG - -- Making output directory tree (/home/lamenji/Workspace/Tetras/amrbatch/tests/output/Test-20230314/) +- DEBUG - -- Making output directory tree (/home/lamenji/Workspace/Tetras/amrbatch/tests/output/Test-20230628/) - DEBUG - -- Generating sentence file - INFO - === Text Convert to AMR Graphs === @@ -22,31 +22,36 @@ - DEBUG - (/home/lamenji/Workspace/Tetras/amrbatch/tests/../amr_models/model_parse_xfm_bart_large-v0_1_0) - INFO - -- Loading AMR model - INFO - -- Converting sentences to AMR graphs -- INFO - ----- Sentence 1 successfully processed -- DEBUG - ['# ::snt The sun is a star.\n(s / star\n :domain (s2 / sun))'] -- INFO - ----- Sentence 2 successfully processed -- DEBUG - ['# ::snt Earth is a planet.\n(p / planet\n :domain p\n :name (n / name\n :op1 "Earth"))'] +- INFO - ----- Sentence successfully processed +- INFO - ['# ::snt The sun is a star.\n(s / star\n :domain (s2 / sun))'] +- INFO - -- Loading AMR model +- INFO - -- Converting sentences to AMR graphs +- WARNING - gid=x Start paren present but planet is not a new concept +- INFO - ----- Sentence successfully processed +- INFO - ['# ::snt Earth is a planet.\n(p / planet\n :domain p\n :name (n / name\n :op1 "Earth"))'] - INFO - ----- Total processed graph number: 2 - INFO - -- Generating AMR graph files -- DEBUG - ----- AMR Graph file (penman): test-01.stog.amr.penman -- DEBUG - ----- AMR Graph file (dot): test-01.stog.amr.dot -- DEBUG - ----- AMR Graph file (png): {os.path.basename(good_png_fn)} -- DEBUG - ----- AMR Graph file (penman): test-02.stog.amr.penman -- DEBUG - ----- AMR Graph file (dot): test-02.stog.amr.dot -- DEBUG - ----- AMR Graph file (png): {os.path.basename(good_png_fn)} +- INFO - ----- AMR Graph file (penman): test-01.stog.amr.penman +- INFO - ----- AMR Graph file (penman): test-02.stog.amr.penman +- INFO - ----- AMR Graph file (dot): test-02.stog.amr.dot +- INFO - ----- AMR Graph file (dot): test-01.stog.amr.dot +- INFO - ----- AMR Graph file (png): test-01.stog.amr.png +- INFO - ----- AMR Graph file (png): test-02.stog.amr.png +- INFO - ----- AMR Graph file (svg): test-01.stog.amr.svg +- INFO - ----- AMR Graph file (svg): test-02.stog.amr.svg - INFO - === AMR Graphs Serialization to AMR-RDF Representation === - INFO - -- library: amrld - DEBUG - (/home/lamenji/Workspace/Tetras/amrbatch/amrbatch/amrld/) - INFO - -- Serialize AMR graphs to RDF using amr-ld library -- DEBUG - ----- AMR filepath (penman): /home/lamenji/Workspace/Tetras/amrbatch/tests/output/Test-20230314/test-01/test-01.stog.amr.penman -- DEBUG - ----- AMR-RDF filepath (triple): /home/lamenji/Workspace/Tetras/amrbatch/tests/output/Test-20230314/test-01/test-01.stog.amr.nt -- DEBUG - ----- AMR-RDF filepath (turtle): /home/lamenji/Workspace/Tetras/amrbatch/tests/output/Test-20230314/test-01/test-01.stog.amr.ttl +- INFO - ----- AMR filepath (penman): test-01.stog.amr.penman +- INFO - ----- AMR-RDF filepath (triple): test-01.stog.amr.nt +- INFO - ----- AMR-RDF filepath (turtle): test-01.stog.amr.ttl - INFO - ----- AMR-RDF triple successfully processed (test-01.stog.amr.nt) -- INFO - ----- AMR-RDF triple successfully processed (test-01.stog.amr.ttl) +- INFO - ----- AMR-RDF turtle successfully processed (test-01.stog.amr.ttl) - INFO - -- Serialize AMR graphs to RDF using amr-ld library -- DEBUG - ----- AMR filepath (penman): /home/lamenji/Workspace/Tetras/amrbatch/tests/output/Test-20230314/test-02/test-02.stog.amr.penman -- DEBUG - ----- AMR-RDF filepath (triple): /home/lamenji/Workspace/Tetras/amrbatch/tests/output/Test-20230314/test-02/test-02.stog.amr.nt -- DEBUG - ----- AMR-RDF filepath (turtle): /home/lamenji/Workspace/Tetras/amrbatch/tests/output/Test-20230314/test-02/test-02.stog.amr.ttl +- INFO - ----- AMR filepath (penman): test-02.stog.amr.penman +- INFO - ----- AMR-RDF filepath (triple): test-02.stog.amr.nt +- INFO - ----- AMR-RDF filepath (turtle): test-02.stog.amr.ttl - INFO - ----- AMR-RDF triple successfully processed (test-02.stog.amr.nt) -- INFO - ----- AMR-RDF triple successfully processed (test-02.stog.amr.ttl) +- INFO - ----- AMR-RDF turtle successfully processed (test-02.stog.amr.ttl) diff --git a/tests/test_amrbatch_main.py b/tests/test_amrbatch_main.py index 7484c948..03af1758 100644 --- a/tests/test_amrbatch_main.py +++ b/tests/test_amrbatch_main.py @@ -26,13 +26,14 @@ from utility import file_cutter # -- Input Data # input_filename = f'08d1b73a-bdf5-4b54-8e6e-b96665f3c2fa.txt' -# input_filename = f'test.txt' -input_filename = f'SSC-ABSTRACT.txt' +input_filename = f'test.txt' +# input_filename = f'SSC-ABSTRACT.txt' input_filepath = f'{INPUT_DIR_PATH}{input_filename}' # -- Output references -base_output_name = f'SolarSystem' # f'Test' +base_output_name = f'Test' +# base_output_name = f'SolarSystem' time_ref = f'{datetime.now().strftime("%Y%m%d")}' output_dirpath = f'{OUTPUT_DIR_PATH}{base_output_name}-{time_ref}/' os.makedirs(output_dirpath, exist_ok=True) @@ -63,8 +64,8 @@ for amr_graph in amr_graph_list: # -- Parsing from a string -reading_file = open(input_filepath, "r") -input_string = reading_file.read() +# reading_file = open(input_filepath, "r") +# input_string = reading_file.read() #data_reference = os.path.splitext(os.path.basename(input_filepath))[0] # data_reference = None # data_reference = 'testReference' -- GitLab