| build_trace_data |
Ran ran; our contract draft was wrong, not the code |
chuckmy/agentic-translator/tracelog.py code served (permissive licence) · get_code("d8a7bebcf21eb5ea") How it ranRan 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 torch
import numpy as np
from dataclasses import dataclass, field
from typing import Optional
torch.manual_seed(0)
# Define minimal stand-in classes to match the DocumentResult structure
@dataclass
class Segment:
text: str
id: int
@dataclass
class Chunk:
id_range: tuple
para_idx: int
segments: list = field(default_factory=list)
text: str = "Source text for chunk"
@dataclass
class StageUsage:
data: dict = field(default_factory=dict)
def get(self, key, default=None):
return self.data.get(key, default)
@dataclass
class Stage:
name: str
output: Optional[str] = None
duration_s: float = 1.5
usage: dict = field(default_factory=dict)
@dataclass
class Memory:
proper_nouns: dict = field(default_factory=dict)
style_decisions: dict = field(default_factory=dict)
summary: str = "Memory summary"
chunks_completed: int = 1
@dataclass
class ProcessResult:
final_translation: str = "Final translated text"
iterations: int = 2
accepted: bool = True
convergence_status: str = "converged"
score_history: list = field(default_factory=list)
identification: str = "chunk_001"
stages: list = field(default_factory=list)
@dataclass
class DocumentResult:
chunks: list = field(default_factory=list)
chunk_results: list = field(default_factory=list)
memory: Memory = field(default_factory=Memory)
final_translation: str = "Complete document translation"
# Build minimal test data
segment1 = Segment(text="segment text", id=1)
segment2 = Segment(text="another segment", id=2)
chunk = Chunk(
id_range=(1, 10),
para_idx=0,
segments=[segment1, segment2],
text="This is source text for the chunk"
)
# Create stages: one generation and one verification
gen_stage = Stage(
name="generation",
output="Generated translation text",
duration_s=1.0,
usage={"input_tokens": 50, "output_tokens": 45}
)
ver_output = {
"score": 85.5,
"legacy_score": 80.0,
"penalty": 5.0,
"source_length": 32,
"quality_band": "high",
"verdict": "accept",
"accept_threshold": 80.0,
"errors": [
{
"severity": "major",
"category": "terminology",
"spec_section": "Section 2.1",
"span": "word",
"explanation": "Incorrect term used"
}
],
"spec_compliance": {
"concerns": ["Concern 1", "Concern 2"],
"checked_sections": ["Section A", "Section B"]
},
"summary": "Verification completed successfully"
}
ver_stage = Stage(
name="verification",
output=ver_output,
duration_s=0.8,
usage={"input_tokens": 60, "output_tokens": 40}
)
process_result = ProcessResult(
final_translation="Final translated chunk",
iterations=1,
accepted=True,
convergence_status="converged",
score_history=[85.5],
identification="chunk_id_001",
stages=[gen_stage, ver_stage]
)
document_result = DocumentResult(
chunks=[chunk],
chunk_results=[process_result],
memory=Memory(
proper_nouns={"John": "John"},
style_decisions={"formality": "formal"},
summary="Processing summary",
chunks_completed=1
),
final_translation="Complete translated document"
)
run_meta = {
"run_id": "run_001",
"timestamp": "2024-01-01T00:00:00Z",
"model": "test_model",
"language_pair": "en-es"
}
ARGS = {
"result": document_result,
"run_meta": run_meta
}
- 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 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
|
| compute_hash |
Ran ran; our contract draft was wrong, not the code |
chuckmy/agentic-translator/model.py code served (permissive licence) · get_code("2f4ed890aae12545") How it ranRan 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.
import tempfile
from pathlib import Path
import os
# Create a temporary directory structure with some test files
temp_dir = tempfile.mkdtemp()
root = Path(temp_dir)
# Create subdirectories and files
subdirs_to_create = ('spec', 'glossary', 'tm', 'style', 'decisions')
for subdir in subdirs_to_create:
sub_path = root / subdir
sub_path.mkdir(exist_ok=True)
# Create a few test files in each subdirectory
(sub_path / 'file1.txt').write_text(f'content for {subdir} file1')
(sub_path / 'file2.md').write_text(f'content for {subdir} file2')
# Create nested directory
nested = sub_path / 'nested'
nested.mkdir(exist_ok=True)
(nested / 'nested_file.txt').write_text(f'nested content in {subdir}')
# Also create a .sqlite file that should be ignored
(root / 'spec' / 'ignored.sqlite').write_text('should be ignored')
# Create a hidden file that should be ignored
(root / 'glossary' / '.hidden').write_text('should be ignored')
ARGS = {
'root': root,
'subdirs': ('spec', 'glossary', 'tm', 'style', 'decisions')
}
- 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
|
| parse_pair_table |
Ran ran; our contract draft was wrong, not the code |
chuckmy/agentic-translator/references.py code served (permissive licence) · get_code("5edc20401eca868c") How it ranRan 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 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 csv
import io
# The function parse_pair_table takes a single parameter: text (a string)
# It parses TSV or CSV formatted text with two columns and returns a list of tuples
# Test with a simple TSV example with a header row
text_tsv_with_header = """source\ttarget
hello\tworld
foo\tbar
apple\torange"""
# Alternative: CSV format without header
text_csv_no_header = """alpha,beta
one,two
three,four"""
# Alternative: CSV with header that should be skipped
text_csv_with_header = """source,target
dog,cat
bird,fish"""
# Alternative: empty string
text_empty = ""
# Alternative: minimal valid input
text_minimal = "a\tb"
ARGS = {
"text": text_tsv_with_header
}
- 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 list, ndim 2, 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
|
| provider_label |
Ran ran; our contract draft was wrong, not the code |
chuckmy/agentic-translator/api.py code served (permissive licence) · get_code("ad7991cb4ae9e2ec") How it ranRan 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 os
# Set up environment variable for provider
os.environ['LLM_PROVIDER'] = 'anthropic'
# Define ARGS dict with all parameters for provider_label
ARGS = {
'provider': None
}
- 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
|
| provider_placeholder |
Ran ran; our contract draft was wrong, not the code |
chuckmy/agentic-translator/api.py code served (permissive licence) · get_code("4237a21c0dd81aef") How it ranRan 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 os
# Set up environment variable for provider
os.environ['LLM_PROVIDER'] = 'anthropic'
# ARGS dict mapping all parameters of provider_placeholder
ARGS = {
'provider': None # Tests the default case where provider is None
}
- 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
|
| split_into_chunks |
Ran ran; our contract draft was wrong, not the code |
chuckmy/agentic-translator/chunker.py code served (permissive licence) · get_code("c58837277e00d2ee") How it ranRan 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 dataclasses import dataclass, field
_PARA_SPLIT = re.compile('\\n\\s*\\n+')
_SENT_SPLIT = re.compile('(?<=[。!?.!?])(?=\\s|[「『\\"\\(\\[]|$)|(?<=[。!?])')
@dataclass
class Segment:
"""One sentence-sized translation unit."""
para_idx: int
sent_idx: int
text: str
@property
def id(self) -> str:
return f'P{self.para_idx}.S{self.sent_idx}'
@dataclass
class Chunk:
"""A group of contiguous segments from the same paragraph."""
index: int
segments: list[Segment] = field(default_factory=list)
@property
def text(self) -> str:
return ' '.join((s.text for s in self.segments))
@property
def id_range(self) -> str:
if not self.segments:
return ''
if len(self.segments) == 1:
return self.segments[0].id
return f'{self.segments[0].id}–{self.segments[-1].id}'
@property
def para_idx(self) -> int | None:
return self.segments[0].para_idx if self.segments else None
def _split_sentences(paragraph: str) -> list[str]:
parts = [p.strip() for p in _SENT_SPLIT.split(paragraph) if p and p.strip()]
return parts or [paragraph.strip()]
def split_into_chunks(text: str, *, max_chars: int=1500, max_segments: int=6) -> list[Chunk]:
"""Split text into segment-aware chunks.
Args:
text: source text
max_chars: soft cap on chunk size in characters
max_segments: soft cap on number of sentences per chunk
Returns:
list of Chunk objects, each containing ordered Segments with stable IDs.
Paragraph boundaries are never crossed.
"""
text = text.strip()
if not text:
return []
paragraphs = [p.strip() for p in _PARA_SPLIT.split(text) if p.strip()]
chunks: list[Chunk] = []
chunk_idx = 0
for para_idx, para in enumerate(paragraphs, start=1):
sentences = _split_sentences(para)
para_segments = [Segment(para_idx=para_idx, sent_idx=i, text=s) for i, s in enumerate(sentences, start=1)]
buf: list[Segment] = []
size = 0
for seg in para_segments:
seg_len = len(seg.text)
would_exceed = bool(buf) and (size + seg_len + 1 > max_chars or len(buf) >= max_segments)
if would_exceed:
chunk_idx += 1
chunks.append(Chunk(index=chunk_idx, segments=buf))
buf, size = ([seg], seg_len)
else:
buf.append(seg)
size += seg_len + 1
if buf:
chunk_idx += 1
chunks.append(Chunk(index=chunk_idx, segments=buf))
return chunks
# Test setup code
test_text = """This is the first paragraph with multiple sentences. It contains several sentence-sized units.
This is important text. And more here.
This is a second paragraph. It also has sentences. And some more content follows.
Another sentence here. And yet another one."""
ARGS = {
'text': test_text,
'max_chars': 1500,
'max_segments': 6,
}
- 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 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
|
| split_into_segments |
Ran ran; our contract draft was wrong, not the code |
chuckmy/agentic-translator/chunker.py code served (permissive licence) · get_code("eae3056114508ba3") How it ranRan 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 dataclasses import dataclass, field
_PARA_SPLIT = re.compile('\\n\\s*\\n+')
_SENT_SPLIT = re.compile('(?<=[。!?.!?])(?=\\s|[「『\\"\\(\\[]|$)|(?<=[。!?])')
@dataclass
class Segment:
"""One sentence-sized translation unit."""
para_idx: int
sent_idx: int
text: str
@property
def id(self) -> str:
return f'P{self.para_idx}.S{self.sent_idx}'
def _split_sentences(paragraph: str) -> list[str]:
parts = [p.strip() for p in _SENT_SPLIT.split(paragraph) if p and p.strip()]
return parts or [paragraph.strip()]
def split_into_segments(text: str) -> list[Segment]:
"""Split text into segments without chunk grouping (for inspection/export)."""
text = text.strip()
if not text:
return []
paragraphs = [p.strip() for p in _PARA_SPLIT.split(text) if p.strip()]
segments: list[Segment] = []
for para_idx, para in enumerate(paragraphs, start=1):
for sent_idx, sent in enumerate(_split_sentences(para), start=1):
segments.append(Segment(para_idx=para_idx, sent_idx=sent_idx, text=sent))
return segments
# Setup code to construct valid arguments
test_text = """This is the first paragraph.
It contains multiple sentences!
This is the second paragraph.
With another sentence."""
ARGS = {
"text": test_text
}
- 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 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_api_key |
Not yet run unverified (harvested, no recorded run) |
chuckmy/agentic-translator/api.py code served (permissive licence) · get_code("8501ce77e915517b") How it ran |
| t |
Not yet run unverified (harvested, no recorded run) |
chuckmy/agentic-translator/i18n.py code served (permissive licence) · get_code("4563387a14735df1") How it ran |
| to_excel |
Not yet run unverified (harvested, no recorded run) |
chuckmy/agentic-translator/tracelog.py code served (permissive licence) · get_code("ec6ac1c91cbe1c5b") How it ran |
| to_markdown |
Not yet run unverified (harvested, no recorded run) |
chuckmy/agentic-translator/tracelog.py code served (permissive licence) · get_code("de4a0da62c7a251e") How it ran |