0% found this document useful (0 votes)
11 views17 pages

Unit 7 - Pragmatics, Discourse, Dialogue, and Natural Language Generation

Module 7 covers key concepts in pragmatics, discourse, dialogue, and natural language generation (NLG) in NLP. It includes sessions on reference resolution, co-reference, discourse structure, dialogue management, and the architecture of NLG systems. The module emphasizes the importance of understanding context, coherence, and the structured generation of language to facilitate effective communication in NLP applications.

Uploaded by

sujanst100
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views17 pages

Unit 7 - Pragmatics, Discourse, Dialogue, and Natural Language Generation

Module 7 covers key concepts in pragmatics, discourse, dialogue, and natural language generation (NLG) in NLP. It includes sessions on reference resolution, co-reference, discourse structure, dialogue management, and the architecture of NLG systems. The module emphasizes the importance of understanding context, coherence, and the structured generation of language to facilitate effective communication in NLP applications.

Uploaded by

sujanst100
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 17

Module 7: Pragmatics, Discourse, Dialogue, and

Natural Language Generation

✅ Session-wise Breakdown
Session Topic
Session 1 Introduction to Pragmatics & Discourse: Reference Resolution & Phenomena
Session 2 Co-reference: Syntactic/Semantic Constraints & Pronoun Resolution
Session 3 Discourse Structure & Coherence
Session 4 Dialogue Systems: Turns, Grounding, Dialogue Acts
Session 5 Natural Language Generation: Concepts & Architecture
Session 6 Discourse Planning: Text Schemata & Rhetorical Structures + Recap

Session 1: Pragmatics & Reference Resolution

🔹 1.1 What is Pragmatics?


Pragmatics is the study of how meaning is derived from contextual language use rather than just
literal word meanings.
In NLP, pragmatics helps models:
 Understand intentions
 Handle ambiguity
 Perform human-like conversation
🔍 Example:
“Can you close the door?” — Literally a question about ability, but pragmatically a
request.

🔹 1.2 What is Discourse in NLP?


Discourse refers to connected units of language (sentences, paragraphs, dialogues) used in real-world
contexts.
Goal in NLP: Build systems that understand relationships between words across sentences, such as:
 Who/what is being talked about?
 How ideas flow?
 What events are linked?

🔹 1.3 Reference Resolution


📘 Definition:
Reference resolution is the task of determining what entity a word or phrase refers to in a text.
“John lost his wallet. He looked for it everywhere.”
➤ He = John
➤ it = wallet

🔍 1.4 Types of Reference Phenomena


Phenomenon Definition Example
Refers to something mentioned “Priya entered the room. She looked around.” →
Anaphora
earlier She = Priya
“When he walked in, Ram looked angry.” → He
Cataphora Refers to something mentioned later
= Ram
Refers to something outside the text “Look at that!” (refers to something in the
Exophora
(requires context) physical world)
Relates implicitly through common “I walked into a house. The door was locked.”
Bridging
sense → door belongs to house

🔬 Why is Reference Resolution Important?


Use Case How It Helps
Question Answering “Who is she?” → System must resolve she correctly
Chatbots & Dialogue Maintain context over multiple turns
Summarization Merge references to reduce repetition
Machine Translation Translate pronouns accurately in gendered languages

✅ Practice Exercise
Instructions: Identify the referent for the underlined word.
1. Ram met Sita. He gave her a book.
2. If you see it, don’t touch it. The snake is dangerous.
3. When they arrived, the teachers were already waiting.
4. Rita loves singing. The microphone was her best friend. → (Bridging)
✅ Mini Quiz
Q1: Define anaphora and give one example.
Q2: What’s the difference between cataphora and exophora?
Q3: Why is reference resolution important in translation?
Q4: Identify the referent in: “Mohan found a bag. It was full of books.”

📝 Summary
 Pragmatics helps machines interpret implied meaning using context.
 Discourse allows understanding beyond individual sentences.
 Reference resolution is central to maintaining coherence across sentences.
 Different phenomena like anaphora, cataphora, and exophora affect language interpretation.

Session 2: Co-reference, Constraints & Pronoun Resolution

🔹 2.1 What is Co-reference?


Co-reference occurs when two or more expressions refer to the same entity in a discourse.
🔍 Example:
“Rita said she would arrive soon.”
➤ Rita and she refer to the same person → they are co-referring expressions

🔍 2.2 Co-reference vs. Anaphora


Feature Co-reference Anaphora
Scope General term for shared reference Subtype of co-reference
Can be forward or backward
Direction Mostly backward-looking (anaphoric)
(cataphoric/anaphoric)
After she arrived, Rita greeted us. → she =
Example Rita said she would come. → Rita = she
Rita

🔹 2.3 Constraints on Co-reference


For a system to resolve co-reference accurately, it must consider:
📌 1. Syntactic Constraints
 Based on grammar and sentence structure
 Subject-object hierarchy matters
Example:
“Ravi told Shyam that he was late.”
Ambiguous — who is he? (Needs syntactic analysis)

📌 2. Semantic Constraints
 Based on meaning and real-world knowledge
 Not all co-references are grammatically acceptable
Example:
“The apple was angry.”
❌ Semantically invalid – apples can’t be angry

Correct:
“The man was angry.” ✅

🔹 2.4 Pronoun Resolution


📘 Definition:
Pronoun resolution is the task of linking pronouns (he, she, it, they, etc.) to the correct antecedents
(noun phrases) in the discourse.
🔄 Goal:
Ensure pronouns are understood in context so the meaning remains coherent.

🔍 Example:
“Riya met Nisha at the cafe. She ordered tea.”

➡ Possible referents for She: Riya or Nisha?


➡ Pronoun resolution algorithm must use syntactic (who is subject) and semantic (who likely
ordered tea) clues to decide.

🔬 Popular Algorithms for Pronoun Resolution


Algorithm Approach Strength
Hobbs Algorithm Tree-based syntactic traversal Fast and rule-based
Centering Theory Maintains focus of attention across discourse Explains coherence and
Algorithm Approach Strength
ambiguity
Neural Coref ML-based; uses neural networks and High accuracy with large
Models embeddings corpora

🧠 Mini Task (Think-Pair-Share)


Sentence:
“Sita hugged Gita because she was crying.”

➡ Who is she?
➡ What syntactic and semantic clues help decide?
Follow-up: Ask students to rephrase to remove ambiguity.

✅ Mini Quiz
Q1: Define co-reference with one example.
Q2: Name and explain one syntactic and one semantic constraint.
Q3: Why is pronoun resolution challenging in NLP?
Q4: What does the Hobbs algorithm do?

📝 Summary
 Co-reference is when two expressions refer to the same entity.
 Pronoun resolution ensures clarity and cohesion across sentences.
 Syntactic and semantic constraints guide valid references.
 Algorithms like Hobbs and neural models automate resolution.
Session 3: Discourse Structure & Text Coherence

🔹 3.1 What is Discourse Structure?


Discourse structure refers to how sentences and ideas are logically connected in a text or
conversation. It defines the hierarchical or sequential relationships between sentences or utterances.
📘 In NLP, modeling discourse structure allows machines to:

 Follow topic progression

 Maintain logical flow

 Summarize documents meaningfully

🔍 Example:
“Rina picked up the phone. She heard nothing. She hung up.”

➡ Logical sequence: Action → Observation → Reaction


➡ Structured to reflect a temporal and causal relationship.

🔹 3.2 Elements of Discourse Structure


Element Description Example
Topic
Dividing text into coherent parts Paragraphs in news articles
Segmentation
Rhetorical Relationships like cause-effect, contrast,
“It was raining, so we stayed indoors.”
Relations elaboration
Coherence Logical connections between “She was tired. Therefore, she went to
Relations sentences/ideas bed early.”

🔹 3.3 What is Coherence in NLP?


Coherence means the text “makes sense” as a whole — each part contributes meaningfully and clearly
to the overall message.
Coherence is achieved when:
 Sentences logically follow each other
 References are clear
 Intentions are well-structured
Without coherence:
“He slept. The chair. Cat. He again.” → ❌ Uninterpretable

🔍 Example of Coherent vs. Incoherent Text:


Coherent Text Incoherent Text
“Sam entered the room. He turned on the light and sat
“Entered the room. Sam. Sit. He light.” ❌
down.”

🔬 Techniques in NLP for Coherence


Technique Purpose
Discourse Connectives Parsing Identify relations like because, so, however
Coreference Resolution Keep track of who and what across sentences
Rhetorical Structure Theory (RST) Model the hierarchical structure of discourse

💻 NLP Application Areas Using Discourse Structure


Task Role of Discourse Structure
Summarization Identify main ideas and supporting information
Dialogue Systems Track topic flow and response relevance
Text Generation Produce coherent multi-sentence text
Essay Scoring Judge organization and structure

🧪 Classroom Activity
Instructions:
 Provide students a jumbled paragraph.
 Ask them to rearrange the sentences into a coherent flow.
Example Jumbled Lines:
1. She took the call.
2. Rina’s phone rang.
3. It was her friend.
4. They talked about the event.
➡ Correct Order: 2 → 1 → 3 → 4
✅ Mini Quiz
Q1: What is discourse structure?
Q2: Define coherence with one NLP example.
Q3: What are rhetorical relations? Name two.
Q4: How does coreference resolution contribute to coherence?

📝 Summary
 Discourse structure defines how texts are logically connected and organized.
 Text coherence ensures meaning flows across sentences.
 NLP systems need to model discourse relations, references, and text flow to behave
intelligently in real contexts.

Session 4: Dialogue in NLP – Turns, Grounding & Dialogue Acts

🔹 4.1 What is a Dialogue in NLP?


In Natural Language Processing, a dialogue refers to a back-and-forth exchange between participants
— either human-human or human-machine.
🎯 NLP dialogue systems (chatbots, virtual assistants) aim to simulate natural, meaningful,
and context-aware conversations.

🔹 4.2 Turns and Utterances


Term Definition Example
One participant’s contribution before switching to the A: “Hello, how can I help?” (1st
Turn
other speaker turn)
“I’d like to book a ticket to
Utterance A single spoken sentence or phrase
Delhi.”
🔁 Dialogues are structured as a sequence of turns, each containing one or more
utterances.

🔹 4.3 Grounding in Dialogue


Grounding refers to the process of establishing mutual understanding between participants in a
conversation.
🤝 “Grounding” ensures both parties agree on what has been said, meant, and understood.

Type of Grounding Example


Explicit A: “I’m free after 5.” → B: “Okay, we’ll meet at 6.”
Implicit A: “Are you hungry?” → B: “I already ate.” (agreement implied)
Grounding is critical in multi-turn conversations to avoid misunderstanding.

🔹 4.4 Dialogue Acts & Structures


📘 Definition:
Dialogue acts are labels assigned to utterances that represent their function or intention in a
conversation.

Act Function Example


Greeting Start a conversation “Hi there!”
Request Ask for something “Can you send me the report?”
Inform Provide information “The file is on your desk.”
Confirm Verify or affirm “Yes, I received it.”
Question Seek information “What’s the deadline?”
Closing End the conversation “Thanks. Talk to you later.”

🔬 Dialogue Management in NLP Systems


A well-structured dialogue system should:
 Track state (context, user goals)
 Handle turn-taking
 Interpret user intent
 Choose appropriate response act
📲 Example:

 User: “Book a flight to Delhi.”

 System: “When would you like to travel?”


➤ Intent: Request → Flight Booking
➤ Dialogue Act: Request Info

💡 Applications of Dialogue Modeling


System Type Application
Customer Service Bots Automate FAQs, ticket handling
System Type Application
Voice Assistants Alexa, Siri, Google Assistant
Medical Assistants Guide patients with symptom checks
Tutoring Systems Help students with stepwise learning

🧪 In-Class Activity
Task: Label the dialogue acts in the following exchange.
A: “Hey, can you help me with this report?”
B: “Sure. What do you need help with?”
A: “I don’t understand the last section.”
B: “Let’s go through it together.”
A: “Thanks a lot.”

➡ Label: Greeting, Request, Inform, Offer, Thanking

✅ Mini Quiz
Q1: What’s the difference between a turn and an utterance?
Q2: Define grounding with a real-life example.
Q3: Name four common dialogue acts with examples.
Q4: Why is grounding important in task-oriented dialogue?

📝 Summary
 Dialogues in NLP involve structured turn-taking with clear intentions (acts).
 Grounding ensures mutual understanding between participants.
 Dialogue acts help machines assign semantic roles to utterances.
 NLP dialogue systems must model turns, context, acts, and response generation for
intelligent conversation.
Session 5: Natural Language Generation (NLG) – Concepts &
Architecture

🔹 5.1 What is Natural Language Generation?


Natural Language Generation (NLG) is a subfield of NLP that focuses on producing human-like
language from machine-understandable data or representations.
🎯 Goal: Convert structured data, semantic frames, or internal knowledge into fluent,
grammatically correct natural language sentences.

🔍 NLG vs. NLU


Aspect NLU (Understanding) NLG (Generation)
Direction Text → Meaning Meaning → Text
Example “Book a flight” → intent: travel_booking intent: travel_booking → “Your flight is booked.”
Use Case Chatbot interpreting input Chatbot replying in fluent text

🔹 5.2 Components of NLG Architecture


NLG systems typically follow a pipeline architecture with distinct stages:

Stage Function Example


“We need to mention tomorrow’s
1. Content Planning What information to say
weather.”
2. Sentence How to organize and structure the “Tomorrow, it will rain in
Planning content Kathmandu.”
3. Surface Convert structure into grammatically Output: “It will rain tomorrow in
Realization correct text Kathmandu.”

🔍 Example NLG Pipeline


Input Data:

{
"location": "Kathmandu",
"weather": "rain",
"day": "tomorrow"
}

Content Planning: Choose weather + day


Sentence Planning: Organize structure (subject → verb → object)
Surface Realization:
“Tomorrow, it will rain in Kathmandu.”

🔹 5.3 Types of NLG Systems


System Type Approach Example
Template-Based Fill-in-the-blank style “The temperature in {city} is {temp}°C.”
Rule-Based Grammar + symbolic logic “Add ‘-ed’ to form past tense of verbs.”
Statistical/Neural Trained on large datasets GPT, BERT, T5, etc.

💡 Applications of NLG
Domain Use Case
Weather Reporting Generate city-wise summaries automatically
Chatbots Produce polite, coherent responses from intents
Finance Summarize stock movements or financial data in plain English
News Generation Auto-generate reports for sports, elections, weather, etc.
Medical Reports Translate clinical data into readable summaries

🧪 Hands-On: Try GPT-Based Generation


🧬 Prompt → “Summarize the weather forecast for Kathmandu tomorrow.”

💬 Output (example):
“Tomorrow in Kathmandu, expect rainy weather with moderate temperatures.”

Try variations like:


 “Write as if explaining to a child.”
 “Make it sound like a news headline.”

✅ Mini Quiz
Q1: What are the three stages of an NLG pipeline?
Q2: Give one difference between template-based and neural-based NLG.
Q3: How would you generate a response from structured weather data?
Q4: Name two real-world domains where NLG is used effectively.

📝 Summary
 NLG enables machines to generate language from data or meaning representations.
 It involves content planning, sentence structuring, and surface realization.
 NLG powers chatbots, summarizers, AI writers, and reporting systems.
 Systems can range from rule-based templates to large neural language models.

Session 6: Discourse Planning, Text Schemata & Rhetorical


Relations + Recap

🔹 6.1 What is Discourse Planning in NLG?


Discourse planning is the process of organizing generated sentences into a coherent, connected
structure across a full document or multi-sentence response.
While sentence planning handles single-sentence structure, discourse planning ensures that:
 The order of information makes sense
 There are logical transitions
 The tone and flow are consistent with intent

🔹 6.2 Text Schemata (Text Plans)


📘 Definition:
Text schemata (or text plans) refer to predefined structures that guide how a text should be organized
for different genres or goals.

Text Schema Type Function Example


Narrative Tells a story or sequence of events News article: what → when → who → how
Provides detailed attributes of an “The building was tall, with glass
Descriptive
object windows…”
Expository Explains a concept step-by-step User manual or textbook excerpt
Persuasive Convince the reader of an argument Opinion articles, ads
Instructional Guides someone to do something Cooking recipes, setup steps
In NLG, selecting a proper schema improves clarity and effectiveness.

🔹 6.3 Rhetorical Relations


📘 Definition:
Rhetorical relations describe the logical and semantic connections between parts of a text.
They define how one sentence relates to the next—e.g., cause, contrast, elaboration, result.
🔍 Common Rhetorical Relations
Relation Connective(s) Example
Cause because, since “He was tired because he had worked all day.”
Contrast but, however “She was angry, but she remained silent.”
Result so, therefore “It rained, so the match was canceled.”
Elaboration in fact, for example “He is a great singer. For example, his voice is rich.”
Condition if, unless “If it rains, we’ll cancel the trip.”
➡ These relations are essential for maintaining logical progression and reader understanding.

🔬 In NLP & NLG Systems


 Rhetorical Structure Theory (RST) is used to model these relations in computational
discourse planning.
 NLG pipelines may predict and insert connectives to improve fluency and structure.

🧠 Activity: Identify Rhetorical Relations


Text Sample:
“The roads were slippery. As a result, there were multiple accidents. However, traffic
officers responded quickly.”

Label:
 Cause-Effect: slippery roads → accidents
 Contrast: accidents vs. quick officer response

✅ Mini Quiz
Q1: What is a text schema? Give one example.
Q2: Name three rhetorical relations and an example of each.
Q3: Why is discourse planning important in NLG?
Q4: How do connectives like “however” or “so” help in text generation?

📚 Final Recap of Module 7


Session Topic Key Focus
Contextual meaning,
Session 1 Pragmatics & Reference Resolution
anaphora/cataphora
Syntactic/semantic constraints,
Session 2 Co-reference & Pronoun Resolution
coreference
Session Topic Key Focus
Session 3 Discourse & Coherence Logical flow, structure, coherence
Session 4 Dialogues: Turns, Grounding & Dialogue Acts Conversational modeling and structure
Session 5 NLG: Generation Architecture Content → Sentence → Text
Discourse Planning, Text Schemas & Rhetorical Organizing multi-sentence output
Session 6
Relations effectively

🧪 Final Project Ideas


📁 Project: Build a Mini NLG Bot
 Input: Structured data (e.g., weather, movie, or news data)
 Use:
 Template-based or GPT-based generation
 Insert connectives using rhetorical relation logic
 Output: Multi-sentence fluent report (with clear discourse)

📝 Final Takeaway
Mastering Module 7 enables students to:
 Understand how context, reference, and structure affect language understanding
 Build smarter dialogue systems
 Implement or evaluate NLG pipelines
 Analyze coherence and logic in AI-generated or human-written text
✅ Module 7 – Examination Questions

🔹 Section A: Short Answer Questions (3–5 Marks Each)


1. Define pragmatics and explain its role in natural language processing with an example.
2. What is reference resolution? Differentiate between anaphora and cataphora with examples.
3. Explain co-reference with one syntactic and one semantic constraint.
4. What is pronoun resolution? Give an example where it causes ambiguity.
5. Define discourse coherence. How does coherence help in text understanding?
6. What is a dialogue act? Name any three types with examples.
7. Define grounding in dialogue. Why is it important in NLP?
8. What are the three stages of a Natural Language Generation (NLG) pipeline?
9. Differentiate between template-based and neural-based NLG systems.
10. What are rhetorical relations? Explain with two examples.

🔹 Section B: Long Answer Questions (10–15 Marks Each)


1. Discuss different reference phenomena in discourse with suitable examples.
2. Explain co-reference and pronoun resolution in detail. How does an NLP system resolve
ambiguity?
3. Describe discourse structure and coherence. How can NLP systems model these features?
4. Explain the structure of dialogue in NLP. Discuss turn-taking, grounding, and dialogue acts with
examples.
5. Describe the complete NLG pipeline and illustrate with a real-world use case.
6. What is discourse planning in NLG? Explain text schemata and rhetorical relations with
examples.
7. Compare and contrast pragmatics vs. discourse vs. dialogue in terms of their roles in NLP.
8. Write a short essay on how a chatbot can use grounding, co-reference, and NLG to maintain a
human-like conversation.

🔹 Section C: Multiple Choice Questions (MCQs)


1. Which of the following refers to entities outside the text?
a) Anaphora
b) Cataphora
c) Exophora
d) Bridging
✅ Correct: c)
2. “Rita loves singing. She bought a microphone.” → She refers to?
a) Singing
b) Microphone
c) Rita
d) Unknown
✅ Correct: c)
3. Which of the following is not a dialogue act?
a) Greet
b) Inform
c) Syntax
d) Request
✅ Correct: c)
4. The rhetorical relation used in “It was raining, so the match was canceled” is:
a) Contrast
b) Elaboration
c) Cause
d) Result
✅ Correct: d)
5. In NLG, the surface realization stage is responsible for:
a) Selecting ideas to express
b) Structuring document content
c) Generating grammatically correct sentences
d) Planning rhetorical relations
✅ Correct: c)
6. Which of these is a text schema commonly used in NLG?
a) Table lookup
b) Narrative
c) Parsing
d) Reinforcement
✅ Correct: b)

You might also like