SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2021.naacl-main.125 · NAACL · 2021

Incorporating Syntax and Semantics in Coreference Resolution with Heterogeneous Graph Attention Network

Trevor Cohn, Fan Jiang

Code that ran

10 of 12 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 8 have no contract verdict; 1 failure of our instrument; 2 no recorded run), measured 2026-11-24; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2021.naacl-main.125.json · badge: /api/ran/2021.naacl-main.125.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
Fantabulous-J/coref-HGAT canonical (classifier label)
classifier basis: census
10 ran · 2 no recorded run
FunctionStatusWhere it lives
b_cubed Ran
ran on a synthesized input
Fantabulous-J/coref-HGAT/metrics.py
code served (permissive licence) · get_code("2773b61d4ec935ce")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

from collections import Counter

# Analyzing the function:
# - clusters: iterable of clusters, each cluster is iterable of mentions
# - mention_to_gold: dict mapping mentions to gold cluster identifiers
# - singleton: boolean flag

# Setting up test data
clusters = [
    [0, 1, 2],      # cluster 1 with 3 mentions
    [3, 4],         # cluster 2 with 2 mentions
    [5],            # singleton cluster
]

mention_to_gold = {
    0: (0,),        # mention 0 belongs to gold cluster (0,)
    1: (0,),        # mention 1 belongs to gold cluster (0,)
    2: (1,),        # mention 2 belongs to gold cluster (1,)
    3: (2,),        # mention 3 belongs to gold cluster (2,)
    4: (2,),        # mention 4 belongs to gold cluster (2,)
    5: (3,),        # mention 5 belongs to gold cluster (3,)
}

ARGS = {
    "clusters": clusters,
    "mention_to_gold": mention_to_gold,
    "singleton": False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
build_dep_tag_vocab Ran
ran on a synthesized input
Fantabulous-J/coref-HGAT/build_dep_tag.py
code served (permissive licence) · get_code("cbc1031e07beb8c8")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

from collections import Counter

# Construct dependencies argument
# The function expects a list of sentence dependencies
# Each sentence dependency is a list of dependencies
# Each dependency is something iterable that will be passed to counter.update()
# Looking at the code, dependency items are used in counter.update(),
# so they should be strings or other hashable items

dependencies = [
    # First sentence - list of dependency tags
    ['nsubj', 'nsubj', 'root', 'obj', 'case'],
    # Second sentence - list of dependency tags
    ['det', 'amod', 'root', 'nmod', 'punct'],
    # Third sentence - with some repeated tags
    ['nsubj', 'aux', 'root', 'obj', 'obl', 'mark'],
]

ARGS = {
    'dependencies': dependencies,
    'vocab_size': 1000,
    'min_freq': 0,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
f1 Ran
ran, honoured the contract we drafted
Fantabulous-J/coref-HGAT/metrics.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from sapienzanlp/bookcoref, is pointer only (licence: NONE) · get_code("5dc251a1bb16c94f")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from sapienzanlp/bookcoref, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_doc_key Ran
ran; our contract draft was wrong, not the code
Fantabulous-J/coref-HGAT/conll.py
code served (permissive licence) · get_code("f300a33fe05fc609")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

def get_doc_key(doc_id, part):
    return '{}_{}'.format(doc_id, int(part))

ARGS = {
    'doc_id': 'doc_123',
    'part': 5
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_sentence_map Ran
ran on a synthesized input
Fantabulous-J/coref-HGAT/minimize.py
code served (permissive licence) · get_code("f4ced68dcb59457a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Analyze function usage:
# - segments: iterable of iterables (len() called on it and each element)
# - sentence_end: sequence with len() and int() conversion, indexable
# - The function maps each token position to a sentence index
# - sentence_end should have same total length as sum of segment lengths
# - Each element of sentence_end is converted to int (boolean-like)

# Create segments: list of lists representing token segments
segments = [
    [1, 2, 3],      # 3 tokens in segment 1
    [4, 5]          # 2 tokens in segment 2
]

# Create sentence_end: 5 elements (3+2), marking sentence boundaries
# sentence_end[i] = 1 means token i ends a sentence, 0 means it doesn't
sentence_end = [0, 0, 1, 1, 0]

ARGS = {
    "segments": segments,
    "sentence_end": sentence_end
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family int — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
normalize_word Ran
ran on a synthesized input
Fantabulous-J/coref-HGAT/extract_constituency.py
code served (permissive licence) · get_code("3b03a04bf9022a1c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

def normalize_word(word, language):
    if language == 'arabic':
        word = word[:word.find('#')]
    if word == '/.' or word == '/?':
        return word[1:]
    else:
        return word

ARGS = {
    'word': 'hello',
    'language': 'english'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
normalize_word Ran
ran on a synthesized input
Fantabulous-J/coref-HGAT/minimize.py
code served (permissive licence) · get_code("3b625164c1147fcf")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

ARGS = {
    'word': '/.',
    'language': 'arabic'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
read_depparse_features Ran
ran on a synthesized input
Fantabulous-J/coref-HGAT/build_dep_tag.py
code served (permissive licence) · get_code("eb7752c09588ad3c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import json
import tempfile
import os

# Create a temporary file with valid depparse features data
temp_dir = tempfile.mkdtemp()
data_file = os.path.join(temp_dir, "depparse_data.jsonl")

# Create sample depparse data
examples = [
    {
        "doc_key": "doc1",
        "depparse_features": [
            [
                {"id": 0, "head_id": 1, "deprel": "nsubj"},
                {"id": 1, "head_id": -1, "deprel": "root"},
                {"id": 2, "head_id": 1, "deprel": "dobj"},
            ],
            [
                {"id": 0, "head_id": 1, "deprel": "det"},
                {"id": 1, "head_id": -1, "deprel": "root"},
            ],
        ]
    },
    {
        "doc_key": "doc2",
        "depparse_features": [
            [
                {"id": 0, "head_id": 1, "deprel": "nsubj"},
                {"id": 1, "head_id": -1, "deprel": "root"},
            ],
        ]
    },
]

# Write examples to the temporary file
with open(data_file, 'w') as f:
    for example in examples:
        f.write(json.dumps(example) + '\n')

ARGS = {
    "data_path": data_file
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
tensorize_mentions Ran
ran on a synthesized input
Fantabulous-J/coref-HGAT/conll_dataloader.py
code served (permissive licence) · get_code("8476e8693c6bf9e0")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 2, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# The function expects 'mentions' which should be an iterable of tuples/pairs
# where each pair is (start, end) - representing mention spans as integers

# Test with a non-empty list of mentions
mentions = [
    (0, 5),
    (10, 15),
    (20, 25),
]

ARGS = {
    "mentions": mentions
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 2, dtype family int — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
truncate_example Ran
ran on a synthesized input
Fantabulous-J/coref-HGAT/conll_dataloader.py
code served (permissive licence) · get_code("e7fa57ebdd9cae71")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import random

torch.manual_seed(0)
random.seed(0)

# Create tensor arguments
# num_sentences = 5, max_training_sentences = 3 (so assertion passes)
# Each sentence has variable length, max_seq_length = 4
num_sentences = 5
max_seq_length = 4
max_training_sentences = 3

input_ids = torch.randint(0, 100, (num_sentences, max_seq_length))
input_mask = torch.ones(num_sentences, max_seq_length)
speaker_ids = torch.randint(0, 5, (num_sentences, max_seq_length))

# text_len: length of each sentence in words
text_len = torch.tensor([3, 2, 4, 2, 3])

# gold_starts and gold_ends: spans in word indices
# Total words = sum(text_len) = 14
total_words = text_len.sum().item()
gold_starts = torch.tensor([0, 5, 8, 11])
gold_ends = torch.tensor([2, 7, 10, 13])
cluster_ids = torch.tensor([0, 1, 0, 2])

# sentence_map and subtoken_map: map words to sentences/subtokens
sentence_map = torch.tensor([0, 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 4, 4, 4])
subtoken_map = torch.tensor([0, 1, 2, 0, 1, 0, 1, 2, 3, 0, 1, 0, 1, 2])

# srl_dict: predicate index -> list of (arg_start, arg_end, label)
srl_dict = {
    1: [(0, 2, "ARG0"), (3, 4, "ARG1")],
    6: [(5, 7, "ARG0"), (8, 9, "ARG1")],
    12: [(11, 12, "ARG0")]
}

# config with max_training_sentences
config = {
    'max_training_sentences': max_training_sentences
}

doc_key = "doc_123"
genre = "news"

ARGS = {
    'doc_key': doc_key,
    'input_ids': input_ids,
    'input_mask': input_mask,
    'text_len': text_len,
    'speaker_ids': speaker_ids,
    'genre': genre,
    'gold_starts': gold_starts,
    'gold_ends': gold_ends,
    'cluster_ids': cluster_ids,
    'sentence_map': sentence_map,
    'subtoken_map': subtoken_map,
    'srl_dict': srl_dict,
    'config': config
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
evaluate_conll Not yet run
unverified (harvested, no recorded run)
Fantabulous-J/coref-HGAT/conll.py
code served (permissive licence) · get_code("9f6278d349e3d625")
How it ran

no invocation recorded.

official_conll_eval Not yet run
unverified (harvested, no recorded run)
Fantabulous-J/coref-HGAT/conll.py
code served (permissive licence) · get_code("63c61dbd046d37df")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 4 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 0 the same month, 4 later) and 7 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
f1 12 other papers
2 dated earlier, 9 later, 1 same year, order not determinable
1804.05392 (2018-04)
Higher-order Coreference Resolution with Coarse-to-fine Inference
1907.10529 (2019-07)
SpanBERT: Improving Pre-training by Representing and Predicting Spans
2109.04901 (2021-09)
Document-level Entity-based Extraction as Template Generation
and 9 more not named here
get_doc_key 8 other papers
2 dated earlier, 5 later, 1 same year, order not determinable
1804.05392 (2018-04)
Higher-order Coreference Resolution with Coarse-to-fine Inference
1907.10529 (2019-07)
SpanBERT: Improving Pre-training by Representing and Predicting Spans
2109.06067 (2021-09)
Packed Levitated Marker for Entity and Relation Extraction
and 5 more not named here
normalize_word 4 other papers
2 dated earlier, 2 later
1804.05392 (2018-04)
Higher-order Coreference Resolution with Coarse-to-fine Inference
1907.10529 (2019-07)
SpanBERT: Improving Pre-training by Representing and Predicting Spans
2202.10710 (2022-02)
Incorporating Constituent Syntax for Coreference Resolution
and 1 more not named here
get_sentence_map 1 other paper
1 later
2202.10710 (2022-02)
Incorporating Constituent Syntax for Coreference Resolution

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-24.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

External syntactic and semantic information has been largely ignored by existing neural coreference resolution models. In this paper, we present a heterogeneous graph-based model to incorporate syntactic and semantic structures of sentences. The proposed graph contains a syntactic sub-graph where tokens are connected based on a dependency tree, and a semantic sub-graph that contains arguments and predicates as nodes and semantic role labels as edges. By applying a graph attention network, we can obtain syntactically and semantically augmented word representation, which can be integrated using an attentive integration layer and gating mechanism. Experiments on the OntoNotes 5.0 benchmark show the effectiveness of our proposed model. 1

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2021.naacl-main.125")
get_code_for_paper("2021.naacl-main.125")
have("2021.naacl-main.125")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2021.naacl-main.125.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2021.naacl-main.125.svg)](https://syntology.ai/paper/2021.naacl-main.125)

Connect an agent — have() is free.