Teaching with ChatGPT
Source: Jurafsky and Martin (https://web.stanford.edu/~jurafsky/slp3/old_oct19/15.pdf)

Teaching with ChatGPT

I have written earlier about teaching with ChatGPT. In that example, I used ChatGPT as a data source and analytics engine. However, with the breadth of information encoded in OpenAI, prompts to teaching ideas elicit really good teaching examples as well

I. Teaching a Concept

Take for example, a concept such as dependency parsing. Teaching a concept in class usually requires (in my perhaps old fashioned and pedantic manner) explaining a concept and illustrating with a couple of examples.

ChatGPT can generate several examples distinguishing between different types of parsing. A simple dependency would be a sentence such as: "The cat sat on the mat," while a compound dependency would be "John and Mary went to the park" and a complex dependency is "the quick brown fox jumps over the lazy dog."

ChatGPT was not only able to generate several examples of each of these, but also starting ideas for class exercises.

II. Illustrating a Concept

For example, this was one of the responses that I found useful (and very helpful as a starting point)

Ask students to create dependency parses for other sentences or generate sentences for their peers to parse. Encourage discussion about the nuances of different grammatical structures and how they are represented in the dependency parse. Additionally, you can use NLP libraries such as SpaCy or NLTK to generate dependency parses programmatically and compare them to the manual parses created by the students.

III. Applying the concept to a more general problem

Another interesting exercise is to help students think about analyzing everyday examples of written language to show how to apply key concepts taught in class (and ideally should be followed on with hands-on exercises)

These were some examples I got after prompting ChatGPT

Example 1: Basic Dependency Parse

Sentence: "The cat is sleeping."

Dependency Parse:

scssCopy code        

det(cat, The) nsubj(sleeping, cat) aux(sleeping, is) root(ROOT-0, sleeping)

Explanation:

  • det: determiner (The)
  • nsubj: nominal subject (cat)
  • aux: auxiliary verb (is)
  • root: root of the sentence (sleeping)

Example 2: Prepositional Phrase

Sentence: "She walked in the park."

Dependency Parse:

scssCopy code        

nsubj(walked, She) root(ROOT-0, walked) prep(walked, in) det(park, the) pobj(in, park)

Explanation:

  • nsubj: nominal subject (She)
  • root: root of the sentence (walked)
  • prep: prepositional phrase (in)
  • det: determiner (the)
  • pobj: prepositional object (park)

Example 3: Coordinating Conjunction

Sentence: "He likes coffee and tea."

Dependency Parse:

scssCopy code        

nsubj(likes, He) root(ROOT-0, likes) cc(likes, and) conj(likes, tea)

Explanation:

  • nsubj: nominal subject (He)
  • root: root of the sentence (likes)
  • cc: coordinating conjunction (and)
  • conj: conjunction (tea)

Example 4: Complex Sentence

Sentence: "Although it was raining, they went for a walk."

Dependency Parse:

scssCopy code        

mark(raining, Although) nsubj(went, they) advcl(raining, went) det(walk, a) dobj(went, walk)

Explanation:

  • mark: subordinating conjunction (Although)
  • nsubj: nominal subject (they)
  • advcl: adverbial clause modifying the verb (went)
  • det: determiner (a)
  • dobj: direct object (walk)

Example 5: Passive Voice

Sentence: "The cake was baked by Mary."

Dependency Parse:

scssCopy code        

det(cake, The) nsubjpass(baked, cake) auxpass(baked, was) root(ROOT-0, baked)agent(baked, Mary)

Explanation:

  • det: determiner (The)
  • nsubjpass: nominal subject in passive voice (cake)
  • auxpass: auxiliary verb indicating passive voice (was)
  • root: root of the sentence (baked)
  • agent: agent performing the action (Mary)

These examples cover a range of sentence structures and grammatical features, providing a foundation for understanding dependency parsing in the context of natural language processing.

IV. Providing an explanation of the context

Not only do students need to understand a concept, they also need to understand the context where they can apply it. I adjusted prompts to give me examples based on grammar and usage. I do caution that these are black box models subject to hallucinations and do not really understand language as such. Nevertheless, as a teaching tool as an aid to generating examples, it can be fairly useful.

Here are some nice examples I got after querying for graph-based dependency parsing for complex sentences

Example 1: Complex Sentence with Subordinate Clause

Sentence: "Although he was tired, John completed the assignment."

Dependency Graph:

markdownCopy code        

completed ┌─────┴─────┐ John ─ Although ── tired │ he │ assignment

In this example, "John" is the subject of the main verb "completed," and the subordinate clause "Although he was tired" modifies the main action.

Example 2: Complex Sentence with Multiple Subordinate Clauses

Sentence: "While Mary was cooking, John was setting the table because guests were arriving."

Dependency Graph:

cssCopy code        

setting ┌───────┴───────┐ John ─ While ── cooking │ Mary │ ┌────┴─────┐ was ─ because ── arriving │ ┌───┴─────┐ table ─ guests

This example involves two subordinate clauses. "John" is setting the table while "Mary" is cooking, and the reason for setting the table is that guests are arriving.

Example 3: Complex Sentence with Nested Subordinate Clauses

Sentence: "If it rains, we will stay inside unless the movie is really interesting."

Dependency Graph:

csharpCopy code        

stay ┌───────┴───────┐ we ─ If ── rains │ ┌──────┴───────┐ unless ─ is ── interesting │ movie

In this example, there are nested subordinate clauses. The main clause is "we will stay inside," and there is a conditional clause "If it rains," and within the conditional clause, there is another subordinate clause "unless the movie is really interesting."

V. Layering on of concepts

I could get Ince examples of transition-based dependency parsing for complex sentences. ChatGPT results illustrate this concepts using a simplified set of actions (SHIFT, LEFT-ARC, RIGHT-ARC):

Example 1: Complex Sentence with Subordinate Clause

Sentence: "Although he was tired, John completed the assignment."

Transition Steps:

  1. Initial Configuration: [ROOT] → Although he was tired, John completed the assignmentStack: [], Buffer: [ROOT, Although, he, was, tired, ,, John, completed, the, assignment]
  2. SHIFT: Move "Although" from Buffer to StackStack: [Although], Buffer: [ROOT, he, was, tired, ,, John, completed, the, assignment]
  3. LEFT-ARC (dep=he, head=Although): Create a dependency from "Although" to "he"Stack: [], Buffer: [ROOT, he, was, tired, ,, John, completed, the, assignment], Dependency Parse: [Although → he]
  4. SHIFT: Move "he" from Buffer to StackStack: [he], Buffer: [ROOT, was, tired, ,, John, completed, the, assignment]
  5. RIGHT-ARC (dep=Although, head=he): Create a dependency from "he" to "Although"Stack: [], Buffer: [ROOT, was, tired, ,, John, completed, the, assignment], Dependency Parse: [Although ← he]
  6. SHIFT: Move "was" from Buffer to StackStack: [was], Buffer: [ROOT, tired, ,, John, completed, the, assignment]
  7. SHIFT: Move "tired" from Buffer to StackStack: [was, tired], Buffer: [ROOT, ,, John, completed, the, assignment]
  8. LEFT-ARC (dep=tired, head=was): Create a dependency from "was" to "tired"Stack: [was], Buffer: [ROOT, ,, John, completed, the, assignment], Dependency Parse: [was → tired]

... continue the parsing steps until the entire sentence is parsed.

Example 2: Complex Sentence with Multiple Subordinate Clauses

Sentence: "While Mary was cooking, John was setting the table because guests were arriving."

Transition Steps:

  1. Initial Configuration: [ROOT] → While Mary was cooking, John was setting the table because guests were arrivingStack: [], Buffer: [ROOT, While, Mary, was, cooking, ,, John, was, setting, the, table, because, guests, were, arriving]
  2. Continue with SHIFT, LEFT-ARC, RIGHT-ARC operations to build the dependency parse.

Example 3: Complex Sentence with Nested Subordinate Clauses

Sentence: "If it rains, we will stay inside unless the movie is really interesting."

Transition Steps:

  1. Initial Configuration: [ROOT] → If it rains, we will stay inside unless the movie is really interestingStack: [], Buffer: [ROOT, If, it, rains, ,, we, will, stay, inside, unless, the, movie, is, really, interesting]
  2. Continue with SHIFT, LEFT-ARC, RIGHT-ARC operations to build the dependency parse.

In each example, the transition-based dependency parsing algorithm processes the input sentence step by step, applying the SHIFT, LEFT-ARC, and RIGHT-ARC actions to construct the dependency tree. The goal is to transition from an initial configuration to a final configuration where the entire sentence is parsed and represented as a dependency tree.

I am not a fan of using black box ML methods without adequate guardrails, but did like the following study published in the Journal of Marketing on creating effective marketing messages through moderately surprising syntax. Link: https://journals.sagepub.com/doi/full/10.1177/00222429231153582



Woodley B. Preucil, CFA

Senior Managing Director

1 年

Anjana Susarla Very Informative. Thank you for sharing.

要查看或添加评论,请登录

Anjana Susarla的更多文章

社区洞察

其他会员也浏览了