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

Add main method to parse a document string

parent 473e2498
No related branches found
No related tags found
No related merge requests found
Showing
with 348 additions and 45 deletions
...@@ -5,3 +5,4 @@ sys.path.insert(0, os.path.abspath(LIB_PATH)) ...@@ -5,3 +5,4 @@ sys.path.insert(0, os.path.abspath(LIB_PATH))
# -- Main Method(s) # -- Main Method(s)
from amrbatch.main import parse_document_file_to_produce_amr_graph from amrbatch.main import parse_document_file_to_produce_amr_graph
from amrbatch.main import parse_document_string_to_produce_amr_graph
...@@ -26,11 +26,21 @@ class FilepathManager: ...@@ -26,11 +26,21 @@ class FilepathManager:
# Constructor # Constructor
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
def __init__(self, input_filepath, output_dirpath=None): def __init__(self, base_reference=None, input_filepath=None, output_dirpath=None):
if base_reference is None:
if input_filepath is None:
self.base_reference = f'document'
else:
self.base_reference = os.path.splitext(os.path.basename(input_filepath))[0] self.base_reference = os.path.splitext(os.path.basename(input_filepath))[0]
else:
self.base_reference = base_reference
self.input_filepath = input_filepath self.input_filepath = input_filepath
if input_filepath is None:
self.input_dirpath = os.getcwd()
else:
self.input_dirpath = f'{os.path.dirname(input_filepath)}/' self.input_dirpath = f'{os.path.dirname(input_filepath)}/'
if output_dirpath is None: if output_dirpath is None:
......
...@@ -46,16 +46,13 @@ def __is_valid_sentence(sentence): ...@@ -46,16 +46,13 @@ def __is_valid_sentence(sentence):
return not (is_empty | is_language_mark) return not (is_empty | is_language_mark)
def __prepare_workdata(filepath_manager): def __prepare_workdata(filepath_manager, line_set):
logger.info('-- Reading input files to recover a list of sentences') logger.info('-- Reading input line set to recover a list of work data')
input_filepath = filepath_manager.input_filepath
base_reference = filepath_manager.base_reference
workdata_list = list() workdata_list = list()
sentence_number = 0 sentence_number = 0
with open(input_filepath, "r") as reading_file: # r = read for line in line_set:
for line in reading_file.readlines():
sentences = line.split(". ") sentences = line.split(". ")
for sentence in sentences: for sentence in sentences:
if __is_valid_sentence(sentence): if __is_valid_sentence(sentence):
...@@ -189,22 +186,23 @@ def __serialize_amr_graph_to_amr_rdf(filepath_manager, data): ...@@ -189,22 +186,23 @@ def __serialize_amr_graph_to_amr_rdf(filepath_manager, data):
# Main Method(s) # Main Method(s)
#============================================================================== #==============================================================================
def parse_document_file_to_produce_amr_graph( def __analyze_line_set_to_produce_amr_graphs(line_set, data_reference, amr_model_path,
input_filepath, amr_model_path, output_dirpath=None, amrld_serialization=False): input_filepath=None, output_dirpath=None,
amrld_serialization=False):
""" """
Method to parse an input file containing natural language sentences and Method to analyze a list of work data (NL sentence and some useful data) and
construct the corresponding AMR graphs (and their RDF serializations if required). construct the corresponding AMR graphs (and their RDF serializations if required).
The method returns an AMR graph string in PENMAN format. AMR graphs are also The method returns an AMR graph string in PENMAN format. AMR graphs are also
serialized in RDF turtle format using the AMR-LD library if required serialized in RDF turtle format using the AMR-LD library if required.
(by defining turtle_output_file_path as parameter).
Parameters Parameters
---------- ----------
line_set: a set of string line.
data_reference: reference (base identifier) need to name output data.
amr_model_path: a path of AMR model needed for sentence conversion.
input_filepath: a path to a text file. input_filepath: a path to a text file.
output_dirpath: a directory path where the output data are written if defined (the function still outputs the string). output_dirpath: a directory path where the output data are written if defined (the function still outputs the string).
turtle_output_file_path: a file path where the output AMRLD representation is written in TURTLE format if defined. amrld_serialization: AMR-LD serialization request (serialization performed if true).
technical_dir_path: a dir path where some technical and log files are written if defined.
Returns Returns
------- -------
...@@ -212,16 +210,16 @@ def parse_document_file_to_produce_amr_graph( ...@@ -212,16 +210,16 @@ def parse_document_file_to_produce_amr_graph(
""" """
logger.info('[AMR Batch] NL Document Parsing')
# -- Prepare the sentences to be converted
logger.info('\n === Preparation === ') logger.info('\n === Preparation === ')
filepath_manager = FilepathManager(input_filepath, output_dirpath)
# -- Initialize a filepath manager
filepath_manager = FilepathManager(data_reference, input_filepath, output_dirpath)
logger.info(f'-- base reference: {filepath_manager.base_reference}') logger.info(f'-- base reference: {filepath_manager.base_reference}')
logger.info(f'-- input filepath: {filepath_manager.input_filepath}') logger.info(f'-- input filepath: {filepath_manager.input_filepath}')
logger.info(f'-- output dirpath: {filepath_manager.output_dirpath}') logger.info(f'-- output dirpath: {filepath_manager.output_dirpath}')
assert os.path.exists(input_filepath), f'input file does not exists ({input_filepath})'
workdata_list = __prepare_workdata(filepath_manager) # -- Prepare sentences to be converted
workdata_list = __prepare_workdata(filepath_manager, line_set)
__build_output_dir_tree(filepath_manager, workdata_list) __build_output_dir_tree(filepath_manager, workdata_list)
__generate_sentence_file(filepath_manager, workdata_list) __generate_sentence_file(filepath_manager, workdata_list)
...@@ -248,3 +246,83 @@ def parse_document_file_to_produce_amr_graph( ...@@ -248,3 +246,83 @@ def parse_document_file_to_produce_amr_graph(
return amr_graph_list return amr_graph_list
def parse_document_file_to_produce_amr_graph(
input_filepath, amr_model_path, output_dirpath=None, amrld_serialization=False):
"""
Method to parse an input file containing natural language sentences and
construct the corresponding AMR graphs (and their RDF serializations if required).
The method returns an AMR graph string in PENMAN format. AMR graphs are also
serialized in RDF turtle format using the AMR-LD library if required
(by defining turtle_output_file_path as parameter).
Parameters
----------
input_filepath: a path to a text file.
amr_model_path: a path of AMR model needed for sentence conversion.
output_dirpath: a directory path where the output data are written if defined (the function still outputs the string).
amrld_serialization: AMR-LD serialization request (serialization performed if true).
Returns
-------
AMR Graph String (in PENMAN format).
"""
logger.info('[AMR Batch] NL Document Parsing')
# -- Reading file to get a set of string line
logger.info('\n === Reading input file === ')
assert os.path.exists(input_filepath), f'input file does not exists ({input_filepath})'
with open(input_filepath, "r") as reading_file: # r = read
line_set = reading_file.readlines()
logger.info(f'-- line number: {len(line_set)}')
amr_graph_list = __analyze_line_set_to_produce_amr_graphs(
line_set, None, amr_model_path, input_filepath, output_dirpath, amrld_serialization)
return amr_graph_list
def parse_document_string_to_produce_amr_graph(
input_string, data_reference, amr_model_path, output_dirpath=None, amrld_serialization=False):
"""
Method to parse an input file containing natural language sentences and
construct the corresponding AMR graphs (and their RDF serializations if required).
The method returns an AMR graph string in PENMAN format. AMR graphs are also
serialized in RDF turtle format using the AMR-LD library if required
(by defining turtle_output_file_path as parameter).
Parameters
----------
input_string: a string to parse.
data_reference: reference (base identifier) need to name output data.
amr_model_path: a path of AMR model needed for sentence conversion.
output_dirpath: a directory path where the output data are written if defined (the function still outputs the string).
amrld_serialization: AMR-LD serialization request (serialization performed if true).
Returns
-------
AMR Graph String (in PENMAN format).
"""
logger.info('[AMR Batch] NL Document Parsing')
# -- Reading file to get a set of string line
logger.info('\n === Reading input string === ')
line_set = input_string.splitlines()
logger.info(f'-- line number: {len(line_set)}')
amr_graph_list = __analyze_line_set_to_produce_amr_graphs(
line_set,
data_reference,
amr_model_path,
input_filepath=None,
output_dirpath=output_dirpath,
amrld_serialization=amrld_serialization)
return amr_graph_list
- INFO - [AMR Batch] NL Document Parsing - INFO - [AMR Batch] NL Document Parsing
- INFO -
=== Reading input file ===
- INFO - -- line number: 1
- INFO - - INFO -
=== Preparation === === Preparation ===
- INFO - -- base reference: test - INFO - -- base reference: test
- INFO - -- input filepath: /home/lamenji/Workspace/Tetras/amrbatch/tests/input/test.txt - INFO - -- input filepath: /home/lamenji/Workspace/Tetras/amrbatch/tests/input/test.txt
- INFO - -- output dirpath: /home/lamenji/Workspace/Tetras/amrbatch/tests/output/Test-20230306/ - INFO - -- output dirpath: /home/lamenji/Workspace/Tetras/amrbatch/tests/output/Test-20230314/
- INFO - -- Reading input files to recover a list of sentences - INFO - -- Reading input line set to recover a list of work data
- DEBUG - *** sentence 1 *** - DEBUG - *** sentence 1 ***
<work_data.WorkData object at 0x7f2e2f30a740> <work_data.WorkData object at 0x7f5207109ba0>
- DEBUG - *** sentence 2 *** - DEBUG - *** sentence 2 ***
<work_data.WorkData object at 0x7f2e2f30bd00> <work_data.WorkData object at 0x7f52071087f0>
- INFO - ----- number of sentences: 2 - INFO - ----- number of sentences: 2
- DEBUG - -- Making output directory tree (/home/lamenji/Workspace/Tetras/amrbatch/tests/output/Test-20230306/) - DEBUG - -- Making output directory tree (/home/lamenji/Workspace/Tetras/amrbatch/tests/output/Test-20230314/)
- DEBUG - -- Generating sentence file - DEBUG - -- Generating sentence file
- INFO - - INFO -
=== Text Convert to AMR Graphs === === Text Convert to AMR Graphs ===
...@@ -36,14 +39,14 @@ ...@@ -36,14 +39,14 @@
- INFO - -- library: amrld - INFO - -- library: amrld
- DEBUG - (/home/lamenji/Workspace/Tetras/amrbatch/amrbatch/amrld/) - DEBUG - (/home/lamenji/Workspace/Tetras/amrbatch/amrbatch/amrld/)
- INFO - -- Serialize AMR graphs to RDF using amr-ld library - INFO - -- Serialize AMR graphs to RDF using amr-ld library
- DEBUG - ----- AMR filepath (penman): /home/lamenji/Workspace/Tetras/amrbatch/tests/output/Test-20230306/test-01/test-01.stog.amr.penman - 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-20230306/test-01/test-01.stog.amr.nt - 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-20230306/test-01/test-01.stog.amr.ttl - DEBUG - ----- AMR-RDF filepath (turtle): /home/lamenji/Workspace/Tetras/amrbatch/tests/output/Test-20230314/test-01/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.nt)
- INFO - ----- AMR-RDF triple successfully processed (test-01.stog.amr.ttl) - INFO - ----- AMR-RDF triple successfully processed (test-01.stog.amr.ttl)
- INFO - -- Serialize AMR graphs to RDF using amr-ld library - INFO - -- Serialize AMR graphs to RDF using amr-ld library
- DEBUG - ----- AMR filepath (penman): /home/lamenji/Workspace/Tetras/amrbatch/tests/output/Test-20230306/test-02/test-02.stog.amr.penman - 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-20230306/test-02/test-02.stog.amr.nt - 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-20230306/test-02/test-02.stog.amr.ttl - DEBUG - ----- AMR-RDF filepath (turtle): /home/lamenji/Workspace/Tetras/amrbatch/tests/output/Test-20230314/test-02/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.nt)
- INFO - ----- AMR-RDF triple successfully processed (test-02.stog.amr.ttl) - INFO - ----- AMR-RDF triple successfully processed (test-02.stog.amr.ttl)
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/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/document-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/rdf/core-amr#NamedEntity> <http://www.w3.org/2000/01/rdf-schema#label> "AMR-Term" .
<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/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/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/amr_data/document-01#s> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://amr.isi.edu/entity-types#star> .
<http://amr.isi.edu/amr_data/document-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/amr_data/document-01#root01> <http://amr.isi.edu/rdf/core-amr#has-id> "document-01" .
<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/frames/ld/v1.2.2/FrameRole> <http://www.w3.org/2000/01/rdf-schema#label> "AMR-PropBank-Role" .
<http://amr.isi.edu/amr_data/document-01#root01> <http://amr.isi.edu/rdf/core-amr#root> <http://amr.isi.edu/amr_data/document-01#s> .
<http://amr.isi.edu/amr_data/document-01#s> <http://amr.isi.edu/rdf/amr-terms#domain> <http://amr.isi.edu/amr_data/document-01#s2> .
<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-EntityType" .
<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/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/document-01#root01> <http://amr.isi.edu/rdf/core-amr#has-sentence> "The sun is a 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/amr-terms#domain> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://amr.isi.edu/rdf/core-amr#Role> .
# ::id document-01
# ::snt The sun is a star.
(s / star
:domain (s2 / sun))
\ No newline at end of file
tests/output/Test-20230314/document-01/document-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/document-01#root01> a ns1:AMR ;
ns1:has-id "document-01" ;
ns1:has-sentence "The sun is a star." ;
ns1:root <http://amr.isi.edu/amr_data/document-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/document-01#s> a <http://amr.isi.edu/entity-types#star> ;
ns2:domain <http://amr.isi.edu/amr_data/document-01#s2> .
<http://amr.isi.edu/amr_data/document-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]
p2 [label="p2/planet" shape=circle]
n [label="n/name" shape=circle]
p -> p2 [label=":domain"]
p2 -> 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/amr_data/document-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/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/amr_data/document-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/document-02#p2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://amr.isi.edu/entity-types#planet> .
<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/amr_data/document-02#root01> <http://amr.isi.edu/rdf/core-amr#root> <http://amr.isi.edu/amr_data/document-02#p> .
<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/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/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/document-02#p> <http://amr.isi.edu/rdf/amr-terms#domain> <http://amr.isi.edu/amr_data/document-02#p2> .
<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/document-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/rdf/core-amr#NamedEntity> <http://www.w3.org/2000/01/rdf-schema#label> "AMR-Term" .
<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/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/amr_data/document-02#root01> <http://amr.isi.edu/rdf/core-amr#has-id> "document-02" .
<http://amr.isi.edu/amr_data/document-02#p2> <http://www.w3.org/2000/01/rdf-schema#label> "Earth" .
<http://amr.isi.edu/frames/ld/v1.2.2/FrameRole> <http://www.w3.org/2000/01/rdf-schema#label> "AMR-PropBank-Role" .
# ::id document-02
# ::snt Earth is a planet..
(p / planet
:domain (p2 / planet
:name (n / name
:op1 "Earth")))
\ No newline at end of file
tests/output/Test-20230314/document-02/document-02.stog.amr.png

21.7 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/document-02#root01> a ns1:AMR ;
ns1:has-id "document-02" ;
ns1:has-sentence "Earth is a planet.." ;
ns1:root <http://amr.isi.edu/amr_data/document-02#p> .
<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/document-02#p> a <http://amr.isi.edu/entity-types#planet> ;
ns2:domain <http://amr.isi.edu/amr_data/document-02#p2> .
<http://amr.isi.edu/amr_data/document-02#p2> a <http://amr.isi.edu/entity-types#planet> ;
rdfs:label "Earth" .
ns1:NamedEntity a ns1:Concept ;
rdfs:label "AMR-EntityType",
"AMR-Term" .
<http://amr.isi.edu/entity-types#planet> a ns1:NamedEntity .
The sun is a star.
Earth is a planet..
\ No newline at end of file
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/core-amr#NamedEntity> <http://www.w3.org/2000/01/rdf-schema#label> "AMR-EntityType" .
<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/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#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#Role> <http://www.w3.org/2000/01/rdf-schema#label> "AMR-Role" .
<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/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/1999/02/22-rdf-syntax-ns#type> <http://amr.isi.edu/rdf/core-amr#Concept> .
<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://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#root> <http://amr.isi.edu/amr_data/test-01#s> .
<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/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/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/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/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/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#NamedEntity> <http://www.w3.org/2000/01/rdf-schema#label> "AMR-Term" .
<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/amr_data/test-01#root01> <http://amr.isi.edu/rdf/core-amr#has-id> "test-01" .
<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> .
# ::id test-01
# ::snt The sun is a star.
(s / star
:domain (s2 / sun))
\ No newline at end of file
tests/output/Test-20230314/test-01/test-01.stog.amr.png

11.4 KiB

@prefix ns1: <http://amr.isi.edu/rdf/amr-terms#> .
@prefix ns2: <http://amr.isi.edu/rdf/core-amr#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
ns2:Concept a rdfs:Class ;
rdfs:label "AMR-Concept" .
ns2:Role a rdfs:Class ;
rdfs:label "AMR-Role" .
<http://amr.isi.edu/amr_data/test-01#root01> a ns2:AMR ;
ns2:has-id "test-01" ;
ns2:has-sentence "The sun is a star." ;
ns2:root <http://amr.isi.edu/amr_data/test-01#s> .
<http://amr.isi.edu/frames/ld/v1.2.2/FrameRole> a ns2:Role ;
rdfs:label "AMR-PropBank-Role" .
ns1:domain a ns2:Role .
ns2:Frame a ns2:Concept ;
rdfs:label "AMR-PropBank-Frame" .
<http://amr.isi.edu/amr_data/test-01#s> a <http://amr.isi.edu/entity-types#star> ;
ns1:domain <http://amr.isi.edu/amr_data/test-01#s2> .
<http://amr.isi.edu/amr_data/test-01#s2> a ns1:sun .
<http://amr.isi.edu/entity-types#star> a ns2:NamedEntity .
ns1:sun a ns2:Concept .
ns2:NamedEntity a ns2:Concept ;
rdfs:label "AMR-EntityType",
"AMR-Term" .
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment