Discourse Relations and Coherence › Global coherence

Michael BrenndoerferNovember 17, 20269 min read
Language AI HandbookAll chapters
Part 9 of 67Coreference, Discourse, Pragmatics, and Dialogue
Chapter 57Discourse Relations and Coherence › Global coherence
Reading section 9 of 13 · Global coherence · 9 minSection 9 of 13 · 9 min

Section 9 of 13 · 9 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

Local models compare adjacent sentences. A global check considers relationships across the full document.

Timeline consistency

For a chronological narrative, one useful check is that consecutive sentences on the narrative line do not move backwards in time. That check needs two qualifications before it is worth running.

Apply the timeline rule only to the sequence expected to be chronological. Reports may include a marked flashback or lead with the outcome, and different orders can be appropriate for different documents and readers.

It needs a flashback marker. Our report contains a legitimate backward step to 3 March, flagged by an explicit date and by past perfect aspect. The check has to consult that marker, which means it depends on an annotation, which means it inherits the annotation's errors.

PythonIn [25]
CollapseExpand
day = {"S1": 12, "S2": 12, "S3": 12, "S4": 3, "S5": 12, "S6": 19}
clock = {
    "S1": 6 * 60 + 40,
    "S2": 6 * 60 + 41,
    "S3": None,
    "S4": None,
    "S5": 6 * 60 + 52,
    "S6": None,
}
flashback = {"S4"}


def timeline_issues(order):
    ids = [SENT_IDS[i] for i in order if SENT_IDS[i] not in flashback]
    issues = []
    for left, right in zip(ids, ids[1:]):
        if day[left] > day[right]:
            issues.append(
                f"{left} on day {day[left]} sits before {right} on day {day[right]}"
            )
        elif (
            day[left] == day[right]
            and clock[left] is not None
            and clock[right] is not None
        ):
            if clock[left] > clock[right]:
                issues.append(
                    f"{left} and {right} are in the wrong clock order"
                )
    return issues

Causal direction

A second check compares mention positions for the fixed annotated cause edges. On the assumed chronological narrative spine, it flags a cause appearing after its effect. This helper checks order of mention. Checking the event times would require a separate rule.

PythonIn [26]
CollapseExpand
relations = [
    {
        "id": "R1",
        "a": "S1",
        "b": "S2",
        "sense": "Temporal.Asynchronous.Precedence",
        "cause": None,
    },
    {
        "id": "R3",
        "a": "S2",
        "b": "S3",
        "sense": "Contingency.Cause.Result",
        "cause": "S2",
    },
    {
        "id": "R4",
        "a": "S3",
        "b": "S4",
        "sense": "Expansion.Conjunction",
        "cause": None,
    },
    {
        "id": "R6",
        "a": "S5",
        "b": "S6",
        "sense": "Temporal.Asynchronous.Precedence",
        "cause": None,
    },
]


def causal_issues(order):
    ids = [SENT_IDS[i] for i in order]
    position = {sid: i for i, sid in enumerate(ids)}
    issues = []
    for rel in relations:
        if rel["cause"] is None:
            continue
        effect = rel["b"] if rel["cause"] == rel["a"] else rel["a"]
        if position[rel["cause"]] > position[effect]:
            issues.append(
                f"{rel['id']} presents cause {rel['cause']} after effect {effect}"
            )
    return issues


check_rows = []
for name, order, status in candidates:
    check_rows.append(
        {
            "draft": name,
            "status": status,
            "timeline": " | ".join(timeline_issues(order)) or "ok",
            "causal": " | ".join(causal_issues(order)) or "ok",
        }
    )
ConsoleOut [27]
CollapseExpand
                      draft       status                              timeline                               causal
                   original        valid                                    ok                                   ok
           inspection first        valid                                    ok                                   ok
 operator before inspection        valid                                    ok                                   ok
inspection after conclusion dispreferred                                    ok                                   ok
    closure after diversion      invalid                                    ok R3 presents cause S2 after effect S3
              review second      invalid S6 on day 19 sits before S2 on day 12                                   ok

The pattern of detections is compact enough to read as a matrix. Each row is a candidate ordering, and each column is one of the two global checks.

PythonIn [28]
CollapseExpand
import numpy as np

check_matrix = np.array(
    [
        [
            0 if row["timeline"] == "ok" else 1,
            0 if row["causal"] == "ok" else 1,
        ]
        for row in check_rows
    ]
)
check_labels = [row["draft"] for row in check_rows]
check_columns = ["timeline", "causal"]
VisualizationOut [29]
CollapseExpand
Heatmap showing timeline and causal check failures for six orderings.
Which global checks fire on each candidate ordering. A filled cell marks a detected failure. The timeline check catches the review placed before the events it follows, and the causal check catches the closure placed after the diversion. The timeline check skips the inspection sentence because it is marked as a flashback. The causal check has no edge involving that sentence.

The "closure after diversion" draft is caught by the causal check, because S2 is annotated as the cause of S3 and now appears after it. The "review second" draft is caught by the timeline check, because the review on 19 March is placed before events on 12 March. Those are two genuine detections.

The inspection-after-conclusion draft passes both checks. The timeline checker leaves the designated flashback outside the chronological sequence regardless of its position. That separately marked inspection is why the checker misses that providing the background after the conclusion changes how readers encounter it.

The flashback annotation stays attached to S4 when the sentence moves. In the original draft the inspection interrupts the account of 12 March. At the end of the reordered draft it supplies retrospective background after the conclusion. The chronology helper applies the same exclusion in both positions.

The checks have different inputs. The causal helper does nothing for a pair without a known cause edge. The timeline helper compares consecutive entries on the non-flashback sequence. It can miss a same-day inversion when an untimed sentence separates the two known clocks.

Support before conclusion

A style check can ask where a conclusion appears relative to its supporting material. Decide whether the genre expects grounds first or permits an early conclusion.

A legal memorandum or a news lede can state a conclusion first and provide support later. In a report meant to present evidence before its conclusion, identify the supporting spans before testing their order.

The fixture presents the incident observations before the review. Moving the inspection after the conclusion delays background about the bypass loop while leaving the incident observations in place. A style check can flag that order for an editor to assess.

Identify the rule behind a flag before editing. For an apparent date conflict, verify that the time expressions refer to the expected events and that the narration follows the assumed chronology. For a style flag, ask whether the ordering fits the genre and supplies context when the intended reader needs it.

Contradiction and repeated facts

Checking for contradiction requires a representation of the document’s commitments. Entity roles and relation labels alone leave the polarity, scope, and attribution of those commitments unspecified.

In the small example below, each subject and predicate pair is already matched to the same context by hand. The helper compares each occurrence with the most recent occurrence of that pair and reports a polarity change.

PythonIn [30]
CollapseExpand
variant_propositions = [
    ("S4", "loop", "passed inspection", True),
    ("S6", "loop", "behaved as designed", True),
    ("S4-revised", "loop", "passed inspection", False),
    ("S6-revised", "valve", "behaved as designed", True),
    ("S2-revised", "valve", "behaved as designed", False),
]


def contradictions(props):
    seen = {}
    found = []
    for sid, subject, predicate, polarity in props:
        key = (subject, predicate)
        if key in seen and seen[key][1] != polarity:
            found.append((seen[key][0], sid, key))
        seen[key] = (sid, polarity)
    return found
ConsoleOut [31]
CollapseExpand
Propositions in the variant draft
  S4: asserts that the loop passed inspection
  S6: asserts that the loop behaved as designed
  S4-revised: denies that the loop passed inspection
  S6-revised: asserts that the valve behaved as designed
  S2-revised: denies that the valve behaved as designed

Contradictions found: 2
  S4 and S4-revised disagree about loop / passed inspection
  S6-revised and S2-revised disagree about valve / behaved as designed

Two statements that the same loop passed and failed the same 3 March inspection conflict if they make opposite claims about the same result under the same conditions. A 3 March pass and a 10 March failure can both be true. When normalizing real text, preserve the event identity, time, attribution, scope, and the document’s commitment. The helper above reports changes in polarity along the encountered sequence. To list every conflicting pair, retain all occurrences for the matched proposition.

Normalization can fail in both directions. Paraphrases can produce different predicate strings for the same assertion. Identical strings can refer to different events, times or senses. The toy code avoids those decisions by using hand-supplied propositions.

Repetition can require the same proposition matching. When a draft asserts the same fact twice in different words, first establish that the two mentions express the same commitment. Then decide whether the restatement helps readers or can be removed.

PythonIn [32]
CollapseExpand
ROLE_CODES = {"-": 0, "X": 1, "O": 2, "S": 3}

matrix_original = np.array(
    [[ROLE_CODES[grid[r][e]] for e in entities] for r in range(len(grid))]
)

pert_order = [0, 2, 1, 3, 4, 5]
pert_grid = build_grid([SENT_IDS[i] for i in pert_order], mentions, entities)
pert_labels = [SENT_IDS[i] for i in pert_order]
matrix_perturbed = np.array(
    [
        [ROLE_CODES[pert_grid[r][e]] for e in entities]
        for r in range(len(pert_grid))
    ]
)
VisualizationsOut [34]
CollapseExpand
Six by six grid showing subject, object, other, and absent roles for six entities.
Entity grid for the incident report in its original order. Rows are sentence positions, columns are entities, and each letter gives the grammatical role of that entity in that sentence. A hyphen means the entity is not mentioned.
Entity grid with rows S2 and S3 swapped and the entity columns in their original order.
The same sentences with the diversion sentence placed before the valve closure sentence. Two rows move while the columns stay aligned by entity.

Swapping S2 and S3 changes the roles shown at eight of the 36 grid positions. The reordered draft has the largest pooled-score increase, about 0.175. The scorer uses the changed role pairs. Testing the presentation order of the cause and effect requires the separate annotation that the closure caused the diversion.

Comments

Add to the conversation

A question, a correction, or an example from your own work.

No comments yet. Be the first to share your thoughts!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy