Skip to content

Using the State

Gus Hahn-Powell edited this page Mar 25, 2019 · 6 revisions

This page specifically refers to version e7f2bb9d4aff917141a26a9c6ef2573459213834 of Odinson. If you're using a newer version, it's possible (likely) usage details have changed.

Interacting with the Odinson state

This page provides walkthrough examples of how to store labeled spans in the Odinson state, and reference such spans in later queries.

We'll examine how the state can be used both programmatically and via the UI.

Programmatic usage

The linnaeus taxonomy acquisition project relies on Odinson to identify hypernymy relations using Hearst patterns.

This project, written in Scala, first identifies noun phrases (NPs) before mining for hypernymy relations that involve such NPs.

Via the UI

This three-step example mines the publicly available development index for mentions of certain diseases and their causes.

Step 1: Explore/query

We'll start by attempting to find a subset of disease mentions using morphological clues (ex. *oma and *itis).

Enter the following pattern in the Odinson Query box:

[tag=/(NN|JJ).*/]* [tag=/N.*/ & lemma=/.*oma|itis/]

Run the following command in the terminal:

:query

Step 2: Committing results

Imagine we're satisfied with the results returned by our last query. We can now commit those spans with a label of our choosing (ex. Disease).

We'll use the same pattern in the Odinson Query box:

[tag=/(NN|JJ).*/]* [tag=/N.*/ & lemma=/.*oma|itis/]

NOTE: To support rapid query refinement, the UI will persist the most recently run query in the Odinson Query box.

To save the results (i.e., matching spans) to the state using the label Disease, run the following command in the terminal:

:commit Disease

Step 3: Referencing committed results

Now that we've saved labeled results (i.e., mentions) to the state, we can now reference these mentions in subsequent patterns using the @Label syntax.

In the previous step, we stored mentions of certain diseases in our state using the Disease label. Now let's mine the corpus for relations that capture possible causes of these diseases.

Enter the following pattern in the Odinson Query box:

(?<patient> @Disease) <nsubjpass [lemma=cause] >nmod_by >nmod_such_as? >conj? (?<agent> [])

This pattern involves two named captures denoted by the (?<argname> ) syntax.

To execute this query, run the following command in the terminal:

:query