SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2204.13094 · 2022

Unsupervised Word Segmentation using K Nearest Neighbors

arXiv · PDF · Open in the Atlas

Code that ran

7 of 7 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 1 has no contract verdict; 4 failures of our instrument; 0 no recorded run), measured 2026-11-23; 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/2204.13094.json · badge: /api/ran/2204.13094.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
mlspeech/gradseg community (classifier label)
classifier basis not recorded on the link
7 ran · 0 no recorded run
FunctionStatusWhere it lives
boundaries_to_intervals Ran
ran, honoured the contract we drafted
mlspeech/gradseg/eval_segmentation.py
code served (permissive licence) · get_code("5cf9b5e522af96d5")
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 numpy as np

# The function takes a 'boundaries' parameter which is used with np.where(boundaries)[0]
# This means it should be an array-like object that can be converted to a boolean array
# and indexed with np.where to find non-zero positions

# Create a simple boundaries array with some True/False values
boundaries = np.array([False, True, False, True, False, False, True, False])

ARGS = {
    "boundaries": boundaries
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — 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
embed Ran
ran on a synthesized input
mlspeech/gradseg/data_loader.py
code served (permissive licence) · get_code("364cd200bab3e807")
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 ndarray, ndim 1, dtype family float, shape (6,) as a later run recorded it. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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 torch.nn as nn

torch.manual_seed(0)

class MockModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(4, 8)
        self.linear2 = nn.Linear(8, 6)
    
    def extract_features(self, y):
        # Should return (list_of_tensors, something)
        # extract_layer=-1 means last element
        feat1 = self.linear1(y)  # shape: (batch, 8)
        feat2 = self.linear2(feat1)  # shape: (batch, 6)
        # Return as list so we can index with extract_layer=-1
        features = [feat1, feat2]
        return features, None

model = MockModel()

# y should be a 2D array-like that can be converted to tensor
# Function does y = torch.Tensor(y).cuda()
# Then model.extract_features(y) is called
# Result x has shape (batch, features) or (batch, features, spatial)
# x[extract_layer] gets one element from features list
# If feat_idx != -1, it does x[:, :, feat_idx] so needs 3D tensor
# Finally returns x.data.cpu().numpy()[0], so takes first batch element

y = [[1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 7.0, 8.0]]  # batch_size=2, input_dim=4

ARGS = {
    "y": y,
    "model": model,
    "extract_layer": -1,
    "feat_idx": -1
}
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 ndarray, ndim 1, dtype family float, shape (6,) — shape (6,) 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_emb Ran
ran; our contract draft was wrong, not the code
mlspeech/gradseg/data_loader.py
code served (permissive licence) · get_code("a73490164e4bb95c")
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 3, dtype family float; no output shape is stated. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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 torch.nn as nn

torch.manual_seed(0)

class MockModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def extract_features(self, y):
        # Returns tuple of (features_list, something)
        # features_list should be indexable by layer
        # Each feature should have shape (batch, channels, freq) or similar
        batch_size = y.shape[0]
        feat1 = torch.randn(batch_size, 3, 5)
        feat2 = torch.randn(batch_size, 3, 5)
        features_list = [feat1, feat2]
        return features_list, None

# Create model instance
model = MockModel()

# Create sample waveforms - list of 2D arrays (batch_size, length)
waveform1 = [[1.0, 2.0, 3.0, 4.0]]  # shape (1, 4)
waveform2 = [[5.0, 6.0, 7.0, 8.0]]  # shape (1, 4)
wavs = [waveform1, waveform2]

ARGS = {
    'wavs': wavs,
    'model': model,
    'layer': -1,
    'feat_idx': -1
}
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 3, 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_grad_mag Ran
ran, violated the contract we drafted
mlspeech/gradseg/grad_segmenter.py
code served (permissive licence) · get_code("a5c12d20fafb384f")
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 ndarray, ndim 1, dtype family float, shape (2,) 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 numpy as np

def get_grad_mag(e):
    e = np.pad(e, 1, mode='reflect')
    e = e[2:] - e[:-2]
    mag = e ** 2
    return mag.mean(1)

# Construct a small 2D array with shape (batch=2, dim=4)
# The function pads it, computes differences, squares, and averages over axis 1
e = np.random.randn(2, 4).astype(np.float32)

ARGS = {
    'e': e
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (2,) — shape (2,) 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_intervals_from_dir Ran
ran; our contract draft was wrong, not the code
mlspeech/gradseg/eval_segmentation.py
code served (permissive licence) · get_code("54dbd7b3ecbb6448")
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 dict. 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 tempfile
from pathlib import Path
from tqdm import tqdm

# Create a temporary directory with test files
temp_dir = tempfile.TemporaryDirectory()
directory = Path(temp_dir.name)

# Create test .txt files with interval data
file1_path = directory / "file1.txt"
file1_path.write_text("0 100 label_a\n50 150 label_b\n")

file2_path = directory / "file2.txt"
file2_path.write_text("10 50 label_c\n")

file3_path = directory / "file3.txt"
file3_path.write_text("")

# Set up arguments
ARGS = {
    "directory": directory,
    "filenames": None
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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_seg Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
mlspeech/gradseg/grad_segmenter.py
code served (permissive licence) · get_code("4e7fcd91f3f7615d")
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 ndarray, ndim 1, dtype family int, shape (3,) 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 numpy as np

# Read the function to understand what it needs:
# - d: array-like that can be passed to np.argsort()
# - num_words: integer, used in len() comparison
# - min_separation: numeric value, used in np.abs() and .min() comparison

# Create test arguments
d = np.array([0.5, 0.2, 0.9, 0.1, 0.7, 0.3])
num_words = 3
min_separation = 1

ARGS = {
    "d": d,
    "num_words": num_words,
    "min_separation": min_separation,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family int, shape (3,) — shape (3,) 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
intervals_to_boundaries Ran
ran; our contract draft was wrong, not the code
mlspeech/gradseg/eval_segmentation.py
code served (permissive licence) · get_code("bdd3717607f29767")
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 ndarray, ndim 1, dtype family float, shape (8,) 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 numpy as np

# The function takes a list of intervals (tuples/lists with at least 2 elements)
# It accesses intervals[-1][1] to get the max boundary value
# It accesses i[1] for each interval i to index into the boundaries array

intervals = [
    (0, 3),
    (1, 5),
    (2, 8)
]

ARGS = {
    "intervals": intervals
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (8,) — shape (8,) 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

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 6 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 0 the same month, 6 later) and 1 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
boundaries_to_intervals 2 other papers
1 dated earlier, 1 later
2202.11929 (2022-02)
Word Segmentation on Discovered Phone Units with Dynamic Programming and Self-Supervised Scoring
2406.08380 (2024-06)
Towards Unsupervised Speech Recognition Without Pronunciation Models
get_intervals_from_dir 2 other papers
1 dated earlier, 1 later
2202.11929 (2022-02)
Word Segmentation on Discovered Phone Units with Dynamic Programming and Self-Supervised Scoring
2406.08380 (2024-06)
Towards Unsupervised Speech Recognition Without Pronunciation Models
intervals_to_boundaries 2 other papers
1 dated earlier, 1 later
2202.11929 (2022-02)
Word Segmentation on Discovered Phone Units with Dynamic Programming and Self-Supervised Scoring
2406.08380 (2024-06)
Towards Unsupervised Speech Recognition Without Pronunciation Models
get_emb 1 other paper
1 later
2406.08380 (2024-06)
Towards Unsupervised Speech Recognition Without Pronunciation Models
get_grad_mag 1 other paper
1 later
2406.08380 (2024-06)
Towards Unsupervised Speech Recognition Without Pronunciation Models
get_seg 1 other paper
1 later
2406.08380 (2024-06)
Towards Unsupervised Speech Recognition Without Pronunciation Models

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

Repositories linked to this paper

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

Abstract

In this paper, we propose an unsupervised kNN-based approach for word segmentation in speech utterances. Our method relies on self-supervised pre-trained speech representations, and compares each audio segment of a given utterance to its K nearest neighbors within the training set. Our main assumption is that a segment containing more than one word would occur less often than a segment containing a single word. Our method does not require phoneme discovery and is able to operate directly on pre-trained audio representations. This is in contrast to current methods that use a two-stage approach; first detecting the phonemes in the utterance and then detecting word-boundaries according to statistics calculated on phoneme patterns. Experiments on two datasets demonstrate improved results over previous single-stage methods and competitive results on state-of-the-art two-stage methods.

For agents

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

get_harvested_code_for_paper("2204.13094")
get_code_for_paper("2204.13094")
have("2204.13094")

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

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

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

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

Connect an agent — have() is free.