Skip to content

Instantly share code, notes, and snippets.

@dmhowcroft
Last active September 12, 2017 06:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmhowcroft/7adbe29e1d1f6de9f7923462c7d15385 to your computer and use it in GitHub Desktop.
Save dmhowcroft/7adbe29e1d1f6de9f7923462c7d15385 to your computer and use it in GitHub Desktop.
Working notes from the hackathon in 2017

Notes for team Ice Cream at the 2017 INLG Hackathon

For getting AMR representations into DAG data structures in python, we'll use the isi-nlp/bolinas repo.

Using isi-nlp/bolinas to get AMR datastructures for AMR corpora

  1. Download the AMR corpus for the Little Prince with metadata from https://amr.isi.edu/download/amr-bank-struct-v1.6.txt

  2. Clone the repo from git@github.com:isi-nlp/bolinas.git

  3. Edit the end of common/hgraph/amr_corpus_reader.py by uncommenting

    in_f = open(sys.argv[1],'r') corpus = metadata_amr_corpus(in_f)

  4. Check that it's working by adding the following to the end of the file:

    for item in corpus: print item

3a. When you run python2 common/hgraph/amr_corpus_reader.py ../amr-bank-struct-v1.6.txt from the bolinas directory, you should see something like:

<__main__.SentenceWithHgraph instance at 0x7f20bec43d88>
<__main__.SentenceWithHgraph instance at 0x7f20bec43b00>
<__main__.SentenceWithHgraph instance at 0x7f20bec43c68>
...

Data

# ::snt Obey the safety instructions when you turn the valves.
# ::tok Obey the safety instructions when you turn the valves .
# ::alignments 8-9|0.0.0.0 6-7|0.0.0 5-6|0.0 3-4|0.1 2-3|0.1.0 0-1|0 ::annotator JAMR dev v0.3 ::date 2017-09-07T15:42:57.301
(o / obey-01 
      :ARG0 (y / you 
            :ARG0-of (t / turn-01 
                  :ARG1 (v / valv))) 
      :ARG1 (i / instruction 
            :mod (s / safe-01)))

# ::snt Turn all valves slowly to prevent strong jets of steam.
# ::tok Turn all valves slowly to prevent strong jets of steam .
# ::alignments 9-10|0.0.1 7-8|0.0 6-7|0 5-6|0.0.0 3-4|0.0.0.1 2-3|0.0.0.0 1-2|0.0.0.0.0 0-1|0.0.0.1.0 ::annotator JAMR dev v0.3 ::date 2017-09-07T15:42:57.635
(s2 / strong-02 
      :ARG1 (j / jet 
            :ARG1-of (p / prevent-01 
                  :ARG0 (v / valv 
                        :quant (a / all)) 
                  :purpose-of (s3 / slow 
                        :ARG1-of (t / turn-01))) 
            :mod (s / steam)))

# ::snt Steam can damage hose lines and components.
# ::tok Steam can damage hose lines and components .
# ::alignments 6-7|0.0.1.1 5-6|0.0.1 4-5|0.0.1.0 3-4|0.0.1.0.0 2-3|0.0 1-2|0 0-1|0.0.0 ::annotator JAMR dev v0.3 ::date 2017-09-07T15:42:58.341
(p / possible-01 
      :ARG1 (d / damage-01 
            :ARG0 (s / steam-01) 
            :ARG1 (a / and 
                  :op1 (l / line 
                        :ARG1-of (h / hose-01)) 
                  :op2 (c / component))))

# ::snt Close all valves by hand.
# ::tok Close all valves by hand .
# ::alignments 4-5|0.0 2-3|0.1 1-2|0.1.0 0-1|0 ::annotator JAMR dev v0.3 ::date 2017-09-07T15:42:58.385
(c / close-01 
      :ARG0 (h / hand) 
      :ARG1 (v / valv 
            :quant (a / all)))

# ::snt Do not stay near the valves, if the system is pressurized.
# ::tok Do not stay near the valves , if the system is pressurized .
# ::alignments 11-12|0.2 9-10|0.2.0 5-6|0.0.0 3-4|0.0 2-3|0 1-2|0.1 ::annotator JAMR dev v0.3 ::date 2017-09-07T15:42:58.518
(s2 / stay-01 
      :ARG1-of (n / near-02 
            :ARG2 (v / valv)) 
      :polarity - 
      :purpose (p / pressurize-01 
            :ARG1 (s / system)))

# ::snt Measure the time necessary for the silica gel to absorb the moisture.
# ::tok Measure the time necessary for the silica gel to absorb the moisture .
# ::alignments 11-12|0.0.1 9-10|0.0 7-8|0.0.2 6-7|0 2-3|0.0.0.0 0-1|0.0.0 ::annotator JAMR dev v0.3 ::date 2017-09-07T15:42:58.862
(s / silica 
      :ARG2-of (a / absorb-01 
            :ARG0 (m2 / measure-01 
                  :ARG1 (t / time)) 
            :ARG1 (m / moisture) 
            :purpose-of (g / gel)))

# ::snt Clean your skin with a large quantity of clean water.
# ::tok Clean your skin with a large quantity of clean water .
# ::alignments 9-10|0.1.1 8-9|0.1.1.0 6-7|0.1 5-6|0.1.0 2-3|0.0 0-1|0 ::annotator JAMR dev v0.3 ::date 2017-09-07T15:42:58.938
(c2 / clean-01 
      :ARG1 (s / skin) 
      :ARG2 (q / quantity 
            :mod (l / large) 
            :quant-of (w / water 
                  :ARG1-of (c / clean-04))))

# ::snt The shock mount absorbs the vibration.
# ::tok The shock mount absorbs the vibration .
# ::alignments 5-6|0.1 3-4|0 2-3|0.0 1-2|0.0.0 ::annotator JAMR dev v0.3 ::date 2017-09-07T15:42:58.983
(a / absorb-01 
      :ARG0 (m / mount-01 
            :ARG1-of (s / shock-01)) 
      :ARG1 (v / vibration))

# ::snt Obey the safety instructions.
# ::tok Obey the safety instructions .
# ::alignments 3-4|0.0 2-3|0.0.0 0-1|0 ::annotator JAMR dev v0.3 ::date 2017-09-07T15:42:59.006
(o / obey-01 
      :ARG1 (i / instruction 
            :mod (s / safe-01)))

# ::snt Put oil on the machined surface.
# ::tok Put oil on the machined surface .
# ::alignments 5-6|0.0.0 4-5|0.0.0.0 1-2|0.0 0-1|0 ::annotator JAMR dev v0.3 ::date 2017-09-07T15:42:59.039
(p / put-01 
      :ARG1 (o / oil 
            :location (s / surface 
                  :mod (m / machine))))

# ::snt Keep the primary part of the assembly.
# ::tok Keep the primary part of the assembly .
# ::alignments 6-7|0.0 2-3|0.1 0-1|0 ::annotator JAMR dev v0.3 ::date 2017-09-07T15:42:59.108
(k / keep-02 
      :ARG1 (a / assembly) 
      :ARG2 (p / primary))

# ::snt Install the spacer between the two washers.
# ::tok Install the spacer between the two washers .
# ::alignments 6-7|0.0 5-6|0.0.0 2-3|0.1 0-1|0 ::annotator JAMR dev v0.3 ::date 2017-09-07T15:42:59.143
(i / install-01 
      :ARG0 (w / washer 
            :quant 2) 
      :ARG1 (s / space-01))

# ::snt The fumes from this material are dangerous to the skin.
# ::tok The fumes from this material are dangerous to the skin .
# ::alignments 9-10|0.1 6-7|0 4-5|0.0.0 3-4|0.0.0.0 1-2|0.0 ::annotator JAMR dev v0.3 ::date 2017-09-07T15:42:59.195
(d / dangerous 
      :domain (f / fume 
            :source (m / material 
                  :mod (t / this))) 
      :op1 (s / skin))

# ::snt Increase the temperature to decrease the cure time.
# ::tok Increase the temperature to decrease the cure time .
# ::alignments 7-8|0.1.0 6-7|0.1.0.0 4-5|0.1 2-3|0.0 0-1|0 ::annotator JAMR dev v0.3 ::date 2017-09-07T15:42:59.263
(i / increase-01 
      :ARG1 (t2 / temperature) 
      :purpose (d / decrease-01 
            :ARG1 (t / time 
                  :purpose (c / cure-01))))

# ::snt The side stay holds the main gear leg.
# ::tok The side stay holds the main gear leg .
# ::alignments 7-8|0.1 6-7|0.1.0 5-6|0.1.0.0 3-4|0 2-3|0.0 1-2|0.0.0 ::annotator JAMR dev v0.3 ::date 2017-09-07T15:42:59.344
(h / hold-01 
      :ARG0 (s / stay-01 
            :ARG1 (s2 / side)) 
      :ARG1 (l / leg 
            :mod (g / gear 
                  :mod (m / main))))
@LordHieros
Copy link

LordHieros commented Sep 7, 2017

Original AMR
(o / obey-01
:ARG0 (y / you
:ARG0-of (t / turn-01
:ARG1 (v / valve)))
:ARG1 (i / instruction
:mod (s / safe-01)))

objective: Obey safety instruction as you turn valve

Corrected AMR
(o / obey
:ARG0 (y / you
:ARG0-of (t / turn
:ARG0 y
:ARG1 (v / valve)))
:ARG1 (i / instruction
:mod (s / safe-01)))

(p / possible-01
:ARG1 (d / damage-01
:ARG0 (s / steam-01)
:ARG1 (a / and
:op1 (l / line
:ARG1-of (h / hose-01))
:op2 (c / component))))

objective: possible damage from steam to hose line and component

(c / close-01
:ARG0 (h / hand)
:ARG1 (v / valve
:quant (a / all)))

objective: close with hand all valve

(s2 / stay-01
:ARG1-of (n / near-02
:ARG2 (v / valv))
:polarity -
:purpose (p / pressurize-01
:ARG1 (s / system)))

objective: stay not near valve if pressurize system

(o / obey-01
:ARG1 (i / instruction
:mod (s / safe-01)))

objective: Obey safety instruction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment