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

Minor update

parent 833bce36
No related branches found
No related tags found
No related merge requests found
# ::snt The Solar System is the gravitationally bound system of the Sun and the objects that orbit it, either directly or indirectly.
(s / system
:domain (p / planet
:name (n / name
:op1 "Solar"
:op2 "System"))
:ARG1-of (b / bind-01
:ARG0 (g / gravitation))
:part (a / and
:op1 (s2 / sun)
:op2 (o / object
:ARG0-of (o2 / orbit-01
:ARG1 s2
:manner (o3 / or
:op1 (d / direct-02)
:op2 (d2 / direct-02
:polarity -))))))
# ::snt Of the objects that orbit the Sun directly, the largest are the eight planets, with the remainder being smaller objects, the dwarf planets and small Solar System bodies.
(a / and
:op1 (h / have-degree-91
:ARG1 (p / planet
:quant 8)
:ARG2 (l / large)
:ARG3 (m / most)
:ARG5 (o / object
:ARG0-of (o2 / orbit-01
:ARG1 (s / sun)
:ARG1-of (d / direct-02))))
:op2 (r / remain-01
:ARG1 (a2 / and
:op1 (o3 / object
:ARG1-of (h2 / have-degree-91
:ARG2 (s2 / small)
:ARG3 (m2 / more)))
:op2 (p2 / planet
:mod (d2 / dwarf))
:op3 (b / body
:mod (s3 / small)
:part-of (s4 / system
:name (n / name
:op1 "Solar"
:op2 "System"))))))
# ::snt Of the objects that orbit the Sun indirectly—the natural satellites—two are larger than the smallest planet, Mercury, and one more almost equals it in size.
(a / and
:op1 (h / have-degree-91
:ARG1 (o / object
:quant 2
:ARG1-of (ii / include-91
:ARG2 (o2 / object
:ARG0-of (o3 / orbit-01
:ARG1 (s / sun)
:ARG1-of (d / direct-02
:polarity -))
:ARG1-of (m / mean-01
:ARG2 (s2 / satellite
:ARG1-of (n / natural-03))))))
:ARG2 (l / large)
:ARG3 (m2 / more)
:ARG4 (p / planet
:name (n2 / name
:op1 "Mercury")
:ARG1-of (h2 / have-degree-91
:ARG2 (s3 / small)
:ARG3 (m3 / most))))
:op2 (e / equal-01
:ARG1 (m4 / more
:quant (a2 / almost))
:ARG2 p
:ARG3 (s4 / size)))
# ::snt The Solar System formed 4.6 billion years ago from the gravitational collapse of a giant interstellar molecular cloud.
(f / form-01
:ARG1 (s / system
:name (n / name
:op1 "Solar"
:op2 "System"))
:ARG2 (c / collapse-01
:ARG1 (c2 / cloud
:consist-of (m / molecule)
:mod (g / giant)
:mod (ii / intercontinental))
:ARG0-of (c3 / cause-01
:ARG1 (g2 / gravity)))
:time (b / before
:op1 (n2 / now)
:quant (t / temporal-quantity
:quant 4600000000
:unit (y / year))))
# ::snt The vast majority of the system's mass is in the Sun, with the majority of the remaining mass contained in Jupiter.
(a / and
:op1 (b / be-located-at-91
:ARG1 (m / mass
:part-of (s / system)
:quant (m2 / majority
:mod (v / vast)))
:ARG2 (s2 / sun))
:op2 (c / contain-01
:ARG0 (p / planet
:name (n / name
:op1 "Jupiter"))
:ARG1 (m3 / mass
:ARG1-of (r / remain-01)
:quant (m4 / majority))))
# ::snt The four smaller inner system planets, Mercury, Venus, Earth and Mars, are terrestrial planets, being primarily composed of rock and metal.
(p / planet
:mod (t / terrestrial)
:domain (a / and
:op1 (p2 / planet
:name (n / name
:op1 "Mercury"))
:op2 (p3 / planet
:name (n2 / name
:op1 "Venus"))
:op3 (p4 / planet
:name (n3 / name
:op1 "Earth"))
:op4 (p5 / planet
:name (n4 / name
:op1 "Mars"))
:part-of (s / system
:mod (ii / inner))
:ARG1-of (c / compose-01
:ARG2 (a2 / and
:op1 (r / rock)
:op2 (m / metal))
:mod (p6 / primary))
:ARG1-of (h / have-degree-91
:ARG2 (s2 / small)
:ARG3 (m2 / more))))
# ::snt The four outer system planets are giant planets, being substantially more massive than the terrestrials.
(p / planet
:mod (g / giant)
:domain (p2 / planet
:quant 4
:part-of (s / system
:mod (o / outer)))
:ARG1-of (h / have-degree-91
:ARG2 (m / massive)
:ARG3 (m2 / more
:degree (s2 / substantial))
:ARG4 (t / terrestrial)))
# ::snt The two largest planets, Jupiter and Saturn, are gas giants, being composed mainly of hydrogen and helium; the two outermost planets, Uranus and Neptune, are ice giants, being composed mostly of substances with relatively high melting points compared with hydrogen and helium, called volatiles, such as water, ammonia and methane.
(c / contrast-01
:ARG1 (g / giant
:mod (g2 / gas)
:domain (a / and
:op1 (p / planet
:name (n / name
:op1 "Jupiter"))
:op2 (p2 / planet
:name (n2 / name
:op1 "Saturn"))
:ARG1-of (h / have-degree-91
:ARG2 (l / large)
:ARG3 (m / most)))
:ARG1-of (c2 / compose-01
:ARG2 (a2 / and
:op1 (h2 / hydrogen)
:op2 (h3 / helium))
:mod (m2 / main)))
:ARG2 (g3 / giant
:mod (ii / ice)
:domain (a3 / and
:op1 (p3 / planet
:name (n3 / name
:op1 "Uranus"))
:op2 (p4 / planet
:name (n4 / name
:op1 "Neptune"))
:ARG1-of (c3 / compose-01
:ARG2 (s / substance
:ARG1-of (h4 / have-degree-91
:ARG2 (h5 / high-02
:ARG1 (p5 / point
:mod (m3 / melt-01)))
:ARG3 (m4 / more
:ARG2-of (r / relative-05))
:ARG4 (a4 / and
:op1 (h6 / hydrogen)
:op2 (h7 / helium)
:ARG1-of (c4 / call-01
:ARG2 (v / volatile
:example (a5 / and
:op1 (w / water)
:op2 (a6 / ammonia)
:op3 (m5 / methane)))))))
:mod (m6 / most)))))
# ::snt All eight planets have almost circular orbits that lie within a nearly flat disc called the ecliptic.
(o / orbit-01
:ARG0 (p / planet
:quant 8
:mod (a / all))
:mod (c / circular
:mod (a2 / almost))
:ARG1-of (l / lie-07
:ARG2 (d / disc
:ARG1-of (f / flat-06
:degree (n / near))
:ARG1-of (c2 / call-01
:ARG2 (t / thing
:name (n2 / name
:op1 "ecliptic"))))))
# ::snt The Solar System also contains smaller objects.
(c / contain-01
:ARG0 (s / system
:name (n / name
:op1 "Solar"
:op2 "System"))
:ARG1 (o / object
:ARG1-of (h / have-degree-91
:ARG2 (s2 / small)
:ARG3 (m / more)))
:mod (a / also))
# ::snt The asteroid belt, which lies between the orbits of Mars and Jupiter, mostly contains objects composed, like the terrestrial planets, of rock and metal.
(c / contain-01
:ARG0 (b / belt
:mod (a / asteroid)
:ARG1-of (l / lie-07
:ARG2 (b2 / between
:op1 (o / orbit-01
:ARG0 (p / planet
:name (n / name
:op1 "Mars")))
:op2 (o2 / orbit-01
:ARG0 (p2 / planet
:name (n2 / name
:op1 "Jupiter"))))))
:ARG1 (o3 / object
:ARG1-of (c2 / compose-01
:ARG2 (a2 / and
:op1 (r / rock)
:op2 (m / metal))
:ARG1-of (r2 / resemble-01
:ARG2 (p3 / planet
:mod (t / terrestrial)))))
:mod (m2 / most))
# ::snt Beyond Neptune's orbit lie the Kuiper belt and scattered disc, which are populations of trans-Neptunian objects composed mostly of ices, and beyond them a newly discovered population of sednoids.
(l / lie-07
:ARG1 (a / and
:op1 (a2 / and
:op1 (b / belt
:name (n / name
:op1 "Kuiper"
:op2 "Belt"))
:op2 (d / disc
:ARG1-of (s / scatter-01))
:consist-of (p / population
:mod (o / object
:ARG0-of (t / transpire-01
:ARG1 (p2 / planet
:name (n2 / name
:op1 "Neptunian"))))
:ARG1-of (c / compose-01
:ARG2 (ii / ice
:quant (m / most)))))
:op2 (p3 / population
:mod (s2 / sednoid)
:ARG1-of (d2 / discover-01
:ARG1-of (n3 / new-01))
:location (b2 / beyond
:op1 a2)))
:ARG2 (b3 / beyond
:op1 (o2 / orbit-01
:ARG0 p2)))
# ::snt Within these populations, some objects are large enough to have rounded under their own gravity, though there is considerable debate as to how many there will prove to be.
(h / have-concession-91
:ARG1 (h2 / have-degree-91
:ARG1 (o / object
:quant (s / some))
:ARG2 (l / large)
:ARG3 (e / enough)
:ARG6 (r / round-03
:ARG1 o
:location (u / under
:op1 (g / gravity
:poss o)))
:location (p / population
:mod (t / this)))
:ARG2 (d / debate-01
:ARG1 (t2 / thing
:quant-of (m / many
:ARG1-of (p2 / prove-01)))
:degree (c / considerable)))
# ::snt Such objects are categorized as dwarf planets.
(c / categorize-01
:ARG1 (o / object
:mod (s / such))
:ARG2 (p / planet
:mod (d / dwarf)))
# ::snt Astronomers generally accept at least nine objects as dwarf planets: the asteroid Ceres and the trans-Neptunian objects Pluto, Eris, Haumea, Makemake, Gonggong, Quaoar, Sedna, and Orcus.
(a / accept-01
:ARG0 (p / person
:ARG0-of (o / observe-01))
:ARG1 (o2 / object
:quant (a2 / at-least
:op1 9)
:ARG2-of (ii / include-91
:ARG1 (a3 / and
:op1 (a4 / asteroid
:name (n / name
:op1 "Cerre"))
:op2 (o3 / object
:name (n2 / name
:op1 "Pluto"))
:op3 (a5 / asteroid
:name (n3 / name
:op1 "Eris"))
:op4 (a6 / asteroid
:name (n4 / name
:op1 "Haumea"))
:op5 (o4 / object
:name (n5 / name
:op1 "Makemake"))
:op6 (o5 / object
:name (n6 / name
:op1 "Gonggong"))
:op7 (o6 / object
:name (n7 / name
:op1 "Quaoar"))
:op8 (o7 / object
:name (n8 / name
:op1 "Sedna"))
:op9 (o8 / object
:name (n9 / name
:op1 "Orcus"))
:mod (t / trans-Neptunian))))
:ARG3 (p2 / planet
:mod (d / dwarf))
:ARG1-of (g / general-02))
# ::snt In addition to these two regions, various other small-body populations, including comets, centaurs and interplanetary dust clouds, freely travel between regions.
(a / and
:op1 (r / region
:quant 2
:mod (t / this))
:op2 (t2 / travel-01
:ARG0 (p / population
:consist-of (b / body
:mod (s / small))
:mod (o / other)
:mod (v / various)
:ARG2-of (ii / include-01
:ARG1 (a2 / and
:op1 (c / comet)
:op2 (c2 / centaur)
:op3 (c3 / cloud
:consist-of (d / dust)
:mod (ii2 / interplanetary)))))
:ARG1 (b2 / between
:op1 (r2 / region))
:ARG3-of (f / free-04)))
# ::snt Six of the planets, the six largest possible dwarf planets, and many of the smaller bodies are orbited by natural satellites, usually termed "moons" after the Moon.
(o / orbit-01
:ARG0 (s / satellite
:ARG1-of (n / natural-03)
:ARG1-of (t / term-01
:ARG2 (m / moon)
:mod (u / usual)
:time (a / after
:op1 m)))
:ARG1 (a2 / and
:op1 (p / planet
:quant 6
:ARG1-of (ii / include-91
:ARG2 (p2 / planet
:mod (d / dwarf)
:ARG1-of (h / have-degree-91
:ARG2 (l / large)
:ARG3 (m2 / most
:quant 6)
:ARG1-of (p3 / possible-01)))))
:op2 (b / body
:quant (m3 / many)
:ARG1-of (ii2 / include-91
:ARG2 (b2 / body
:ARG1-of (h2 / have-degree-91
:ARG2 (s2 / small)
:ARG3 (m4 / more)
:ARG4 p))))))
# ::snt Each of the outer planets is encircled by planetary rings of dust and other small objects.
(e / encircle-01
:ARG1 (r / ring
:consist-of (a / and
:op1 (d / dust)
:op2 (o / object
:mod (s / small)
:mod (o2 / other)))
:mod (p / planet))
:ARG2 (p2 / planet
:mod (o3 / outer)
:mod (e2 / each)))
# ::snt The solar wind, a stream of charged particles flowing outwards from the Sun, creates a bubble-like region in the interstellar medium known as the heliosphere.
(c / create-01
:ARG0 (w / wind
:mod (s / sun)
:ARG1-of (m / mean-01
:ARG2 (s2 / stream-01
:ARG1 (p / particle
:ARG1-of (c2 / charge-03))
:direction (o / outwards)
:source s)))
:ARG1 (r / region
:ARG1-of (r2 / resemble-01
:ARG2 (b / bubble))
:location (m2 / medium
:mod (ii / interstellar))
:ARG1-of (k / know-02
:ARG2 (h / heliosphere))))
# ::snt The heliopause is the point at which pressure from the solar wind is equal to the opposing pressure of the interstellar medium; it extends out to the edge of the scattered disc.
(p / point
:ARG2-of (e / equal-01
:ARG1 (p2 / pressure-01
:ARG0 (w / wind
:mod (s / sun)))
:ARG2 (p3 / pressure-01
:ARG0 (m / medium
:mod (ii / interstellar))
:ARG0-of (o / oppose-01)))
:domain (h / heliopause)
:ARG0-of (e2 / extend-01
:ARG4 (e3 / edge
:part-of (d / disc
:ARG1-of (s2 / scatter-01)))
:direction (o2 / out)))
# ::snt The Oort cloud, which is thought to be the source for long-period comets, may also exist at a distance roughly a thousand times further than the heliosphere.
(p / possible-01
:ARG1 (e / exist-01
:ARG1 (c / cloud
:name (n / name
:op1 "Oort"
:op2 "cloud")
:ARG0-of (s / source-02
:ARG1 (c2 / comet
:mod (p2 / period
:ARG1-of (l / long-03)))
:ARG1-of (t / think-01)))
:location (d / distant-02
:ARG2-of (h / have-degree-91
:ARG1 c
:ARG3 (t2 / times
:quant (r / roughly
:op1 1000))
:ARG4 (h2 / heliosphere)))
:mod (a / also)))
# ::snt The Solar System is located 26,000 light-years from the center of the Milky Way galaxy in the Orion Arm, which contains most of the visible stars in the night sky.
(b / be-located-at-91
:ARG1 (s / system
:name (n / name
:op1 "Solar"
:op2 "System"))
:ARG2 (r / relative-position
:op1 (c / center
:part-of (g / galaxy
:name (n2 / name
:op1 "Milky"
:op2 "Way"))
:location (a / arm
:name (n3 / name
:op1 "Orion")
:ARG0-of (c2 / contain-01
:ARG1 (s2 / star
:ARG1-of (ii / include-91
:ARG2 (s3 / star
:ARG1-of (s4 / see-01
:ARG1-of (p / possible-01)
:location (s5 / sky
:time (d / date-entity
:dayperiod (n4 / night)))))
:ARG3 (m / most))))))
:quant (d2 / distance-quantity
:quant 26000
:unit (l / light-year))))
# ::snt The nearest stars are within the so-called Local Bubble, with the closest, Proxima Centauri, at 4.25 light-years.
(s / star
:ARG1-of (h / have-degree-91
:ARG2 (n / near-02
:ARG1 s)
:ARG3 (m / most))
:ARG2-of (ii / include-91
:ARG1 (s2 / star
:name (n2 / name
:op1 "Proxima"
:op2 "Centre")
:ARG1-of (h2 / have-degree-91
:ARG2 (c / close-10
:ARG1 s2
:ARG2 s)
:ARG3 (m2 / most
:ord (o / ordinal-entity
:value 4.25
:scale (l / light-year))))))
:location (b / bubble
:ARG1-of (l2 / local-02)
:mod (s3 / so-called)))
# ::snt The sun is a star.
(s / star
:domain (s2 / sun))
# ::snt Earth is a planet.
.
(p / planet
:domain p
:name (n / name
:op1 "Earth"))
# ::snt The sun is a star.
(s / star
:domain (s2 / sun))
# ::snt Earth is a planet.
.
(p / planet
:domain p
:name (n / name
:op1 "Earth"))
# ::snt The sun is a star.
(s / star
:domain (s2 / sun))
# ::snt Earth is a planet.
.
(p / planet
:domain p
:name (n / name
:op1 "Earth"))
# ::snt The sun is a star.
(s / star
:domain (s2 / sun))
# ::snt Earth is a planet.
.
(p / planet
:domain p
:name (n / name
:op1 "Earth"))
# ::snt The sun is a star.
(s / star
:domain (s2 / sun))
# ::snt Earth is a planet..
(p / planet
:domain (p2 / planet
:name (n / name
:op1 "Earth")))
# ::snt The sun is a star.
(s / star
:domain (s2 / sun))
# ::snt Earth is a planet..
(p / planet
:domain (p2 / planet
:name (n / name
:op1 "Earth")))
# ::snt The sun is a star.
(s / star
:domain (s2 / sun))
# ::snt .
(a / amr-empty)
# ::snt The sun is a star.
(s / star
:domain (s2 / sun))
# ::snt Earth is a planet.
(p / planet
:domain p
:name (n / name
:op1 "Earth"))
......@@ -21,9 +21,14 @@ import sys
#==============================================================================
# Useful directories
RAW_DIR = "abstractText/"
AMR_GRAPH_DIR = "amrGraph/"
AMR_LK_DIR = "amrLk/"
INPUT_DIR = "inputText/"
OUTPUT_DIR = "outputData/"
# Reference suffix
TEXT_SUFFIX = ".txt"
SENTENCE_SUFFIX = ".sentence.txt"
AMR_GRAPH_SUFFIX = ".amr.graph"
AMR_LK_SUFFIX = ".amr.lnk"
# AMR Lib Models
AMR_LIB_DATA = '/home/lamenji/.local/lib/python3.10/site-packages/amrlib/data/'
......@@ -53,12 +58,12 @@ def clean_sentence(sentence):
# Main Functions
#==============================================================================
def read_input_file(filename):
print("-- Reading input files (" +
filename +
") to recover a list of sentences")
def prepare_input_data(filename):
""" Prepare data before parsing """
print("-- Reading input files to recover a list of sentences")
sentences_list = list()
input_file = RAW_DIR + filename + ".txt"
input_file = INPUT_DIR + filename + TEXT_SUFFIX
with open(input_file, "r") as reading_file: # r = read
for line in reading_file.readlines():
sentences = line.split(". ")
......@@ -66,37 +71,45 @@ def read_input_file(filename):
if is_valid_sentence(sentence):
sentence = clean_sentence(sentence)
sentences_list.append(sentence + ".")
print("----- number of sentences: " + str(len(sentences_list)))
output_file = OUTPUT_DIR + filename + SENTENCE_SUFFIX
print("-- Generating sentence file: " + output_file)
with open(output_file, "w") as writing_file: # w = write
first = True
for s in sentences_list:
if not first: writing_file.write("\n")
writing_file.write(s)
first = False
return sentences_list
def convert_sentences_to_graph(model, sentences):
print("-- Converting text sentences to AMR graphs")
"""Converting text sentences to AMR graphs"""
print("-- Loading AMR model")
stog = amrlib.load_stog_model(model_dir=model)
graphs = []
i = 1
print("-- Converting sentences to AMR graphs")
graphs_list = []
for sentence in sentences:
print("--- parse sentence " + str(i) + ": " + sentence)
graphs.extend(stog.parse_sents([sentence]))
i += 1
return graphs
graphs_list.extend(stog.parse_sents([sentence]))
print("----- number of graphs: " + str(len(graphs_list)))
return graphs_list
def write_output_file(graphs, filename):
print("-- Writing AMR graphs to input files (" +
filename +
")")
output_file = AMR_GRAPH_DIR + filename + ".txt"
with open(output_file, "a") as writing_file: # a = append
""" Writing AMR graphs to output files"""
output_file = OUTPUT_DIR + filename + AMR_GRAPH_SUFFIX
print("-- Generating AMR Graph file: " + output_file)
with open(output_file, "w") as writing_file: # w = write
for graph in graphs:
out_graph = graph + "\n\n"
print(out_graph)
writing_file.write(out_graph)
# Data
test = "test"
ssc_00_1 = "solar-system"
data_name = test
#==============================================================================
# Main function
......@@ -106,15 +119,14 @@ def main(data_ref):
# -- Prepare the sentences to be converted
print("\n" + "[SSC] Data Preparation")
source_sentences = read_input_file(data_ref)
print(source_sentences)
print("-- number of sentences: " + str(len(source_sentences)))
print("-- input data reference: " + data_ref)
sentences = prepare_input_data(data_ref)
# -- Convert sentences to graphs
print("\n" + "[SSC] Convert sentences to graphs")
print("-- library: amrlib")
print("-- model: " + amr_model)
graphs = convert_sentences_to_graph(amr_model, source_sentences)
graphs = convert_sentences_to_graph(amr_model, sentences)
write_output_file(graphs, data_ref)
......
File moved
File moved
# ::snt The sun is a star.
(s / star
:domain (s2 / sun))
# ::snt Earth is a planet.
(p / planet
:domain p
:name (n / name
:op1 "Earth"))
The sun is a star.
Earth is a planet.
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment