SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2104.08028 · EMNLP · 2021

Back to the Basics: A Quantitative Analysis of Statistical and Graph-Based Term Weighting Schemes for Keyword Extraction

Jose Camacho-Collados, Asahi Ushio, Federico Liberatore

arXiv · PDF · Open in the Atlas

Code that ran

5 of 6 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, 1 violated it and 0 have no contract verdict; 3 failures of our instrument; 1 no recorded run), measured 2026-11-22; 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/2104.08028.json · badge: /api/ran/2104.08028.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
asahi417/kex canonical (classifier label)
classifier basis: census
5 ran · 1 no recorded run
FunctionStatusWhere it lives
average Ran
ran, violated the contract we drafted
asahi417/kex/kex/lexical_specificity.py
code served (permissive licence) · get_code("e1f38a327c9e4190")
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 float, 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 torch
import numpy as np

torch.manual_seed(0)

# The function takes _list and computes sum(_list) / len(_list)
# So _list should be a list of numbers that can be summed and divided

ARGS = {
    "_list": [1, 2, 3, 4, 5]
}
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 float, 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
get_benchmark_dataset Ran
ran; our contract draft was wrong, not the code
asahi417/kex/kex/_get_dataset.py
code served (permissive licence) · get_code("2a230daf58871d61")
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 os
import tempfile
import shutil

# Create a temporary cache directory with mock dataset structure
temp_cache = tempfile.mkdtemp()

# Create a mock dataset structure for 'Inspec'
dataset_name = 'Inspec'
dataset_dir = os.path.join(temp_cache, dataset_name)
os.makedirs(os.path.join(dataset_dir, 'docsutf8'), exist_ok=True)
os.makedirs(os.path.join(dataset_dir, 'keys'), exist_ok=True)

# Create a language file
with open(os.path.join(dataset_dir, 'language.txt'), 'w') as f:
    f.write('en')

# Create a mock document
doc_content = "This is a sample document about machine learning and neural networks"
doc_file = os.path.join(dataset_dir, 'docsutf8', 'doc1.txt')
with open(doc_file, 'w') as f:
    f.write(doc_content)

# Create a corresponding key file
key_content = "machine learning\nneural networks\ndeep learning"
key_file = os.path.join(dataset_dir, 'keys', 'doc1.key')
with open(key_file, 'w') as f:
    f.write(key_content)

# Define ARGS
ARGS = {
    'data': 'Inspec',
    'cache_dir': temp_cache,
    'keep_only_valid_label': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
nltk, requests — 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
lexical_specificity Ran
ran, honoured the contract we drafted
asahi417/kex/kex/lexical_specificity.py
code served (permissive licence) · get_code("9e5455a93fe7e0d8")
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 float, 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 math
from math import log, factorial, log10

# Construct valid arguments for lexical_specificity function
# The function calculates lexical specificity based on corpus statistics

# Parameters:
# T: size of reference corpus (should be large)
# t: size of sub-corpus (t <= T)
# f: frequency of word in reference corpus
# k: frequency of word in sub-corpus (k <= f)
# lim: limit for using Stirling approximation (default 400)

ARGS = {
    'T': 10000,      # reference corpus size
    't': 5000,       # sub-corpus size (t <= T)
    'f': 150,        # frequency in reference corpus
    'k': 75,         # frequency in sub-corpus (k <= f)
    'lim': 400       # Stirling approximation limit
}
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 float, 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
preprocess_source Ran
ran; our contract draft was wrong, not the code
asahi417/kex/kex/_get_dataset.py
code served (permissive licence) · get_code("c155efc7311f10e9")
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

ARGS = {
    'string': 'This is a test -lrb- with -rrb- escaped -lsb- punctuation -rsb- marks -lcb- and -rcb- more'
}
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
split_for_keywords Ran
ran; our contract draft was wrong, not the code
asahi417/kex/kex/_get_dataset.py
code served (permissive licence) · get_code("a125eaf7f2809814")
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
from nltk.stem.porter import PorterStemmer

STEMMER = PorterStemmer()

def split_for_keywords(string):

    def cleaner(_string):
        _string = re.sub('\\A\\s*', '', _string)
        _string = re.sub('\\s*\\Z', '', _string)
        _string = _string.replace('\n', ' ').replace('\t', '')
        _string = re.sub('\\s{2,}', ' ', _string)
        _string = ' '.join(list(map(lambda x: STEMMER.stem(x), _string.split(' '))))
        return _string
    keys = list(filter(lambda x: len(x) > 0, [cleaner(s) for s in re.split('[\n,]', string)]))
    return list(set(keys))

ARGS = {
    "string": "machine learning, deep neural networks\nartificial intelligence, data science"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
nltk — 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
get_stopwords_list Not yet run
unverified (harvested, no recorded run)
asahi417/kex/kex/_stopwords.py
code served (permissive licence) · get_code("627cbe400032a3fe")
How it ran

no invocation recorded.

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 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 6 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

Term weighting schemes are widely used in Natural Language Processing and Information Retrieval. In particular, term weighting is the basis for keyword extraction. However, there are relatively few evaluation studies that shed light about the strengths and shortcomings of each weighting scheme. In fact, in most cases researchers and practitioners resort to the wellknown tf-idf as default, despite the existence of other suitable alternatives, including graphbased models. In this paper, we perform an exhaustive and large-scale empirical comparison of both statistical and graph-based term weighting methods in the context of keyword extraction. Our analysis reveals some interesting findings such as the advantages of the lessknown lexical specificity with respect to tf-idf, or the qualitative differences between statistical and graph-based methods. Finally, based on our findings we discuss and devise some suggestions for practitioners. 1

For agents

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

get_harvested_code_for_paper("2104.08028")
get_code_for_paper("2104.08028")
have("2104.08028")

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

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

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

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

Connect an agent — have() is free.