SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1901.00158 · 2019

Text Infilling

arXiv · PDF · Open in the Atlas

Code that ran

3 of 4 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; 0 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 0 failures of our instrument; 1 no recorded run), measured 2026-11-22; 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/1901.00158.json · badge: /api/ran/1901.00158.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
VegB/Text_Infilling canonical (classifier label)
classifier basis: census
3 ran · 1 no recorded run
FunctionStatusWhere it lives
bleu_tokenize Ran
ran on a synthesized input
VegB/Text_Infilling/text_infilling/bleu_tool.py
code served (permissive licence) · get_code("b31f48e2429e5a6a")
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 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.

import re
import sys
import unicodedata
import six

class UnicodeRegex(object):
    """Ad-hoc hack to recognize all punctuation and symbols."""

    def __init__(self):
        punctuation = self.property_chars('P')
        self.nondigit_punct_re = re.compile('([^\\d])([' + punctuation + '])')
        self.punct_nondigit_re = re.compile('([' + punctuation + '])([^\\d])')
        self.symbol_re = re.compile('([' + self.property_chars('S') + '])')

    def property_chars(self, prefix):
        return ''.join((six.unichr(x) for x in range(sys.maxunicode) if unicodedata.category(six.unichr(x)).startswith(prefix)))

uregex = UnicodeRegex()

def bleu_tokenize(string):
    """Tokenize a string following the official BLEU implementation.

  See https://github.com/moses-smt/mosesdecoder/"
           "blob/master/scripts/generic/mteval-v14.pl#L954-L983
  In our case, the input string is expected to be just one line
  and no HTML entities de-escaping is needed.
  So we just tokenize on punctuation and symbols,
  except when a punctuation is preceded and followed by a digit
  (e.g. a comma/dot as a thousand/decimal separator).

  Note that a numer (e.g. a year) followed by a dot at the end of sentence
  is NOT tokenized,
  i.e. the dot stays with the number because `s/(\\p{P})(\\P{N})/ $1 $2/g`
  does not match this case (unless we add a space after each sentence).
  However, this error is already in the original mteval-v14.pl
  and we want to be consistent with it.

  Args:
    string: the input string

  Returns:
    a list of tokens
  """
    string = uregex.nondigit_punct_re.sub('\\1 \\2 ', string)
    string = uregex.punct_nondigit_re.sub(' \\1 \\2', string)
    string = uregex.symbol_re.sub(' \\1 ', string)
    return string.split()

ARGS = {
    "string": "Hello, world! This is a test. The year is 2024."
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
six — 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 float — 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
bleu_wrapper Ran
ran on a synthesized input
VegB/Text_Infilling/text_infilling/bleu_tool.py
code served (permissive licence) · get_code("e3c57c765b27f0ff")
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 float32, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 collections
import math
import re
import sys
import unicodedata
import numpy as np
import six
from six.moves import xrange
from six.moves import zip
import tempfile
import os

# Create temporary files for testing
temp_dir = tempfile.mkdtemp()
ref_file = os.path.join(temp_dir, "ref.txt")
hyp_file = os.path.join(temp_dir, "hyp.txt")

# Write sample reference translations
with open(ref_file, 'w') as f:
    f.write("the cat sat on the mat\n")
    f.write("hello world\n")

# Write sample hypothesis translations
with open(hyp_file, 'w') as f:
    f.write("the cat is on the mat\n")
    f.write("hello world\n")

ARGS = {
    'ref_filename': ref_file,
    'hyp_filename': hyp_file,
    'case_sensitive': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, six — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float32, ndim 0, dtype family float, shape () — shape () as a later run recorded it
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
compute_bleu Ran
ran on a synthesized input
VegB/Text_Infilling/text_infilling/bleu_tool.py
code served (permissive licence) · get_code("dda226c5d7902119")
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 float32, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 collections
import math
import numpy as np
from six.moves import xrange
from six.moves import zip

# Setup: Create small tokenized reference and translation corpora
# Each reference/translation is a list of tokens (strings or ints)

reference_corpus = [
    ['the', 'cat', 'sat', 'on', 'the', 'mat'],
    ['hello', 'world']
]

translation_corpus = [
    ['the', 'cat', 'sat', 'on', 'mat'],
    ['hello', 'world', 'test']
]

max_order = 4
use_bp = True

ARGS = {
    'reference_corpus': reference_corpus,
    'translation_corpus': translation_corpus,
    'max_order': max_order,
    'use_bp': use_bp
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, six — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float32, ndim 0, dtype family float, shape () — shape () as a later run recorded it
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
transform_input_with_is_missing_token Not yet run
unverified (harvested, no recorded run)
VegB/Text_Infilling/text_infilling/data_utils.py
code served (permissive licence) · get_code("3d7e583f31bdabd7")
How it ran

no invocation recorded.

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, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 4 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.

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

Repositories linked to this paper

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

Abstract

Recent years have seen remarkable progress of text generation in different contexts, such as the most common setting of generating text from scratch, and the emerging paradigm of retrieval-and-rewriting. Text infilling, which fills missing text portions of a sentence or paragraph, is also of numerous use in real life, yet is under-explored. Previous work has focused on restricted settings by either assuming single word per missing portion or limiting to a single missing portion to the end of the text. This paper studies the general task of text infilling, where the input text can have an arbitrary number of portions to be filled, each of which may require an arbitrary unknown number of tokens. We study various approaches for the task, including a self-attention model with segment-aware position encoding and bidirectional context modeling. We create extensive supervised data by masking out text with varying strategies. Experiments show the self-attention model greatly outperforms others, creating a strong baseline for future research.

For agents

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

get_harvested_code_for_paper("1901.00158")
get_code_for_paper("1901.00158")
have("1901.00158")

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

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

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

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

Connect an agent — have() is free.