Part 6. Speech Acts, Questions & Tasks

By Rodrigo Alarcón, Computational Linguist

The complete list of modules we offer can be found in our documentation:

Codeq NLP API Documentation

Define a NLP pipeline and analyze a text

The workflow to call the NLP API includes creating an instance of the Codeq Client using your API credentials, defining a pipeline with some NLP annotators and using the client to analyze a text. The output is a Document object containing a list of Sentences with the analysis of the annotarors. As usual, to print a quick overview of the results, you can use the method document.pretty_print(). For each annotator we will detail:

  • the keyword (KEY) used to call the annotator,
  • the attribute (ATTR) where the output is stored,
  • the Output Labels of the annotators.
Copy to Clipboard

Speech Act Classifier

The goal of the Speech Act Classifier is to analyze and classify sentences from a pragmatic point of view and according to their illocutionary force, that is, their intention, purpose or effect within human conversations.

You can learn more about Codeq’s Speech Act Classifier here:

Courier’s Speech Act Classifier: Modeling Intent

  • KEY: speechact
  • ATTR: sentence.speech_acts

Output Labels

  • Statement: Utterances that simply convey information and/or opinions.
  • Command/Request: Utterances that compel someone to perform an action.
  • Desire/Need: Utterances that convey a desire or need that an agent has.
  • Commitment: Utterances that express the commitment to perform an action by an agent.
  • Question: Utterances that ask for information and/or opinion.
  • Other: Any other utterance that doesn’t fit in the previously defined classes.
Copy to Clipboard

Question Classifier

This annotator extends the output of the Speech Act Classifier by providing finer-grained information about sentences that were previously classified as questions.

Here you can find more details about the Question Classifier:

Courier’s Question Classifier

  • KEY: question
  • ATTR: sentence.question_types

Output Labels

  • Yes/No question. Sentences that contain the pragmatic, syntactic and prosodic markings of a yes-no question, i.e. subject-inversion, question intonation.
  • Wh question. Sentences that contain interrogative questions with subject-inversion.
  • Open-ended question. Questions without any syntactic constraint on the form of the answer (for example, as opposed to Yes/No questions.)
  • Or question. Questions that employ the conjunction “or” to offer two or more choices as answers.
  • Declarative question. Sentences that function pragmatically as questions but that do not have a “question form” and/or subject-verb inversion.
  • Tag question. These questions consists of a statement and a ‘tag’ which seeks confirmation of the statement.
  • Rhetorical question. Sentences that are syntactically expressed as questions but are not questions from a pragmatic or semantic point of view.
  • Task question. Questions sentences that were previously classified as Command/Request by the Speech Act Classifier.
Copy to Clipboard

Task Classifier

The Task Classifier annotator can be used to identify requests that place an obligation on a recipient, usually within the context of textual conversations. The workflow of the Task Classifier includes three substeps:

  • Task Classification: detect if a sentence is a task or not.
  • Task Sub-classification: if a sentence is detected as a task, a subclassifier is applied to detect a list of possible actions predicted as necessary to address a request (for example writing back an email, making a call or opening your calendar).
  • Task Priority: if a sentence is detected as a task, a set of heuristics is applied to detect the priority of the task, inferred from resolved dates or urgency patterns found in the sentence.

More information about the Task Classifier can be found here:

Courier’s Task Extraction

  • KEY: task
  • ATTR: sentence.is_task
  • ATTR: sentence.task_subclassification
  • ATTR: sentence.task_actions

The attribute sentence.is_task is a boolean indicating if the sentence is classified as task or not.

The attribute sentence.task_subclassification is a list of labels indicating the possible actions predicted as necessary to address a task.

The attribute sentence.task_actions is a dictionary that extends the task_subclassification by providing information about deadlines, priority status, priority patterns and resolved task dates.

Output labels (sentence.task_subclassification):

  • email
  • call
  • open_attachment
  • open_browser
  • text
  • deadline
  • open_calendar
Copy to Clipboard

Wrap Up

In this tutorial we described three annotators of the Codeq NLP API: Speech Act Classifier, Question Classifier and Task Classifier. The code below summarizes the pipeline names to call each annotator and the variables used to store their output:

Copy to Clipboard

Take a look at our documentation to learn more about the NLP tools we provide.

Do you need inspiration? Go to our use case demos and see how you can integrate different tools.

In our NLP demos section you can also try our tools and find examples of the output of each module.