---
title: "Data-Driven Broad-Coverage Grammars for Opinionated Natural"
description: "Cagan and colleagues learn grammars from reader comments to generate replies that address an article and reflect a reader’s stated opinion."
canonical: "https://research.elamur.ai/free/en/papers/cagan-2017-data-driven-broad-coverage-grammars/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/) · [Constitution](https://md.constitution.elamur.ai/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/cagan-2017-data-driven-broad-coverage-grammars/)

[Elamur Research](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2017](https://md.research.elamur.ai/free/en/papers/2017/) / Data-Driven Broad-Coverage Grammars for Opinionated Natural Language Generation (ONLG)

# Data-Driven Broad-Coverage Grammars for Opinionated Natural Language Generation (ONLG)

Paper · 2017 · Tomer Cagan, Stefan L. Frank and Reut Tsarfaty

**Authors:** Tomer Cagan, [Stefan L. Frank](https://md.research.elamur.ai/free/en/authors/stefan-l-frank/) and [Reut Tsarfaty](https://md.research.elamur.ai/free/en/authors/reut-tsarfaty/) · **Year:** 2017 · **Venue:** Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers) · **Licence:** [CC BY 4.0 (ACL Anthology)](https://creativecommons.org/licenses/by/4.0/)

Cited by **2** papers in our library of more than 163,000 papers whose bibliographies we read · Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers) · [licence](https://creativecommons.org/licenses/by/4.0/)

- [Publisher's page](https://aclanthology.org/P17-1122/)
- [PDF](https://aclanthology.org/P17-1122.pdf)
- [DOI 10.18653/v1/p17-1122](https://doi.org/10.18653/v1/p17-1122)

## Summary

A reply to an opinion piece has to do more than mention the same subject. It has to take a position on something the article says. Cagan and colleagues call this task opinionated natural language generation. Their system is given an article and a reader’s agenda, which specifies the topics the reader cares about and a sentiment for each. Where the article and agenda address the same topic, the system aims to produce a favorable reply if their sentiments agree and an unfavorable one if they differ. The authors’ previous system relied on manually written templates to provide this kind of control, and the more replies readers saw, the more likely they were to classify them as machine-generated. The new paper asks whether a grammar learned from real comments can give the system a wider range of ways to express an opinion.

The authors collect New York Times sports articles and their associated reader comments. They use the articles to learn which words characterize different topics and the comments to learn how sentences are built. The comments receive automatic syntactic and sentiment annotations, with sentiment marked on phrases as well as whole sentences. The paper compares three ways of turning those annotated sentences into a grammar. BASE learns which phrases can be combined and how their sentiments go together, then fills in words locally. LEX makes headwords part of the structure, so that the choice of a word can influence how the sentence develops. RR, inspired by Relational-Realizational grammar, also represents the grammatical functions of phrases. At generation time, the system builds several candidate sentences, keeps the more promising partial trees as it goes, and makes a final selection using the frequency of short word sequences.

The evaluations favor different grammars depending on what is measured. RR receives the strongest automatic fluency score among the generated systems and completes 95.7% of its sentences within the search limit, compared with 67.3% for LEX. LEX has a modest advantage in matching the requested sentiment and receives the highest human-likeness ratings. On inspection, the authors find that LEX more frequently reproduces familiar expressions, while RR tends to assemble phrases more compositionally. An additional RR experiment finds that choosing an initial word using topic information brings the generated replies closer to the input articles on a measure of topical similarity.

Human-likeness ratings rise slightly as a survey session progresses. The authors therefore find no sign of the decline they had attributed to readers recognizing repeated structures in the template system. The survey concerns how individual sentences sound, while topical similarity and sentiment agreement are measured separately. Together, the experiments give the authors what they describe as the first data-driven baseline for generating replies from an explicit agenda. They also show why choosing a grammar depends on which aspect of a reply matters most.

## Deep dive: Data-Driven Broad-Coverage Grammars for Opinionated Natural Language Generation (ONLG)

Cagan and colleagues learn grammars from reader comments to generate replies that address an article and reflect a reader’s stated opinion. · about 37 minutes to read

**In this deep dive**

1. [The problem and its context](#dd-the-problem-and-its-context)
2. [The method, step by step](#dd-the-method-step-by-step)
3. [Experiments and results](#dd-experiments-and-results)
4. [What the ablations show](#dd-what-the-ablations-show)
5. [Limitations](#dd-limitations)
6. [What came after](#dd-what-came-after)

### The problem and its context

#### A response must have a point of view

An article and a comment can share a subject and still have a weak connection. A comment might mention the sport under discussion while overlooking the decision or performance on which the article takes a position. It could also address the right event and express the opposite of what the intended commenter believes. In the authors’ formulation, the generator has to address both aspects. It needs some way to decide what part of the article is worth responding to and some way to express a sentiment consistent with the agenda it has been given. The result should also read like something a person might write.

The agenda gives the system a specific source for the desired position. A reader can care about several topics and hold a different attitude towards each. The paper represents this as a collection of topic and sentiment pairs. The article is analyzed into pairs of the same general kind, enabling the generator to look for common subject matter and compare attitudes. This makes the task different from writing a generic conversational turn. A generic reply may be acceptable in some exchanges. Here, a reply is meant to reflect whose point of view it expresses and what that person is reacting to.

The paper situates the task in online interaction, where many systems of the kind the authors discuss automate responses for broad classes of users. The authors identify potential uses for more specific control, including helping people articulate opinions and making computer-generated turns in an interface more responsive to a user’s interests. Their experiment concentrates on a narrower setting than those applications suggest. It uses articles and comments in sports news, with an individual sentence as the generated response. That setting gives the authors examples of how people express approval, criticism and other attitudes in context, while leaving the wording of a suitable reply open.

#### What templates already made possible

The authors had previously demonstrated the basic agenda-driven setup with templates. A template supplies a sentence pattern whose open positions can be filled to suit an article and an agenda. This gives the designer control over the shape of a reply and makes it possible to produce relevant wording with a limited inventory of constructions. The earlier evaluations, as this paper describes them, gave encouraging ratings for relevance and human-likeness.

A template has a cost when someone sees many replies. The words in the open positions can change while the construction around them stays recognizable. The authors’ earlier human evaluation found that perceived human-likeness declined over a session, which they attributed to participants learning to associate repeated patterns with machine output. The problem therefore concerns the distribution of sentences across a system’s output as well as the quality of a single example. A sentence pattern that sounds plausible on its first appearance may reveal how it was produced when it appears repeatedly.

A learned grammar offers more points at which sentences can vary. The generator can choose among different structures near the top of a sentence and among different expansions inside each phrase. Rules learned from actual comments also give it a source of expressions beyond what a designer happened to write. The authors’ approach depends on combining these rules selectively. The fact that a construction occurs in a corpus gives a reason to consider it during generation, but ordinary comments also contain typing errors, fragments and combinations that annotation software may analyze poorly.

#### Where the work fits in language generation

The paper relates opinionated generation to concept-to-text generation. In that setting, a system begins with structured information and turns it into an utterance. The paper describes earlier approaches that use templates or learn from data, including grammar-based systems built around a custom grammar or a restricted domain. The agenda resembles a structured input because it represents the intended content explicitly. The article adds an open-ended input, and the generator has to account for subject matter, attitude and sentence form together. This is the broader problem in [text generation](https://md.research.elamur.ai/free/en/topics/text-generation/) that the authors take up.

The authors also compare their task with prior research on replies in social media and short conversations. Work on replies to tweets had treated response generation as a transformation from one word sequence to another, including approaches based on statistical translation. Such systems could draw on expressions of mood and sentiment that occurred in previous exchanges. In the authors’ account, the usual setup lacked an explicit agenda that could specify which subject to address and what attitude to convey. The paper uses Ritter and colleagues’ work as an example of this approach to [response generation in social media](https://md.research.elamur.ai/free/en/papers/ritter-2011-data-driven-response-generation-social/).

The paper identifies conversational research that gives the generator additional information, such as a representation of a speaker’s persona or loosely structured knowledge. These efforts are closer to the present task because the preceding utterance does not have to provide all the cues that shape the reply. The specific control demanded by the agenda is still different. A persona provides information about a speaker across exchanges. The agenda in this paper supplies an attitude attached to a particular topic, which the system uses when it finds that topic in the article. The authors point to Li and colleagues’ work on [persona-based conversation](https://md.research.elamur.ai/free/en/papers/li-2016-persona-based-neural-conversation-model/) as a step toward conditioning responses on information about the user.

The design also brings together two jobs traditionally distinguished in natural language generation. Microplanning concerns choices about how to express content, including which words and local constructions to use. Surface realization turns such decisions into the sentence the reader sees. In the authors’ grammars, a choice about sentence structure can bring with it a choice about sentiment or a headword. Conversely, a word selected early can affect which structures are available later. This connection gives the paper its central technical question. How much information should each grammatical choice carry if the generator is to produce varied sentences while still expressing the required attitude?

### The method, step by step

#### From an article and an agenda to a reply

Consider a reader whose agenda includes a favorable attitude toward a topic that an article discusses critically. The system should find the shared topic and aim for a reply that disagrees with the article. If the article and the agenda express the same attitude, the reply should instead express agreement. The paper treats that choice as a simple rule based on whether the sentiments match. Positive and negative here describe the attitude of the response to the article’s position. A favorable attitude towards a subject can therefore lead to a negative reply when the article takes an unfavorable view of that subject.

An agenda topic is stored as a weighted bag of words. The weights indicate which words are more characteristic of the topic, and word order plays no part in the representation. The article analysis likewise returns topics paired with attitudes. Sharing a topic gives the system grounds for a reply even when the attitudes differ. The operation called intersection in the paper thus has to bring the two attitudes into comparison. Interpreting it as literal equality of whole topic and sentiment pairs would exclude the cases for which disagreement is intended.

The paper writes the task as a prediction from this intersection.

```
f_response(a ⊗ c(d)) = y,  y ∈ Σ*
```

Here `d` is the input document, which contains one article. The agenda is `a`, and `c` is the analysis function that turns `d` into topic and sentiment information. The operator `⊗` combines the agenda with the analyzed content where their topics intersect. The function `f_response` produces the sentence `y`. The symbol `Σ` denotes the English vocabulary, and the star denotes the set of finite sequences formed from that vocabulary. The membership symbol `∈` says that the output is one of those sequences.

The paper calls the agreement rule an exclusive-or, or XOR. Its verbal definition specifies a positive reply for matching sentiments and a negative reply for differing sentiments. The grammars themselves can distinguish sentiment intensity and neutrality. The discussion of the agreement rule gives the sign of a reply in the cases it describes, while the simulations control sentiment by supplying each class directly. These are different inputs to keep in mind when following the method. The formal task tells the system why a reply should be positive or negative. The generation experiment asks whether the grammar can realize a specified sentiment class.

The system has a preparation stage and a generation stage. During preparation, the articles supply evidence about the vocabulary of topics, while the comments supply examples of how people write sentences and express sentiment. During generation, topic information can guide the initial choice of words, and the grammar controls the available expansions of those words into a sentence.

From articles and comments to a generated reply The steps in order.

#### How the training material becomes a grammar

For a grammar to learn from comments, the system first needs to know which stretches of each sentence form phrases. It also needs an estimate of the attitude expressed by those phrases. The authors automatically analyze the comments into constituency trees. In a constituency tree, a node groups consecutive words into a unit such as a noun phrase, and its children describe how that unit is built. The lowest word-bearing positions have categories such as noun or adjective. This gives the generator a hierarchy in which it can choose how to build a whole clause and then separately decide how to expand its phrases. The underlying operation is [parsing](https://md.research.elamur.ai/free/en/concepts/parsing/).

Sentiment annotation assigns a value to internal nodes as well as the whole sentence. That matters because the attitude of a phrase can depend on the arrangement of its parts. A sentiment-bearing adjective can modify a relatively neutral noun, or a negative construction can change the attitude otherwise associated with an expression. The grammar can learn that such configurations occur by counting the annotated patterns. The authors draw the scheme from the [Stanford sentiment treebank work](https://md.research.elamur.ai/free/en/papers/socher-2013-recursive-deep-models-semantic-compositionality/).

The implementation uses the Stanford CoreNLP suite to obtain constituency and sentiment annotations for BASE. For LEX it adds a head-finding step that identifies the principal word for each phrase. For RR it merges constituency and dependency analyses using an earlier procedure that matches spans of words across the analyses. Constituency supplies the phrase groupings, and dependency relations supply information about the role a unit plays with respect to another. In this way, the authors obtain multiple views of the same comments from [Stanford CoreNLP](https://md.research.elamur.ai/free/en/papers/manning-2014-stanford-corenlp-natural-language-processing/) and the subsequent analysis steps.

The grammar induction procedure walks over the resulting trees and tallies the production decisions for the representation being learned. A production states how a node can expand. Its probability is estimated by maximum likelihood, meaning the observed count for that decision is interpreted relative to the alternatives observed under the same conditioning information. Adding a headword or a grammatical function to the conditioning information changes which observations contribute to a decision. The more specific representation can distinguish cases that BASE pools together, but it also has fewer examples for some of its individual contexts.

The authors apply no smoothing. As a consequence, the estimates receive no additional probability mass for alternatives the corpus failed to show. They also use a frequency restriction on which rules can take part in generation, with the aim of limiting noise from automatic parses. This makes the collected comments important in two ways. A larger range of observed constructions can widen what the grammar generates, while the frequency restriction keeps very uncommon observations from determining the output merely because they appeared in an annotated tree. The paper gives the general learning procedure without specifying a numerical threshold in its account of induction.

The articles follow a separate path. The authors use Mallet to learn a distribution of words for each topic and infer how much the topics contribute to a document. That information is available for a new article at generation time. It can favor a starting word associated with the topics that matter to the input. The annotated comments teach the generator which structures it can build around words. The article collection provides the information that can steer the first of those word choices through [topic modeling](https://md.research.elamur.ai/free/en/concepts/topic-modeling/).

#### What the system assigns a probability to

The system generates a tree and reads the words from its leaves. In a [context-free grammar](https://md.research.elamur.ai/free/en/concepts/context-free-grammar/), a nonterminal is a symbol that can be expanded, and a terminal is a symbol that appears in the finished output. A single sentence may be compatible with more than one tree. The distinction matters because the system scores the grammatical derivation along with the words it produces.

```
f_response(a ⊗ c(d)) = argmax_{w = yield(t), t ∈ T} P(w, t | a ⊗ c(d))
```

The response function and intersection have the same meanings as before. The grammar is `G`, and `T` is the set of trees that `G` can generate. A candidate tree is `t`. Its `yield(t)` is the sequence formed by reading the terminal leaves in order, denoted by `w`. The symbol `P` denotes a probability, and the vertical bar means that the joint probability of the words and tree is evaluated given the article and agenda intersection. The `argmax` instruction selects the candidate with the highest score. The response is the word sequence from the selected derivation.

The authors first describe the probability in terms of the entire generation history. They divide it into a root decision, a derivation of the structure and a realization of the terminal words.

```
P(w, t | a ⊗ c(d)) =
    P(root(t) | a ⊗ c(d))
    × P(der(t) | root(t), a ⊗ c(d))
    × P(yield(t) | root(t), der(t), a ⊗ c(d))
```

The root decision `root(t)` selects where the sentence tree starts. The derivation `der(t)` records the sequence of syntactic productions used to build it. The yield supplies the finished word sequence. Commas on the right of a conditioning bar separate pieces of information that are jointly available. Each multiplication sign combines the probability of one stage with the probabilities of the other stages. In this description, choosing the words can depend on both the root and the derivation. The local decisions used in practice differ according to the grammar.

To make scoring practical, the authors approximate this history-based calculation using selected information from the derivation. Which parts of the history remain available is central to the comparison of the grammars.

```
P(w, t | a ⊗ c(d)) ≈
    P(root | Φ(a ⊗ c(d)))
    × ∏_{ruleⱼ ∈ der(t)} P(ruleⱼ | Φ(root, a ⊗ c(d)))
    × ∏_{wᵢ ∈ yield(t)} P(wᵢ | Φ(t, a ⊗ c(d)))
```

The approximation sign `≈` indicates that the product uses a restricted account of the history. The function `Φ` selects the information available for each decision. The `root` is the chosen start, and `ruleⱼ` is the production at position `j` in the derivation. The symbol `wᵢ` is the word at position `i` in the yield. Each `∏` multiplies the factors for all the corresponding rule applications or word positions. The remaining terms have the same meaning as in the preceding equation. The schematic notation allows the grammar to decide what local history is relevant. For instance, choosing a word from a part-of-speech category uses less information than choosing it in a phrase with an already selected head and function.

The distinction between the two probability expressions explains how annotations affect generation. If the grammar tracks only a category and sentiment at a particular position, it can pool evidence across many phrases with different words. If it also tracks the headword, it can prefer an expansion whose modifier is common with that head. If it tracks the modifier’s grammatical function, it can also distinguish the contexts in which modifiers serve different purposes. These distinctions change the decisions that the counts represent, as well as the number of examples available to estimate them.

#### BASE chooses phrases before filling in words

In BASE, every nonterminal records a phrase category and a sentiment class. The classes are `−2`, `−1`, `0`, `1` and `2`, covering the range from stronger negative sentiment through neutral to stronger positive sentiment. A production can expand one nonterminal into daughter nonterminals or emit a terminal word from a word-bearing category. For a parent with two daughters, the structural rule takes this form.

```
Cₚ[sₚ] → C_d1[s_d1] C_d2[s_d2]
```

The letter `C` stands for the syntactic category, and `s` is the sentiment annotation. The index `p` marks the parent. The indices `d1` and `d2` mark the daughters in their output order. Brackets enclose the annotation on each category. The arrow means that the parent can expand into the sequence to its right.

The paper illustrates the arrangement with a positive noun phrase that branches into a neutral determiner and a positive nominal constituent. Within that second constituent, a positive adjective appears before a neutral noun. The overall pattern can express a favorable evaluation even though the noun carries no positive sentiment of its own. It can also accept many word combinations, because the choice of adjective and noun comes at the bottom of the tree. At the point where BASE emits a word, its conditioning information consists of the local category immediately above the word and that category’s sentiment. The adjective may fit the class and the noun may fit its own class without the training corpus supplying evidence that those words sound natural together.

BASE nonetheless has a way to represent interactions between sentiments. A construction whose attitude differs from that of an embedded phrase can be represented by separate labels on their nodes. If an analyzed construction containing a negation or a modal has that pattern in the comments, the grammar can learn the corresponding productions. Its source of evidence is the combination of structural and sentiment annotations seen during training. The authors do not impose a fixed rule that all sentiment values must compose the same way whenever a particular word appears.

#### LEX introduces headwords during expansion

A headword is the word treated as central to a constituent. In a noun phrase, for instance, the noun may determine what sort of expression the surrounding words form. LEX carries this head from the parent into the daughter that continues the same phrase. The other daughter introduces a lexical modifier. This allows grammatical and lexical decisions to interact as the tree grows.

```
Cₚ[sₚ, lₕ] → C_d1[s_d1, lₕ] C_d2[s_d2, lₘ]
```

The categories `C`, sentiments `s` and node indices have the same roles as in BASE. The symbol `lₕ` is the headword, shared here by the parent and the first daughter. The symbol `lₘ` is the new lexical item associated with the modifying daughter. The arrow gives the order illustrated in the paper. The head can also be carried by the right daughter, with the modifier on the left.

LEX makes several choices within this expansion. The parent first generates the head daughter. Given that head, it then chooses a modifying constituent on the appropriate side and the word that goes with it. This follows the head-driven approach of Collins. Factoring the expansion this way lets the grammar use head-dependent preferences while avoiding a single indivisible decision over the fully specified parent and both daughters. The design takes its starting point from [head-driven statistical parsing](https://md.research.elamur.ai/free/en/papers/collins-2003-head-driven-statistical-models-natural/).

The practical effect is that a word can shape a sentence long before the generator reaches its terminal position. Choices that BASE makes independently at the bottom of the tree become linked through the head. A head that frequently occurs with a particular kind of modifier can favor that continuation. This offers an explanation for why LEX could produce more familiar word combinations. The effect follows from how the grammar conditions its decisions. Whether it improves a whole sentence is a question for the evaluations.

#### RR distinguishes grammatical function from phrase form

RR retains phrase categories, sentiment and headwords. It also records a relation that describes the grammatical function of the node with respect to its parent. The distinction between form and function matters because a phrase of a given category can serve different purposes. Two noun phrases, for instance, can have the same form as far as their category is concerned while occupying different roles in a clause. With a function label, the generation procedure can first decide which roles a constituent needs and then choose phrases to fill those roles.

```
Cᵢ[sᵢ, depᵢ, lᵢ] → Cⱼ[sⱼ, depⱼ, lᵢ] Cₖ[sₖ, depₖ, lₖ]
```

Here `i` identifies the parent, and `j` and `k` identify the ordered daughters. At each node, `C` is the phrase category, `s` is the sentiment, `dep` is the dependency relation to the parent, and `l` is the lexical head. The parent head `lᵢ` is also the head of daughter `j`. Daughter `k` has its own head `lₖ`. The arrow again denotes an allowable expansion. The `dep` annotations preserve the functional information supplied by [dependency parsing](https://md.research.elamur.ai/free/en/concepts/dependency-parsing/).

RR splits the expansion into projection, configuration and realization. Projection chooses an unordered set of grammatical functions given the current constituent and sentiment. At this stage the system decides what jobs the daughters are to perform. It has yet to decide how the daughters will be ordered or which words will appear in them. This makes it possible to describe what several expansions have in common even when their final wording differs.

Configuration turns the unordered functions into an ordered binary expansion. The procedure described in the paper separates the set into disjoint parts, with a single function in one part, and puts the parts in order. This adaptation keeps the derivation binary, so a branch expands into a pair of daughters. The original Relational-Realizational approach cited by the authors orders the larger set directly. The adapted procedure gives their generator a way to work through that set in successive binary decisions.

Realization chooses a constituent and sentiment to express the function or group of functions assigned to a daughter. It then selects a lexical dependent given the constituent, its sentiment, the head and the function. Structural and lexical decisions are still connected, but RR takes a different route through them. It asks how to realize a role after it has projected and arranged the roles. LEX starts with the head daughter and uses that choice to generate modifiers. The comparison therefore changes how a sentence is built as well as what the node labels contain.

#### Starting a sentence on the shared topic

The grammar can generate a sentence for a root with the desired sentiment. For a response to a particular article, it also needs some way to favor a root likely to keep the sentence on the shared subject. The authors put this pressure on the lexical items introduced at the root. They use the topic weights at the intersection of article and agenda, together with the weights of headwords in each topic. A root can receive support across several topics if its word choices are characteristic of those topics.

```
P̂(root(t) | a ⊗ c(d)) =
    P̂(ROOT → l₁ l₂ | a ⊗ c(d)) =
    ∑_{c=1}^{N} ∑_{i=1}^{2} tm_weight(c) × word_weight(c, lᵢ)
```

The hat on `P̂` marks the estimated root probability used in the scoring scheme. The start symbol is `ROOT`, and the arrow indicates the root choice associated with the two lexical items `l₁` and `l₂` in the paper’s formula. The sum over `c` runs through the `N` topics, and here `c` is a topic index. The `c` in `c(d)` still denotes the document analysis function. The sum over `i` runs through the root’s word positions. The term `tm_weight(c)` is the importance of topic `c` at the intersection, and `word_weight(c, lᵢ)` is the weight of word `lᵢ` in that topic’s word distribution. The multiplication gives the contribution of one topic to one word, and the sums combine the contributions.

This adjustment influences what the derivation starts with. If a topic strongly represented in the intersection gives a high weight to a headword, a root using that headword is a stronger candidate. The rest of the tree develops according to the grammar’s ordinary decisions. This gives the system a way to use article content without specifying all the words of the finished sentence. It also means that an appropriate root by itself gives no guarantee that the later words will comment on the particular point the article makes.

#### Searching for a complete sentence

The decoder starts at the root and expands the tree from the top down. It maintains a frontier of positions that still need to be expanded. At a selected position, it replaces the nonterminal on the left of a production with the material on the right. If it chose only one production at each position, an unhelpful decision early in generation would determine all the subsequent choices available in that derivation. The authors instead allow several continuations, creating a collection of competing partial trees.

The decoder expands the trees breadth-first and uses a form of beam search. A beam is a limited set of candidates carried forward at each stage. The search keeps the `k` highest-scoring partial trees being considered, where `k` is the number of candidates allowed through to the next round. It updates each candidate’s score from the score already computed for its partial derivation and the contribution of the new rule. This reuse of a previous calculation is the dynamic programming component described in the paper. It avoids scoring the whole tree afresh after each expansion.

The search compares candidates using the local probability factors and an average node score to reduce the effect of differences in tree size. It imposes a height limit so recursive productions cannot keep a candidate growing indefinitely. The distinction between reaching the limit and finishing matters for evaluation. A tree is finished when all of its leaves are terminal symbols. A derivation can also stop at the limit with positions left unrealized, and the paper counts those cases when comparing the grammars.

Finally, the system reranks the resulting candidates using the words at their leaves. It scores consecutive groups of words with a `3`-gram probability resource and divides the score by sentence length to compare candidates on a per-word basis. This stage can favor familiar short word sequences across the finished sentence, including sequences whose words were introduced by separate grammatical decisions. For the implementation described, the authors use Microsoft’s WebLM API. The three-word sequence is a particular instance of an [n-gram](https://md.research.elamur.ai/free/en/concepts/n-gram/).

### Experiments and results

#### Data, settings and comparisons

The authors collected 3,583 sports articles and 13,100 associated user comments from the New York Times website using its Community API. The comments yielded 55,700 sentences. The article texts supplied the material for training the topic distributions, and the comment sentences supplied the trees for grammar induction. The paper identifies the article and comment corpus and its supplementary annotations as available. It describes the sources and analysis procedures without assigning a name to the corpus.

The simulations paired a grammar with a choice about using topic scores. The grammar options were BASE, LEX and RR. Each variant produced 5,000 responses, including 1,000 sentences for each input sentiment class. The paper states that the generated sentences were reused across experiments. This lets the evaluations examine different properties of the same output rather than making each metric depend on a fresh run with a different mix of examples. The balanced inputs also mean that agreement is assessed across all the stipulated sentiment classes.

The generator was set to a maximum tree depth of 13. For the binary trees used here, the paper gives 4096 words as the corresponding theoretical maximum yield. The realized sentences were much shorter. The important practical effect of the depth setting was that a tree could still have unfinished branches when the decoder stopped. The percentage of complete sentences therefore gives information about how readily each grammar reaches terminal output under the same bound.

BASE serves as the internal comparison for LEX and RR. It shares the broad generation setup and sentiment annotation while omitting the lexical heads and function information of the richer representations. In the relevance experiment, the authors use unmodified RR as the comparison for the RR variant that uses topic information at the root. They also use human comments from the corpus as reference points for some automatic measures. An actual comment is one answer people gave to an article. The open-ended task allows many other plausible answers, which is why the experiments do not reduce evaluation to matching a reference sentence.

#### Fluency, completion and sentiment control

The automatic fluency measure uses scores from Microsoft’s Web ML API for the three-word sequences found in each output. The paper reports an aggregate sentence score and a per-word version. The normalization matters because a longer sentence gives the scorer more material to evaluate. The chart follows the paper’s interpretation of the signed, per-word values, with a higher score indicating a more favorable rating on this measure.

Average per-word fluency score for sports-news replies RR leads the generated systems and comes closest to the score for collected reader comments.

**The numbers**

| System or setting | Average LM score per word |
| --- | --- |
| BASE | -8.9 |
| LEX | -6.5 |
| RR (this paper) | -5.6 |
| Human comments | -5.4 |

The mean aggregate fluency scores in the same comparison were -79.7 for BASE, -73.7 for LEX, -51.8 for RR and -50.1 for the corpus comments. The mean output lengths were 9.5 words for BASE, 12.3 for LEX and 9.6 for RR, compared with 10.3 for the collected human sentences. RR thus obtains the better score of the generated systems under both reporting conventions. The human row gives a reference for the scale of the automatic measure. It is a set of observed comments, with no requirement to satisfy a generator’s starting rule or reach a terminal tree by a fixed depth.

Completion gives a separate view of the comparison. Among BASE outputs, 20.1% reached a tree with terminal symbols at every leaf. The rate was 67.3% for LEX and 95.7% for RR. The authors call this a measure of compactness or tightness because a grammar that finishes more readily within the depth limit can realize an output with fewer layers of expansion where the budget is binding. Completion measures a property of the derivation. A short sentence can leave a branch unfinished, and a fully realized tree can still yield an awkward sentence.

For sentiment agreement, the authors run the generated word sequence through the sentiment classifier associated with the Stanford work. They compare the label obtained from the finished text with the label supplied to the generator. Exact agreement requires the requested sentiment level. Polarity agreement distinguishes the direction of sentiment more broadly, allowing a sentence to miss the target intensity while retaining the target sign. Thus a reply that sounds mildly favorable when asked for a strongly favorable response can represent a success on polarity even though the exact class is wrong.

The exact sentiment agreement rates were 13.3% for BASE, 44.6% for LEX and 43.8% for RR. For polarity agreement the rates were 41.8%, 63.9% and 61.0%, respectively. LEX leads both sentiment comparisons, while RR leads automatic fluency and completion. This distribution of results shows the different roles of the metrics. A grammar can consistently finish sentences and yield common word sequences while still struggling to communicate the requested intensity of sentiment. A sentence can also convey the right broad attitude while containing wording that an automatic fluency score penalizes.

#### Relevance to the input article

The relevance experiment asks whether changing the root score makes output more closely related to its triggering article. The authors use RR for this comparison because it had the strongest automatic fluency scores among the grammar variants. One setting uses the ordinary RR generator. The other, RRTM, uses topic scores when selecting the start rule and its initial lexical material. The rest of the comparison retains the RR representation.

For each article and generated sentence, the authors infer a distribution over the topics and compare the two distributions using L2 distance. This distance is smaller when the topic weights of the reply fall closer to the article’s weights across the topic inventory. It reflects the vocabulary associated with the inferred topics. The link between a reply and the precise event or claim it responds to is a more specific question than this distance can answer.

Mean article-to-reply topic distance for sports-news articles Topic scoring at the root gives RR replies a closer topical match to their articles.

**The numbers**

| System or setting | Mean L2 distance |
| --- | --- |
| RR | 0.473 |
| RRTM (this paper) | 0.424 |
| Human comments | 0.429 |

The comparison supports using topic information in the root decision when the goal is closeness on this measure. The authors’ sample outputs also illustrate what that can look like in words. The topic-guided set contains language explicitly associated with baseball, where the ordinary RR examples can be considerably more generic. A reply can thus contain a clearer clue to the article’s subject because of the starting vocabulary, even when some of its later wording remains awkward.

The human reference value is close to that of the topic-guided generator. The authors explain why human comments can have more distant individual sentences. A reader may produce a longer paragraph in which a sentence functions as a transition, an interjection or a general reaction. Its topic vocabulary can be sparse even when the paragraph as a whole is tightly connected to the article. RRTM is optimized to give the topic lexical expression near the beginning of a stand-alone sentence. Its lower distance than the corpus reference applies to this measure of an individual sentence.

#### Human judgments of authorship

The human survey asks a different question. Amazon Mechanical Turk participants, screened for English proficiency and US residence, saw individual responses and judged whether they seemed to have been written by a person or a computer. The task used a 7-point scale from confident machine attribution to confident human attribution, with uncertainty in the middle. Each survey had 50 trials in random order. Within a session, participants encountered 3-4 examples for each grammar and sentiment combination.

This is a judgment about apparent authorship. Participants can use whatever signs make a sentence look like a contribution from a person, including familiar expressions, plausible content and a natural arrangement of words. A score from short word sequences has access to a narrower type of evidence. The survey therefore gives a separate basis for comparing the grammars, particularly where a word combination can be locally common yet sound unusual as a complete utterance.

Mean human-likeness ratings for generated sports-news replies Survey participants rated LEX replies as the most human-like of the grammar variants.

**The numbers**

| System or setting | Human-likeness rating on a 1–7 scale |
| --- | --- |
| BASE | 2.4561 |
| LEX (this paper) | 4.1681 |
| RR | 3.7278 |

The survey thus favors LEX, reversing the ordering of LEX and RR in automatic fluency. BASE has the lowest mean in both comparisons. The authors relate the difference between the two richer grammars to properties a short-sequence score may capture only indirectly, such as customary turns of phrase or wording that reflects familiar facts about the world. The survey measures the combined judgment. It does not ask participants to identify which of those properties influenced a particular rating.

The authors also analyze the ratings as a sequence within each session. Later responses receive slightly higher ratings, and the paper finds no grammar-specific decline of the kind that appeared in the authors’ earlier template evaluation. This temporal result is distinct from the mean ratings. A grammar can be perceived as more human-like than another on average while both show a similar tendency across trial positions. The regression and the qualitative inspection help explain which comparisons the survey supports and where the mechanisms remain uncertain.

### What the ablations show

#### What changes when the grammar carries more information

The paper does not present a series of ablations that remove one feature at a time from a fixed grammar. Its most direct controlled change is the addition of topic scoring to RR. The comparisons among BASE, LEX and RR change broader aspects of the grammatical representation and derivation. The other analyses look at sentence examples and at variation across the human ratings.

The BASE-to-LEX comparison shows what happens when lexical heads and head-driven decisions enter the derivation together. BASE places its lexical choices at the word-bearing nodes and has no direct means to use the head of a larger phrase when it selects those words. LEX exposes the head to later decisions. In the experiments, the joint change is associated with gains in automatic fluency, completion, sentiment agreement and human-likeness. The consistent direction across those measures supports the authors’ view that lexical decisions benefit from being connected to syntactic generation.

The LEX-to-RR comparison gives a more differentiated result. Both representations retain lexical information. RR adds grammatical functions and reorganizes the derivation around projecting, arranging and realizing them. RR’s completion advantage shows that the new organization makes it easier for this generator to finish trees within the fixed depth limit. Its automatic fluency scores are also stronger. The comparison leaves open how much of that gain comes from relation labels, the sequence of decisions around those labels or the use of the resulting rule inventory during search. Those changes occur together.

LEX does somewhat better at realizing the sentiment supplied to the decoder, in spite of the much lower proportion of completed trees. Its human-likeness advantage also means that completion alone would have led to a different choice of grammar from the human survey. These results make the grammar comparison more informative than a single ranking. They show which behaviors change together in this setup and where one measure stops predicting the outcome of another.

#### What root scoring isolates

The RR and RRTM comparison has a clearer intervention. Both generators use RR productions, and the topic-guided version changes how the root is scored. The lower L2 distance provides evidence that this change causes replies to contain language more closely associated with their input articles under the paper’s topic measure. The effect is consistent with the mechanism, which places article-sensitive lexical information at the start of the derivation and then allows the grammar to expand around it.

The experiment specifically controls the selection of a start rule. It gives little evidence about whether article information is still influential when later phrases are selected. A sentence can receive a favorable topic distance after introducing vocabulary that is strongly associated with the article, even if the continuation is generic. The paper’s examples are useful here as illustrations of the two properties occurring together. The topic can be recognizable in a reply whose grammatical or argumentative connection to the article remains difficult to follow.

#### Why the authors inspect familiar expressions

The authors examine some generated sentences to understand why LEX receives better human ratings than RR despite its weaker automatic fluency results. They find a tendency for LEX to repeat established expressions and for RR to build less familiar combinations from smaller constituents. The explanation fits the design of LEX. A head-driven grammar can retain information about a word and a modifier when both occur often in the same construction. A grammar that organizes decisions around functions can build a new combination by putting together pieces that serve those functions.

The paper’s interpretation is that this compositional flexibility can preserve grammaticality while yielding phrases that sound less like what a person would normally say. The distinction is easiest to see where a phrase obeys ordinary rules for arranging its words, yet a reader expects a conventional expression in that context. Human-likeness can depend on those expectations as well as on structural well-formedness. The authors’ inspection connects the difference to [idioms and multiword expressions](https://md.research.elamur.ai/free/en/topics/multiword-expressions/).

This is an explanation based on a sample of outputs. The paper gives no separate measurement of idiom frequency, and the survey does not manipulate familiar expressions independently of the grammar. The additional possibility the authors raise, that lexical co-occurrences help reproduce phrasing consistent with world knowledge, is likewise a hypothesis. The observed ratings establish a preference among the outputs shown. The inspection identifies a plausible reason for the preference and leaves room for several features of the sentences to contribute.

#### What changes over the survey session

The authors use ordinal mixed-effects regression for the ratings. Ordinal means that the response categories have an order, without requiring the distance between adjacent categories to be treated as equal. The mixed-effects formulation allows participants to differ in their general use of the scale and in how they respond to grammar and sentiment. The predictors include grammar, the input sentiment, length in words and trial position. The authors standardize quantitative predictors, consider interactions between pairs of predictors and drop interactions above their significance threshold of `.05`.

With BASE as the reference grammar, the fitted coefficients for LEX and RR are 2.90 and 2.33, respectively. Both have reported probabilities below `.00001` in the table’s significance column. These coefficients are on the regression scale. The descriptive means in the chart give the corresponding comparison in the original rating scale. Because the analysis includes interactions, the table also shows that the grammar differences depend on other properties of the responses.

For sentiment, the table gives a reference coefficient of 0.17 and a grammar-by-sentiment interaction of 0.44 for RR. The corresponding LEX interaction is -0.18, with a reported significance value of .056. These interaction entries describe changes relative to BASE. They are distinct from the overall effect of sentiment within a grammar. The results support the paper’s broader observation that more positive input has different associations with human ratings across the grammatical representations. They give weaker evidence for the LEX interaction than for the RR interaction.

Length also interacts with grammar. The table gives -1.60 for the reference length coefficient, 1.31 for the LEX interaction and 1.35 for the RR interaction. The paper’s prose assigns the latter figures to the grammars in the opposite order and describes them as favorable within-grammar effects of length. The table labels them as interactions with BASE. The comparison that can be read directly from the table is that the association between additional words and human-likeness is more favorable for both richer grammars than for BASE. The interaction entries alone should not be read as the slope within either grammar.

For the question about repeated exposure, the position coefficient is 0.21. The table also reports an interaction of 0.10 between response length and position, consistent with a somewhat stronger upward tendency for longer sentences. The fitted analysis retains no grammar-by-position effect. The authors compare the positive overall tendency with their earlier template survey, where ratings fell as the session went on. Here the results supply no evidence of a comparable decline. They measure how behavior changed within the rating sessions and do not independently count recurrent constructions in the generated text.

### Limitations

#### Limits the authors identify

The authors acknowledge the difficulty of establishing a gold standard for open-ended replies. A single article can receive many responses that are topical, idiomatic and consistent with a specified attitude. This motivates their use of several assessments, each sensitive to a different property. It also leaves the evaluations without a single direct test of the core communicative goal. A candidate can score well on one assessment and poorly on another, as the contrast between the automatic fluency and human-likeness results demonstrates.

The authors also identify the quality of automatic parses as a source of noise. The grammar inherits its examples of structure and sentiment from automatically analyzed comments. If the analysis gives an unusual sentence an erroneous structure, the resulting tree can introduce misleading productions. The frequency filter is intended to limit some of this noise. Errors that recur frequently enough can still enter the grammar, and automatic annotation can influence which kinds of sentiment compositions the system learns. The authors identify better parsing as a route to better generation in subsequent investigations.

The paper cautions that human responses frequently come from longer passages. An individual sentence in such a passage can rely on a neighboring sentence for its connection to the article. This affects how to read the relevance comparison with human comments. Producing a sentence with a topic distribution close to the article is a measurable achievement. Comparing that sentence with one lifted from a longer comment mixes responses that were written to stand on their own with responses that may depend on the surrounding paragraph.

The authors also propose evaluating the system in the setting where the responses would be used. Their experiments cover automatic evaluation and isolated human judgments. They do not follow how generated replies would be read in an ongoing discussion, how other people would answer them or how the replies would affect the conversation. The concluding proposal for evaluation in context draws attention to the difference between a sentence that sounds plausible in a survey and a contribution that functions appropriately in a discussion.

#### Limits that follow from the setup

The grammars are described as broad-coverage because the approach learns varied constructions from a corpus and does not depend on hand-writing a response pattern for each topic. The experiments draw their evidence from a single sports-news collection and associated comments. They do not test how the learned productions or topic distributions transfer to other kinds of articles, publication settings or languages. The results establish what the system can do with this material and the specified decoding procedure.

The formal account of an agenda is more general than the documented test of one. It allows several topic and sentiment pairs and defines an intersection between the article and agenda. The experiments explicitly generate sentences for prescribed sentiment classes and test a topical intervention for RR. They do not report how the system performs when deciding among several competing topics or when the attitudes inferred from an article are ambiguous. The paper’s agreement rule also leaves open how all combinations of neutrality and intensity translate into the target class. Sentiment agreement with a supplied class gives evidence about realization once that choice has been made.

The classifier used to assess sentiment reflects the same annotation approach used to enrich the training comments. A match therefore indicates that the system produced a sentence the classifier interprets as having the requested attitude. It does not establish that a reader would assign the same intensity or understand the attitude as directed towards the correct target. A reply can contain an expression that reads as negative overall while expressing criticism of a different person, action or claim than the one under discussion. This is particularly relevant to disagreement, where the desired attitude depends on how the article’s position is understood.

The automatic fluency assessment also overlaps with the final selection procedure. The decoder reranks using per-word scores for local word sequences from the same resource used for the reported fluency measure. The comparison shows which grammar produces outputs that receive better scores under the criterion the system uses for final selection. It supplies limited independent evidence of grammaticality. The human survey offers a separate measurement, although its authorship question combines judgments of grammar, idiom, content and any other features readers use to make that decision.

The topic experiment has a related dependence. Its root variants are evaluated with topic distributions of the same kind that guide the root score. This is appropriate for testing whether the intervention achieves a closer match in that representation. It does not by itself demonstrate that people regard the result as a better response to the article’s argument. The human survey as described shows participants responses and asks about likely authorship. It supplies no corresponding article-conditioned human judgment that would establish the conversational significance of the change in topic distance.

Finally, the paper compares the new position effect with an earlier study of templates. The current experiment provides evidence that ratings did not visibly decline with exposure in these sessions. It does not include the old template system in a matched trial alongside the current grammars. The difference between the experiments supports the authors’ interpretation that the learned grammars avoided conspicuous repetition, but the trial-position result cannot measure how much structural variety increased or isolate variety as the only cause.

### What came after

The paper identifies directions for follow-up, but no subsequent study is documented here as having carried them out. The authors propose improving the automatic parses used for induction and exploring more abstract grammars that could learn richer response patterns. They also suggest revisiting the final ranking of candidates, where the experiments rely on normalized scores for short word sequences. These proposals address different places where a candidate can lose plausibility, from the rules learned in preparation to the decision about which completed sentence to use.

The authors also propose collecting more data and adapting sequence-to-sequence generation so that it can use the article, the agenda and possibly a description of the user’s style. They connect this with work on context-sensitive and persona-conditioned conversation discussed in the paper. Those studies are antecedents to the proposal. The final direction concerns evaluation in a live discussion, where researchers could observe whether replies contribute to the conversation and how other participants respond. That question remains open in the reported experiments.

## Cite

Cite as Tomer Cagan, Stefan L. Frank and Reut Tsarfaty. 2017. Data-Driven Broad-Coverage Grammars for Opinionated Natural Language Generation (ONLG). Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers).

The paper itself, not this page. BibTeX from the library's record of the work. [DOI 10.18653/v1/p17-1122](https://doi.org/10.18653/v1/p17-1122)

```bibtex
@inproceedings{cagan2017data,
  title = {{Data-Driven Broad-Coverage Grammars for Opinionated Natural Language Generation (ONLG)}},
  author = {Tomer Cagan, Stefan L. Frank and Reut Tsarfaty},
  booktitle = {Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)},
  year = {2017},
  doi = {10.18653/v1/p17-1122},
  url = {https://doi.org/10.18653/v1/p17-1122}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
