Skip to content
Snippets Groups Projects
Commit 01b03158 authored by Aurélien Lamercerie's avatar Aurélien Lamercerie
Browse files

Fix bug in filepath_manager (about processing without output dir as parameter)

parent a3a49ac0
No related branches found
No related tags found
No related merge requests found
Showing
with 144 additions and 9 deletions
......@@ -4,3 +4,4 @@ __pycache__
*.ttl.tbc
*catalog-v001.xml
venv/*
amr_models/*
......@@ -31,10 +31,10 @@ class FilepathManager:
self.base_reference = os.path.splitext(os.path.basename(input_filepath))[0]
self.input_filepath = input_filepath
self.input_dirpath = os.path.dirname(input_filepath)
self.input_dirpath = f'{os.path.dirname(input_filepath)}/'
if output_dirpath is None:
self.output_dirpath = self._input_dirpath
self.output_dirpath = self.input_dirpath
else:
self.output_dirpath = output_dirpath
......
......@@ -3,14 +3,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-20230303/
- INFO - -- output dirpath: /home/lamenji/Workspace/Tetras/amrbatch/tests/output/Test-20230306/
- INFO - -- Reading input files to recover a list of sentences
- DEBUG - *** sentence 1 ***
<work_data.WorkData object at 0x7fa71e5702b0>
<work_data.WorkData object at 0x7f2eb8095660>
- DEBUG - *** sentence 2 ***
<work_data.WorkData object at 0x7fa71e570280>
<work_data.WorkData object at 0x7f2eb8097670>
- INFO - ----- number of sentences: 2
- DEBUG - -- Making output directory tree (/home/lamenji/Workspace/Tetras/amrbatch/tests/output/Test-20230303/)
- DEBUG - -- Making output directory tree (/home/lamenji/Workspace/Tetras/amrbatch/tests/output/Test-20230306/)
- DEBUG - -- Generating sentence file
- INFO -
=== Text Convert to AMR Graphs ===
......@@ -23,7 +23,6 @@
- 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))']
- WARNING - gid=x Start paren present but planet is not a new concept
- 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 - ----- Total processed graph number: 2
......@@ -38,12 +37,12 @@
=== AMR Graphs Serialization to AMR-RDF Representation ===
- INFO - -- library: amrlk
- INFO - -- Serialize AMR graphs to RDF using amr-ld library
- DEBUG - ----- penman filepath: /home/lamenji/Workspace/Tetras/amrbatch/tests/output/Test-20230303/test-01/test-01.stog.amr.penman
- DEBUG - ----- penman filepath: /home/lamenji/Workspace/Tetras/amrbatch/tests/output/Test-20230306/test-01/test-01.stog.amr.penman
- DEBUG - ----- AMRLD filepath: /home/lamenji/Workspace/Tetras/amrbatch/amrbatch/amrld/wk/test-01.stog.amr.penman
- INFO - -- Generating AMR RDF file (triple): test-01.stog.amr.nt
- INFO - -- Generating AMR RDF file (turtle): test-01.stog.amr.ttl
- INFO - -- Serialize AMR graphs to RDF using amr-ld library
- DEBUG - ----- penman filepath: /home/lamenji/Workspace/Tetras/amrbatch/tests/output/Test-20230303/test-02/test-02.stog.amr.penman
- DEBUG - ----- penman filepath: /home/lamenji/Workspace/Tetras/amrbatch/tests/output/Test-20230306/test-02/test-02.stog.amr.penman
- DEBUG - ----- AMRLD filepath: /home/lamenji/Workspace/Tetras/amrbatch/amrbatch/amrld/wk/test-02.stog.amr.penman
- INFO - -- Generating AMR RDF file (triple): test-02.stog.amr.nt
- INFO - -- Generating AMR RDF file (turtle): test-02.stog.amr.ttl
The sun is a star. Earth is a planet.
digraph amr_graph {
rankdir=LR size="12,8"
s [label="s/star" shape=circle]
s2 [label="s2/sun" shape=circle]
s -> s2 [label=":domain"]
}
<http://amr.isi.edu/rdf/amr-terms#domain> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://amr.isi.edu/rdf/core-amr#Role> .
<http://amr.isi.edu/rdf/core-amr#Frame> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://amr.isi.edu/rdf/core-amr#Concept> .
<http://amr.isi.edu/amr_data/test-01#root01> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://amr.isi.edu/rdf/core-amr#AMR> .
<http://amr.isi.edu/rdf/core-amr#Role> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Class> .
<http://amr.isi.edu/rdf/core-amr#Frame> <http://www.w3.org/2000/01/rdf-schema#label> "AMR-PropBank-Frame" .
<http://amr.isi.edu/rdf/amr-terms#sun> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://amr.isi.edu/rdf/core-amr#Concept> .
<http://amr.isi.edu/rdf/core-amr#NamedEntity> <http://www.w3.org/2000/01/rdf-schema#label> "AMR-EntityType" .
<http://amr.isi.edu/rdf/core-amr#Concept> <http://www.w3.org/2000/01/rdf-schema#label> "AMR-Concept" .
<http://amr.isi.edu/rdf/core-amr#NamedEntity> <http://www.w3.org/2000/01/rdf-schema#label> "AMR-Term" .
<http://amr.isi.edu/entity-types#star> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://amr.isi.edu/rdf/core-amr#NamedEntity> .
<http://amr.isi.edu/amr_data/test-01#root01> <http://amr.isi.edu/rdf/core-amr#root> <http://amr.isi.edu/amr_data/test-01#s> .
<http://amr.isi.edu/amr_data/test-01#s2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://amr.isi.edu/rdf/amr-terms#sun> .
<http://amr.isi.edu/amr_data/test-01#root01> <http://amr.isi.edu/rdf/core-amr#has-sentence> "The sun is a star." .
<http://amr.isi.edu/amr_data/test-01#root01> <http://amr.isi.edu/rdf/core-amr#has-id> "test-01" .
<http://amr.isi.edu/frames/ld/v1.2.2/FrameRole> <http://www.w3.org/2000/01/rdf-schema#label> "AMR-PropBank-Role" .
<http://amr.isi.edu/amr_data/test-01#s> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://amr.isi.edu/entity-types#star> .
<http://amr.isi.edu/rdf/core-amr#Concept> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Class> .
<http://amr.isi.edu/rdf/core-amr#Role> <http://www.w3.org/2000/01/rdf-schema#label> "AMR-Role" .
<http://amr.isi.edu/rdf/core-amr#NamedEntity> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://amr.isi.edu/rdf/core-amr#Concept> .
<http://amr.isi.edu/amr_data/test-01#s> <http://amr.isi.edu/rdf/amr-terms#domain> <http://amr.isi.edu/amr_data/test-01#s2> .
<http://amr.isi.edu/frames/ld/v1.2.2/FrameRole> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://amr.isi.edu/rdf/core-amr#Role> .
# ::id test-01
# ::snt The sun is a star.
(s / star
:domain (s2 / sun))
\ No newline at end of file
tests/output/Test-20230306/test-01/test-01.stog.amr.png

11.4 KiB

@prefix ns1: <http://amr.isi.edu/rdf/core-amr#> .
@prefix ns2: <http://amr.isi.edu/rdf/amr-terms#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
ns1:Concept a rdfs:Class ;
rdfs:label "AMR-Concept" .
ns1:Role a rdfs:Class ;
rdfs:label "AMR-Role" .
<http://amr.isi.edu/amr_data/test-01#root01> a ns1:AMR ;
ns1:has-id "test-01" ;
ns1:has-sentence "The sun is a star." ;
ns1:root <http://amr.isi.edu/amr_data/test-01#s> .
<http://amr.isi.edu/frames/ld/v1.2.2/FrameRole> a ns1:Role ;
rdfs:label "AMR-PropBank-Role" .
ns2:domain a ns1:Role .
ns1:Frame a ns1:Concept ;
rdfs:label "AMR-PropBank-Frame" .
<http://amr.isi.edu/amr_data/test-01#s> a <http://amr.isi.edu/entity-types#star> ;
ns2:domain <http://amr.isi.edu/amr_data/test-01#s2> .
<http://amr.isi.edu/amr_data/test-01#s2> a ns2:sun .
<http://amr.isi.edu/entity-types#star> a ns1:NamedEntity .
ns2:sun a ns1:Concept .
ns1:NamedEntity a ns1:Concept ;
rdfs:label "AMR-EntityType",
"AMR-Term" .
digraph amr_graph {
rankdir=LR size="12,8"
p [label="p/planet" shape=circle]
n [label="n/name" shape=circle]
p -> p [label=":domain"]
p -> n [label=":name"]
node_0 [label="\"Earth\"" shape=rectangle]
n -> node_0 [label=":op1"]
}
<http://amr.isi.edu/rdf/core-amr#Frame> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://amr.isi.edu/rdf/core-amr#Concept> .
<http://amr.isi.edu/entity-types#planet> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://amr.isi.edu/rdf/core-amr#NamedEntity> .
<http://amr.isi.edu/rdf/core-amr#Role> <http://www.w3.org/2000/01/rdf-schema#label> "AMR-Role" .
<http://amr.isi.edu/rdf/core-amr#NamedEntity> <http://www.w3.org/2000/01/rdf-schema#label> "AMR-Term" .
<http://amr.isi.edu/rdf/core-amr#Frame> <http://www.w3.org/2000/01/rdf-schema#label> "AMR-PropBank-Frame" .
<http://amr.isi.edu/amr_data/test-02#p> <http://www.w3.org/2000/01/rdf-schema#label> "Earth" .
<http://amr.isi.edu/amr_data/test-02#root01> <http://amr.isi.edu/rdf/core-amr#has-sentence> "Earth is a planet." .
<http://amr.isi.edu/rdf/core-amr#NamedEntity> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://amr.isi.edu/rdf/core-amr#Concept> .
<http://amr.isi.edu/amr_data/test-02#p> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://amr.isi.edu/entity-types#planet> .
<http://amr.isi.edu/amr_data/test-02#root01> <http://amr.isi.edu/rdf/core-amr#root> <http://amr.isi.edu/amr_data/test-02#p> .
<http://amr.isi.edu/rdf/core-amr#Role> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Class> .
<http://amr.isi.edu/amr_data/test-02#root01> <http://amr.isi.edu/rdf/core-amr#has-id> "test-02" .
<http://amr.isi.edu/rdf/core-amr#NamedEntity> <http://www.w3.org/2000/01/rdf-schema#label> "AMR-EntityType" .
<http://amr.isi.edu/rdf/core-amr#Concept> <http://www.w3.org/2000/01/rdf-schema#label> "AMR-Concept" .
<http://amr.isi.edu/rdf/core-amr#Concept> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Class> .
<http://amr.isi.edu/amr_data/test-02#root01> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://amr.isi.edu/rdf/core-amr#AMR> .
<http://amr.isi.edu/frames/ld/v1.2.2/FrameRole> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://amr.isi.edu/rdf/core-amr#Role> .
<http://amr.isi.edu/frames/ld/v1.2.2/FrameRole> <http://www.w3.org/2000/01/rdf-schema#label> "AMR-PropBank-Role" .
# ::id test-02
# ::snt Earth is a planet.
(p / planet
:domain p
:name (n / name
:op1 "Earth"))
\ No newline at end of file
tests/output/Test-20230306/test-02/test-02.stog.amr.png

18.4 KiB

@prefix ns1: <http://amr.isi.edu/rdf/core-amr#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
ns1:Concept a rdfs:Class ;
rdfs:label "AMR-Concept" .
ns1:Role a rdfs:Class ;
rdfs:label "AMR-Role" .
<http://amr.isi.edu/amr_data/test-02#root01> a ns1:AMR ;
ns1:has-id "test-02" ;
ns1:has-sentence "Earth is a planet." ;
ns1:root <http://amr.isi.edu/amr_data/test-02#p> .
<http://amr.isi.edu/frames/ld/v1.2.2/FrameRole> a ns1:Role ;
rdfs:label "AMR-PropBank-Role" .
ns1:Frame a ns1:Concept ;
rdfs:label "AMR-PropBank-Frame" .
<http://amr.isi.edu/amr_data/test-02#p> a <http://amr.isi.edu/entity-types#planet> ;
rdfs:label "Earth" .
<http://amr.isi.edu/entity-types#planet> a ns1:NamedEntity .
ns1:NamedEntity a ns1:Concept ;
rdfs:label "AMR-EntityType",
"AMR-Term" .
The sun is a star.
Earth is a planet.
\ No newline at end of file
......@@ -25,6 +25,7 @@ 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_filepath = f'{INPUT_DIR_PATH}{input_filename}'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment