SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2106.09232 · ACL · 2021

TEXT2EVENT: Controllable Sequence-to-Structure Generation for End-to-end Event Extraction

Jin Xu, Yaojie Lu, Hongyu Lin, Xianpei Han, Le Sun, Jialong Tang, Meng Liao, Shaoyi Chen, Annan Li

arXiv · PDF · Open in the Atlas

Code that ran

4 of 4 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (1 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 2 have no contract verdict; 2 failures of our instrument; 0 no recorded run), measured 2026-11-21; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; 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/2106.09232.json · badge: /api/ran/2106.09232.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
luyaojie/text2event marked official in Papers with Code
Papers with Code archive
4 ran · 0 no recorded run
FunctionStatusWhere it lives
ConstraintDecoder Ran
ran on a synthesized input
luyaojie/text2event/extraction/extract_constraint.py
code served (permissive licence) · get_code("c23be3600bcfc6b8")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned NoneType. 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 numpy as np

class MockTokenizer:
    def __init__(self):
        self.vocab = {
            'hello': 0,
            'world': 1,
            'foo': 2,
            'bar': 3,
            'baz': 4,
            '<pad>': 5,
            '<eos>': 6,
            '<bos>': 7,
        }
        self.id_to_token = {v: k for k, v in self.vocab.items()}
    
    def encode(self, text, add_special_tokens=False):
        tokens = text.split()
        ids = [self.vocab.get(token, 0) for token in tokens]
        if add_special_tokens:
            ids = [7] + ids + [6]
        return ids
    
    def convert_ids_to_tokens(self, ids):
        if isinstance(ids, torch.Tensor):
            ids = ids.tolist()
        return [self.id_to_token.get(id, '<unk>') for id in ids]

tokenizer = MockTokenizer()

INIT_ARGS = {
    'tokenizer': tokenizer,
    'source_prefix': 'hello world'
}

METHOD = 'constraint_decoding'

ARGS = {
    'src_sentence': torch.tensor([0, 1, 2, 3]),
    'tgt_generated': torch.tensor([2, 4])
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type NoneType — a NoneType output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a NoneType 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
TreeConstraintDecoder Ran
ran on a synthesized input · constructed an object; no result was computed
luyaojie/text2event/extraction/extract_constraint.py
code served (permissive licence) · get_code("95bd989cb458dd9c")
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 an instance of its own class, TreeConstraintDecoder: the run constructed the object and did not call it, so no result was computed. 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 numpy as np
from typing import List

class MockTokenizer:
    def __init__(self):
        self.pad_token_id = 0
        self.vocab_size = 1000
        self._token_to_id = {
            '<extra_id_0>': 100,
            '<extra_id_1>': 101,
            '<tree-end>': 102,
            'type1': 103,
            'type2': 104,
            'role1': 105,
            'role2': 106,
            'a': 107,
            'b': 108,
        }
        self._id_to_token = {v: k for k, v in self._token_to_id.items()}
    
    def encode(self, text, add_special_tokens=False):
        tokens = text.split()
        return [self._token_to_id.get(t, 200) for t in tokens]
    
    def convert_tokens_to_ids(self, tokens):
        return [self._token_to_id.get(t, 200) for t in tokens]
    
    def convert_ids_to_tokens(self, ids):
        if isinstance(ids, (list, np.ndarray)):
            return [self._id_to_token.get(int(i), f'<id_{i}>') for i in ids]
        return self._id_to_token.get(int(ids), f'<id_{ids}>')

class MockTypeSchema:
    def __init__(self):
        self.type_list = ['type1', 'type2']
        self.role_list = ['role1', 'role2']

ARGS = {
    'tokenizer': MockTokenizer(),
    'type_schema': MockTypeSchema(),
    'source_prefix': 'prefix'
}
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 TreeConstraintDecoder — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a TreeConstraintDecoder 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
generated_search_src_sequence Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
luyaojie/text2event/extraction/extract_constraint.py
code served (permissive licence) · get_code("c1eb6f83232b7f48")
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 os
import torch

debug = True if 'DEBUG' in os.environ else False

def match_sublist(the_list, to_match):
    """

    :param the_list: [1, 2, 3, 4, 5, 6, 1, 2, 4, 5]
    :param to_match: [1, 2]
    :return:
        [(0, 1), (6, 7)]
    """
    len_to_match = len(to_match)
    matched_list = list()
    for index in range(len(the_list) - len_to_match + 1):
        if to_match == the_list[index:index + len_to_match]:
            matched_list += [(index, index + len_to_match - 1)]
    return matched_list

def generated_search_src_sequence(generated, src_sequence, end_sequence_search_tokens=None):
    print(generated, src_sequence) if debug else None
    if len(generated) == 0:
        return src_sequence
    matched_tuples = match_sublist(the_list=src_sequence, to_match=generated)
    valid_token = list()
    for _, end in matched_tuples:
        next_index = end + 1
        if next_index < len(src_sequence):
            valid_token += [src_sequence[next_index]]
    if end_sequence_search_tokens:
        valid_token += end_sequence_search_tokens
    return valid_token


# Setup code
torch.manual_seed(0)

# The function uses:
# - generated: a list that is checked for length and used with match_sublist
# - src_sequence: a list used with match_sublist and indexed
# - end_sequence_search_tokens: optional list that is concatenated if truthy

generated = [1, 2]
src_sequence = [1, 2, 3, 4, 5, 6, 1, 2, 4, 5]
end_sequence_search_tokens = [99, 100]

ARGS = {
    'generated': generated,
    'src_sequence': src_sequence,
    'end_sequence_search_tokens': end_sequence_search_tokens
}
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 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
match_sublist Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
luyaojie/text2event/extraction/extract_constraint.py
code served (permissive licence) · get_code("ced7b26f5b3bb7dd")
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 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

# The function match_sublist takes two list parameters and finds all occurrences
# of to_match as a contiguous sublist within the_list

ARGS = {
    "the_list": [1, 2, 3, 4, 5, 6, 1, 2, 4, 5],
    "to_match": [1, 2]
}
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 list, ndim 2, 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

Also present in other papers' code

Of 4 samples lifted from this paper's linked repositories, 4 carry a function identity and 0 do not. Of the 4 distinct functions with an identity, 1 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 1 later) and 3 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
match_sublist
brick of this paper's assembly: helper
3 other papers
3 later · 1 only as an assembly brick
2203.12277 (2022-03)
Unified Structure Generation for Universal Information Extraction
2023.findings-acl.586 (2023 (year only))
The Devil is in the Details: On the Pitfalls of Event Extraction Evaluation
2305.05711 (2023-05)
CODEIE: Large Code Generation Models are Better Few-Shot Information Extractors

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-21.

Repositories linked to this paper

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

Abstract

Event extraction is challenging due to the complex structure of event records and the semantic gap between text and event. Traditional methods usually extract event records by decomposing the complex structure prediction task into multiple subtasks. In this paper, we propose TEXT2EVENT, a sequence-to-structure generation paradigm that can directly extract events from the text in an end-to-end manner. Specifically, we design a sequence-to-structure network for unified event extraction, a constrained decoding algorithm for event knowledge injection during inference, and a curriculum learning algorithm for efficient model learning. Experimental results show that, by uniformly modeling all tasks in a single model and universally predicting different labels, our method can achieve competitive performance using only record-level annotations in both supervised learning and transfer learning settings.

For agents

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

get_harvested_code_for_paper("2106.09232")
get_code_for_paper("2106.09232")
have("2106.09232")

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

curl https://syntology.ai/api/ran/2106.09232.json

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

[![Syntology run record](https://syntology.ai/api/ran/2106.09232.svg)](https://syntology.ai/paper/2106.09232)

Connect an agent — have() is free.