diff --git a/amrbatch/__init__.py b/amrbatch/__init__.py index 4727364e008046e454306c13851896154d97df8d..a00df4ac495211fe24efb90a9e647fdf1973737a 100644 --- a/amrbatch/__init__.py +++ b/amrbatch/__init__.py @@ -5,3 +5,4 @@ sys.path.insert(0, os.path.abspath(LIB_PATH)) # -- Main Method(s) from amrbatch.main import parse_document_file_to_produce_amr_graph +from amrbatch.main import parse_document_string_to_produce_amr_graph diff --git a/amrbatch/filepath_manager.py b/amrbatch/filepath_manager.py index fbddba3d3caef3386277dec4348f85987dbce89a..282fcdc049938efb090fc3a58f1c37a33ec9e0af 100644 --- a/amrbatch/filepath_manager.py +++ b/amrbatch/filepath_manager.py @@ -26,12 +26,22 @@ class FilepathManager: # Constructor #-------------------------------------------------------------------------- - def __init__(self, input_filepath, output_dirpath=None): + def __init__(self, base_reference=None, input_filepath=None, output_dirpath=None): - self.base_reference = os.path.splitext(os.path.basename(input_filepath))[0] + 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] + else: + self.base_reference = base_reference self.input_filepath = input_filepath - self.input_dirpath = f'{os.path.dirname(input_filepath)}/' + + if input_filepath is None: + self.input_dirpath = os.getcwd() + else: + self.input_dirpath = f'{os.path.dirname(input_filepath)}/' if output_dirpath is None: self.output_dirpath = self.input_dirpath diff --git a/amrbatch/main.py b/amrbatch/main.py index f1de389c026d42baf5d8b8a1a71b213a7b458402..b9dce1d42a0427cb6b9bc44f060d4cdbbf9736b1 100644 --- a/amrbatch/main.py +++ b/amrbatch/main.py @@ -46,23 +46,20 @@ def __is_valid_sentence(sentence): return not (is_empty | is_language_mark) -def __prepare_workdata(filepath_manager): - logger.info('-- Reading input files to recover a list of sentences') - input_filepath = filepath_manager.input_filepath - base_reference = filepath_manager.base_reference +def __prepare_workdata(filepath_manager, line_set): + logger.info('-- Reading input line set to recover a list of work data') workdata_list = list() sentence_number = 0 - with open(input_filepath, "r") as reading_file: # r = read - for line in reading_file.readlines(): - sentences = line.split(". ") - for sentence in sentences: - if __is_valid_sentence(sentence): - sentence_number += 1 - new_data = WorkData(sentence, sentence_number, filepath_manager) - workdata_list.append(new_data) - logger.debug(f' *** sentence {sentence_number} *** \n{new_data}') + for line in line_set: + sentences = line.split(". ") + for sentence in sentences: + if __is_valid_sentence(sentence): + sentence_number += 1 + new_data = WorkData(sentence, sentence_number, filepath_manager) + workdata_list.append(new_data) + logger.debug(f' *** sentence {sentence_number} *** \n{new_data}') logger.info(f'----- number of sentences: {len(workdata_list)}') return workdata_list @@ -189,42 +186,43 @@ def __serialize_amr_graph_to_amr_rdf(filepath_manager, data): # Main Method(s) #============================================================================== -def parse_document_file_to_produce_amr_graph( - input_filepath, amr_model_path, output_dirpath=None, amrld_serialization=False): +def __analyze_line_set_to_produce_amr_graphs(line_set, data_reference, amr_model_path, + 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). 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). + serialized in RDF turtle format using the AMR-LD library if required. - Parameters ---------- - input_filepath: a path to a text file. + 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. 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. - technical_dir_path: a dir path where some technical and log files are written if defined. + amrld_serialization: AMR-LD serialization request (serialization performed if true). Returns ------- AMR Graph String (in PENMAN format). """ - - logger.info('[AMR Batch] NL Document Parsing') - - # -- Prepare the sentences to be converted + 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'-- input filepath: {filepath_manager.input_filepath}') - 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) + logger.info(f'-- output dirpath: {filepath_manager.output_dirpath}') + + # -- Prepare sentences to be converted + workdata_list = __prepare_workdata(filepath_manager, line_set) __build_output_dir_tree(filepath_manager, workdata_list) __generate_sentence_file(filepath_manager, workdata_list) - + # -- Convert sentences to graphs logger.info('\n === Text Convert to AMR Graphs === ') logger.info(f'-- library: amrlib') @@ -247,4 +245,84 @@ def parse_document_file_to_produce_amr_graph( if workdata.graph != "": amr_graph_list.append(workdata.graph) 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 diff --git a/tests/amrbatch.log b/tests/amrbatch.log index a8ae492e043f223eb3dd6359da92f487cf5c674c..da46843a132cd41a97b2d249890ad3c77c469033 100644 --- a/tests/amrbatch.log +++ b/tests/amrbatch.log @@ -1,16 +1,19 @@ - INFO - [AMR Batch] NL Document Parsing +- INFO - + === Reading input file === +- INFO - -- line number: 1 - INFO - === 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-20230306/ -- INFO - -- Reading input files to recover a list of sentences +- INFO - -- output dirpath: /home/lamenji/Workspace/Tetras/amrbatch/tests/output/Test-20230314/ +- INFO - -- Reading input line set to recover a list of work data - DEBUG - *** sentence 1 *** -<work_data.WorkData object at 0x7f2e2f30a740> +<work_data.WorkData object at 0x7f5207109ba0> - DEBUG - *** sentence 2 *** -<work_data.WorkData object at 0x7f2e2f30bd00> +<work_data.WorkData object at 0x7f52071087f0> - 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 - INFO - === Text Convert to AMR Graphs === @@ -36,14 +39,14 @@ - 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-20230306/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 (turtle): /home/lamenji/Workspace/Tetras/amrbatch/tests/output/Test-20230306/test-01/test-01.stog.amr.ttl +- 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-RDF triple successfully processed (test-01.stog.amr.nt) - INFO - ----- AMR-RDF triple 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-20230306/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 (turtle): /home/lamenji/Workspace/Tetras/amrbatch/tests/output/Test-20230306/test-02/test-02.stog.amr.ttl +- 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-RDF triple successfully processed (test-02.stog.amr.nt) - INFO - ----- AMR-RDF triple successfully processed (test-02.stog.amr.ttl) diff --git a/tests/output/Test-20230314/document-01/document-01.stog.amr.dot b/tests/output/Test-20230314/document-01/document-01.stog.amr.dot new file mode 100644 index 0000000000000000000000000000000000000000..57af646621c9fcf8287fa241ef25aaaabbc02d89 --- /dev/null +++ b/tests/output/Test-20230314/document-01/document-01.stog.amr.dot @@ -0,0 +1,6 @@ +digraph amr_graph { + rankdir=LR size="12,8" + s [label="s/star" shape=circle] + s2 [label="s2/sun" shape=circle] + s -> s2 [label=":domain"] +} diff --git a/tests/output/Test-20230314/document-01/document-01.stog.amr.nt b/tests/output/Test-20230314/document-01/document-01.stog.amr.nt new file mode 100644 index 0000000000000000000000000000000000000000..861bf6aee99b4b774ce9970b7cb07c73c4fb55cc --- /dev/null +++ b/tests/output/Test-20230314/document-01/document-01.stog.amr.nt @@ -0,0 +1,22 @@ +<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> . + diff --git a/tests/output/Test-20230314/document-01/document-01.stog.amr.penman b/tests/output/Test-20230314/document-01/document-01.stog.amr.penman new file mode 100644 index 0000000000000000000000000000000000000000..73abbe817a6c187efde1a633e485a7712b22e590 --- /dev/null +++ b/tests/output/Test-20230314/document-01/document-01.stog.amr.penman @@ -0,0 +1,4 @@ +# ::id document-01 +# ::snt The sun is a star. +(s / star + :domain (s2 / sun)) \ No newline at end of file diff --git a/tests/output/Test-20230314/document-01/document-01.stog.amr.png b/tests/output/Test-20230314/document-01/document-01.stog.amr.png new file mode 100644 index 0000000000000000000000000000000000000000..1184e154c13d623631e31e54b8ebd114be61aca3 Binary files /dev/null and b/tests/output/Test-20230314/document-01/document-01.stog.amr.png differ diff --git a/tests/output/Test-20230314/document-01/document-01.stog.amr.ttl b/tests/output/Test-20230314/document-01/document-01.stog.amr.ttl new file mode 100644 index 0000000000000000000000000000000000000000..751dd61a8b9a5a3a339cdbd811a3077875c81737 --- /dev/null +++ b/tests/output/Test-20230314/document-01/document-01.stog.amr.ttl @@ -0,0 +1,36 @@ +@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" . + diff --git a/tests/output/Test-20230314/document-02/document-02.stog.amr.dot b/tests/output/Test-20230314/document-02/document-02.stog.amr.dot new file mode 100644 index 0000000000000000000000000000000000000000..2c5b47f3f6f7beeacba322b954adc2c5d16ca3b5 --- /dev/null +++ b/tests/output/Test-20230314/document-02/document-02.stog.amr.dot @@ -0,0 +1,10 @@ +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"] +} diff --git a/tests/output/Test-20230314/document-02/document-02.stog.amr.nt b/tests/output/Test-20230314/document-02/document-02.stog.amr.nt new file mode 100644 index 0000000000000000000000000000000000000000..530ba242545ca3078c8f8a2462fb7abc1fe8b3b0 --- /dev/null +++ b/tests/output/Test-20230314/document-02/document-02.stog.amr.nt @@ -0,0 +1,22 @@ +<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" . + diff --git a/tests/output/Test-20230314/document-02/document-02.stog.amr.penman b/tests/output/Test-20230314/document-02/document-02.stog.amr.penman new file mode 100644 index 0000000000000000000000000000000000000000..efec122d6eeab238ade012c81dc8ef986897acfa --- /dev/null +++ b/tests/output/Test-20230314/document-02/document-02.stog.amr.penman @@ -0,0 +1,6 @@ +# ::id document-02 +# ::snt Earth is a planet.. +(p / planet + :domain (p2 / planet + :name (n / name + :op1 "Earth"))) \ No newline at end of file diff --git a/tests/output/Test-20230314/document-02/document-02.stog.amr.png b/tests/output/Test-20230314/document-02/document-02.stog.amr.png new file mode 100644 index 0000000000000000000000000000000000000000..d5c70b857806b147b43dde98d6b12058b7d6ac5c Binary files /dev/null and b/tests/output/Test-20230314/document-02/document-02.stog.amr.png differ diff --git a/tests/output/Test-20230314/document-02/document-02.stog.amr.ttl b/tests/output/Test-20230314/document-02/document-02.stog.amr.ttl new file mode 100644 index 0000000000000000000000000000000000000000..350243010560325fad6dcb9ad2df22e11a29e7e2 --- /dev/null +++ b/tests/output/Test-20230314/document-02/document-02.stog.amr.ttl @@ -0,0 +1,35 @@ +@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 . + diff --git a/tests/output/Test-20230314/document.sentence.txt b/tests/output/Test-20230314/document.sentence.txt new file mode 100644 index 0000000000000000000000000000000000000000..e62c956fd0e60ea52342b36c5d3070247e1f8ad5 --- /dev/null +++ b/tests/output/Test-20230314/document.sentence.txt @@ -0,0 +1,2 @@ +The sun is a star. +Earth is a planet.. \ No newline at end of file diff --git a/tests/output/Test-20230314/test-01/test-01.stog.amr.dot b/tests/output/Test-20230314/test-01/test-01.stog.amr.dot new file mode 100644 index 0000000000000000000000000000000000000000..57af646621c9fcf8287fa241ef25aaaabbc02d89 --- /dev/null +++ b/tests/output/Test-20230314/test-01/test-01.stog.amr.dot @@ -0,0 +1,6 @@ +digraph amr_graph { + rankdir=LR size="12,8" + s [label="s/star" shape=circle] + s2 [label="s2/sun" shape=circle] + s -> s2 [label=":domain"] +} diff --git a/tests/output/Test-20230314/test-01/test-01.stog.amr.nt b/tests/output/Test-20230314/test-01/test-01.stog.amr.nt new file mode 100644 index 0000000000000000000000000000000000000000..cfb1bd713cffeff8fe85141fcb404090e4ad5677 --- /dev/null +++ b/tests/output/Test-20230314/test-01/test-01.stog.amr.nt @@ -0,0 +1,22 @@ +<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> . + diff --git a/tests/output/Test-20230314/test-01/test-01.stog.amr.penman b/tests/output/Test-20230314/test-01/test-01.stog.amr.penman new file mode 100644 index 0000000000000000000000000000000000000000..4f70746db54a3ed8171f776190e3724f2e5c775b --- /dev/null +++ b/tests/output/Test-20230314/test-01/test-01.stog.amr.penman @@ -0,0 +1,4 @@ +# ::id test-01 +# ::snt The sun is a star. +(s / star + :domain (s2 / sun)) \ No newline at end of file diff --git a/tests/output/Test-20230314/test-01/test-01.stog.amr.png b/tests/output/Test-20230314/test-01/test-01.stog.amr.png new file mode 100644 index 0000000000000000000000000000000000000000..1184e154c13d623631e31e54b8ebd114be61aca3 Binary files /dev/null and b/tests/output/Test-20230314/test-01/test-01.stog.amr.png differ diff --git a/tests/output/Test-20230314/test-01/test-01.stog.amr.ttl b/tests/output/Test-20230314/test-01/test-01.stog.amr.ttl new file mode 100644 index 0000000000000000000000000000000000000000..85be531dc6867ee85a21e5f3b46fa0dfe6febc95 --- /dev/null +++ b/tests/output/Test-20230314/test-01/test-01.stog.amr.ttl @@ -0,0 +1,36 @@ +@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" . + diff --git a/tests/output/Test-20230314/test-02/test-02.stog.amr.dot b/tests/output/Test-20230314/test-02/test-02.stog.amr.dot new file mode 100644 index 0000000000000000000000000000000000000000..1b8f97f75734288ff356faf5c09ba53a14141181 --- /dev/null +++ b/tests/output/Test-20230314/test-02/test-02.stog.amr.dot @@ -0,0 +1,9 @@ +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"] +} diff --git a/tests/output/Test-20230314/test-02/test-02.stog.amr.nt b/tests/output/Test-20230314/test-02/test-02.stog.amr.nt new file mode 100644 index 0000000000000000000000000000000000000000..b600543cd0a67aea892f9f1e604e3e583387ef86 --- /dev/null +++ b/tests/output/Test-20230314/test-02/test-02.stog.amr.nt @@ -0,0 +1,19 @@ +<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#Frame> <http://www.w3.org/2000/01/rdf-schema#label> "AMR-PropBank-Frame" . +<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#Concept> <http://www.w3.org/2000/01/rdf-schema#label> "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/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/rdf/core-amr#NamedEntity> <http://www.w3.org/2000/01/rdf-schema#label> "AMR-EntityType" . +<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#p> <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" . +<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/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/2000/01/rdf-schema#label> "AMR-Term" . +<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#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#Role> <http://www.w3.org/2000/01/rdf-schema#label> "AMR-Role" . +<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> . + diff --git a/tests/output/Test-20230314/test-02/test-02.stog.amr.penman b/tests/output/Test-20230314/test-02/test-02.stog.amr.penman new file mode 100644 index 0000000000000000000000000000000000000000..c43f2d1ea1775db6a372176df904adb4c732bc8a --- /dev/null +++ b/tests/output/Test-20230314/test-02/test-02.stog.amr.penman @@ -0,0 +1,6 @@ +# ::id test-02 +# ::snt Earth is a planet. +(p / planet + :domain p + :name (n / name + :op1 "Earth")) \ No newline at end of file diff --git a/tests/output/Test-20230314/test-02/test-02.stog.amr.png b/tests/output/Test-20230314/test-02/test-02.stog.amr.png new file mode 100644 index 0000000000000000000000000000000000000000..ccf17ae6265b900965bce09be359fa5500c2400f Binary files /dev/null and b/tests/output/Test-20230314/test-02/test-02.stog.amr.png differ diff --git a/tests/output/Test-20230314/test-02/test-02.stog.amr.ttl b/tests/output/Test-20230314/test-02/test-02.stog.amr.ttl new file mode 100644 index 0000000000000000000000000000000000000000..5f7d3d7f4e8bf37c29f7290956a19a621f90a03e --- /dev/null +++ b/tests/output/Test-20230314/test-02/test-02.stog.amr.ttl @@ -0,0 +1,29 @@ +@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" . + diff --git a/tests/output/Test-20230314/test.sentence.txt b/tests/output/Test-20230314/test.sentence.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bc85c3e85f9bf78d9d521ab35bd1ff85b3588c8 --- /dev/null +++ b/tests/output/Test-20230314/test.sentence.txt @@ -0,0 +1,2 @@ +The sun is a star. +Earth is a planet. \ No newline at end of file diff --git a/tests/output/Test-20230314/testReference-01/testReference-01.stog.amr.dot b/tests/output/Test-20230314/testReference-01/testReference-01.stog.amr.dot new file mode 100644 index 0000000000000000000000000000000000000000..57af646621c9fcf8287fa241ef25aaaabbc02d89 --- /dev/null +++ b/tests/output/Test-20230314/testReference-01/testReference-01.stog.amr.dot @@ -0,0 +1,6 @@ +digraph amr_graph { + rankdir=LR size="12,8" + s [label="s/star" shape=circle] + s2 [label="s2/sun" shape=circle] + s -> s2 [label=":domain"] +} diff --git a/tests/output/Test-20230314/testReference-01/testReference-01.stog.amr.nt b/tests/output/Test-20230314/testReference-01/testReference-01.stog.amr.nt new file mode 100644 index 0000000000000000000000000000000000000000..c3de70ca51b40a8773cdb83accdfaa7070d99eee --- /dev/null +++ b/tests/output/Test-20230314/testReference-01/testReference-01.stog.amr.nt @@ -0,0 +1,22 @@ +<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#NamedEntity> <http://www.w3.org/2000/01/rdf-schema#label> "AMR-EntityType" . +<http://amr.isi.edu/amr_data/testReference-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/amr_data/testReference-01#s> <http://amr.isi.edu/rdf/amr-terms#domain> <http://amr.isi.edu/amr_data/testReference-01#s2> . +<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/testReference-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/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/core-amr#NamedEntity> <http://www.w3.org/2000/01/rdf-schema#label> "AMR-Term" . +<http://amr.isi.edu/amr_data/testReference-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/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#Role> <http://www.w3.org/2000/01/rdf-schema#label> "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/testReference-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/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/testReference-01#root01> <http://amr.isi.edu/rdf/core-amr#has-id> "testReference-01" . +<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/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/rdf/core-amr#Concept> <http://www.w3.org/2000/01/rdf-schema#label> "AMR-Concept" . +<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/testReference-01#root01> <http://amr.isi.edu/rdf/core-amr#root> <http://amr.isi.edu/amr_data/testReference-01#s> . + diff --git a/tests/output/Test-20230314/testReference-01/testReference-01.stog.amr.penman b/tests/output/Test-20230314/testReference-01/testReference-01.stog.amr.penman new file mode 100644 index 0000000000000000000000000000000000000000..ce859873bc176b3d5c5e39409bebfc835dd370b7 --- /dev/null +++ b/tests/output/Test-20230314/testReference-01/testReference-01.stog.amr.penman @@ -0,0 +1,4 @@ +# ::id testReference-01 +# ::snt The sun is a star. +(s / star + :domain (s2 / sun)) \ No newline at end of file diff --git a/tests/output/Test-20230314/testReference-01/testReference-01.stog.amr.png b/tests/output/Test-20230314/testReference-01/testReference-01.stog.amr.png new file mode 100644 index 0000000000000000000000000000000000000000..1184e154c13d623631e31e54b8ebd114be61aca3 Binary files /dev/null and b/tests/output/Test-20230314/testReference-01/testReference-01.stog.amr.png differ diff --git a/tests/output/Test-20230314/testReference-01/testReference-01.stog.amr.ttl b/tests/output/Test-20230314/testReference-01/testReference-01.stog.amr.ttl new file mode 100644 index 0000000000000000000000000000000000000000..9467d1f3308e77bc117d051178c572e684640cbd --- /dev/null +++ b/tests/output/Test-20230314/testReference-01/testReference-01.stog.amr.ttl @@ -0,0 +1,36 @@ +@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/testReference-01#root01> a ns2:AMR ; + ns2:has-id "testReference-01" ; + ns2:has-sentence "The sun is a star." ; + ns2:root <http://amr.isi.edu/amr_data/testReference-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/testReference-01#s> a <http://amr.isi.edu/entity-types#star> ; + ns1:domain <http://amr.isi.edu/amr_data/testReference-01#s2> . + +<http://amr.isi.edu/amr_data/testReference-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" . + diff --git a/tests/output/Test-20230314/testReference-02/testReference-02.stog.amr.dot b/tests/output/Test-20230314/testReference-02/testReference-02.stog.amr.dot new file mode 100644 index 0000000000000000000000000000000000000000..2c5b47f3f6f7beeacba322b954adc2c5d16ca3b5 --- /dev/null +++ b/tests/output/Test-20230314/testReference-02/testReference-02.stog.amr.dot @@ -0,0 +1,10 @@ +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"] +} diff --git a/tests/output/Test-20230314/testReference-02/testReference-02.stog.amr.nt b/tests/output/Test-20230314/testReference-02/testReference-02.stog.amr.nt new file mode 100644 index 0000000000000000000000000000000000000000..c1b533053c261e8f30c02538da09bf4ad69ce80e --- /dev/null +++ b/tests/output/Test-20230314/testReference-02/testReference-02.stog.amr.nt @@ -0,0 +1,22 @@ +<http://amr.isi.edu/amr_data/testReference-02#p2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://amr.isi.edu/entity-types#planet> . +<http://amr.isi.edu/amr_data/testReference-02#root01> <http://amr.isi.edu/rdf/core-amr#has-id> "testReference-02" . +<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/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/testReference-02#p> <http://amr.isi.edu/rdf/amr-terms#domain> <http://amr.isi.edu/amr_data/testReference-02#p2> . +<http://amr.isi.edu/amr_data/testReference-02#root01> <http://amr.isi.edu/rdf/core-amr#has-sentence> "Earth is a planet.." . +<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/testReference-02#p2> <http://www.w3.org/2000/01/rdf-schema#label> "Earth" . +<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/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/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#NamedEntity> <http://www.w3.org/2000/01/rdf-schema#label> "AMR-EntityType" . +<http://amr.isi.edu/amr_data/testReference-02#p> <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/rdf/core-amr#Role> <http://www.w3.org/2000/01/rdf-schema#label> "AMR-Role" . +<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/testReference-02#root01> <http://amr.isi.edu/rdf/core-amr#root> <http://amr.isi.edu/amr_data/testReference-02#p> . +<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/testReference-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#Role> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Class> . + diff --git a/tests/output/Test-20230314/testReference-02/testReference-02.stog.amr.penman b/tests/output/Test-20230314/testReference-02/testReference-02.stog.amr.penman new file mode 100644 index 0000000000000000000000000000000000000000..68dcf7701e3ed301b91bdef154dc9ca824560544 --- /dev/null +++ b/tests/output/Test-20230314/testReference-02/testReference-02.stog.amr.penman @@ -0,0 +1,6 @@ +# ::id testReference-02 +# ::snt Earth is a planet.. +(p / planet + :domain (p2 / planet + :name (n / name + :op1 "Earth"))) \ No newline at end of file diff --git a/tests/output/Test-20230314/testReference-02/testReference-02.stog.amr.png b/tests/output/Test-20230314/testReference-02/testReference-02.stog.amr.png new file mode 100644 index 0000000000000000000000000000000000000000..d5c70b857806b147b43dde98d6b12058b7d6ac5c Binary files /dev/null and b/tests/output/Test-20230314/testReference-02/testReference-02.stog.amr.png differ diff --git a/tests/output/Test-20230314/testReference-02/testReference-02.stog.amr.ttl b/tests/output/Test-20230314/testReference-02/testReference-02.stog.amr.ttl new file mode 100644 index 0000000000000000000000000000000000000000..36d68884b164b959ee29d2e555c18ab36c97b4dd --- /dev/null +++ b/tests/output/Test-20230314/testReference-02/testReference-02.stog.amr.ttl @@ -0,0 +1,35 @@ +@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/testReference-02#root01> a ns1:AMR ; + ns1:has-id "testReference-02" ; + ns1:has-sentence "Earth is a planet.." ; + ns1:root <http://amr.isi.edu/amr_data/testReference-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/testReference-02#p> a <http://amr.isi.edu/entity-types#planet> ; + ns2:domain <http://amr.isi.edu/amr_data/testReference-02#p2> . + +<http://amr.isi.edu/amr_data/testReference-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 . + diff --git a/tests/output/Test-20230314/testReference.sentence.txt b/tests/output/Test-20230314/testReference.sentence.txt new file mode 100644 index 0000000000000000000000000000000000000000..e62c956fd0e60ea52342b36c5d3070247e1f8ad5 --- /dev/null +++ b/tests/output/Test-20230314/testReference.sentence.txt @@ -0,0 +1,2 @@ +The sun is a star. +Earth is a planet.. \ No newline at end of file diff --git a/tests/test_amrbatch_main.py b/tests/test_amrbatch_main.py index 4a58a08a6b803b12df3fdf9a0848bc5cc7d7ff06..bdf06f4cfad5beab99c33bec8e7f84c8ddb70dbc 100644 --- a/tests/test_amrbatch_main.py +++ b/tests/test_amrbatch_main.py @@ -59,4 +59,19 @@ amr_graph_list = amrbatch.parse_document_file_to_produce_amr_graph( print(f'\n *** TEST RESULT ***') for amr_graph in amr_graph_list: - print(f'\n{amr_graph}') \ No newline at end of file + print(f'\n{amr_graph}') + + +# -- Parsing from a string +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' +# amr_graph_list = amrbatch.parse_document_string_to_produce_amr_graph( +# input_string, data_reference, amr_model_path=AMR_MODEL_PATH, output_dirpath=output_dirpath, +# amrld_serialization=True) + +# print(f'\n *** TEST RESULT ***') +# for amr_graph in amr_graph_list: +# print(f'\n{amr_graph}') \ No newline at end of file