Getting Started with SRL

Learn about the fundamentals and application of semantic role labeling.

SRL is as difficult for humans as for machines. However, once again, transformers have taken a step closer to our human baselines. Our first step will be to explore the SRL approach defined by Shi and Lin (2019). In this lesson, we will first define SRL and visualize an example. We will then run a pretrained BERT-based model.

Let’s begin by defining the problematic task of SRL.

Defining semantic role labeling

Shi and Lin (2019) advanced and proved the idea that we can find who did what, and where, without depending on lexical or syntactic features. This lesson is based on Peng Shi and Jimmy Lin’s research at the University of Waterloo, California. They showed how transformers learn language structures better with attention layers.

SRL labels the semantic role as the role a word or group of words plays in a sentence and the relationship established with the predicate.

A semantic role is the role a noun or noun phrase plays in relation to the main verb in a sentence. For example, in the sentence “Marvin walked in the park,” Marvin is the agent of the event occurring in the sentence. The agent is the doer of the event. The main verb, or governing verb, is walked.

The predicate describes something about the subject or agent. The predicate could be anything that provides information on the features or actions of a subject. In our approach, we will refer to the predicate as the main verb. For example, in the sentence “Marvin walked in the park,” the predicate is “walked” in its restricted form.

The words “in the park” modify the meaning of “walked” and are the modifier. The noun or noun phrases that revolve around the predicate are arguments or argument terms. “Marvin,” for example, is an argument of the predicate walked. We can see that SRL does not require a syntax tree or a lexical analysis.

Let’s visualize the SRL of our example.

Visualizing SRL

We will be using the Allen Institute’s visual and code resources. The Allen Institute for AI has excellent interactive online tools, such as the one we’ve used to represent SRL visually throughout this section.

The Allen Institute for AI advocates for AI for the common good. We will make good use of this approach.

The Allen Institute provides transformer models that continuously evolve. Therefore, the examples in this section might produce different results when you run them. The best way to get the most out of this section is to:

  • Read and understand the concepts explained beyond merely running a program.

  • Take the time to understand the examples provided.

We will now visualize our SRL example. The figure below is an SRL representation of “Marvin walked in the park”:

Get hands-on with 1200+ tech skills courses.