| detect_laterality |
Ran ran; our contract draft was wrong, not the code |
GIND123/CBCT-Clinical-Reasoner/src/cbct_reasoner/ontology.py code served (permissive licence) · get_code("3ace7854e7c7c3ab") 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 torch
import re
LEFT_RE = re.compile('\\b(?:left|sinistr\\w*|lt\\.?)\\b', re.IGNORECASE)
RIGHT_RE = re.compile('\\b(?:right|dextr\\w*|rt\\.?)\\b', re.IGNORECASE)
BILATERAL_RE = re.compile('\\b(?:bilateral\\w*|both\\s+sides?|on\\s+both)\\b', re.IGNORECASE)
def detect_laterality(text: str) -> str:
if BILATERAL_RE.search(text):
return 'bilateral'
left, right = (bool(LEFT_RE.search(text)), bool(RIGHT_RE.search(text)))
if left and right:
return 'bilateral'
if left:
return 'left'
if right:
return 'right'
return 'unspecified'
ARGS = {
'text': 'The patient has left-sided pain affecting the left knee and right ankle.'
}
- 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
|
| extract_measurements |
Ran ran, honoured the contract we drafted |
GIND123/CBCT-Clinical-Reasoner/src/cbct_reasoner/ontology.py code served (permissive licence) · get_code("ed498a49996b8b45") 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 re
MEASUREMENT_RE = re.compile('\\b(\\d+(?:[.,]\\d+)?)\\s*(mm|cm|millimet\\w*|centimet\\w*)\\b', re.IGNORECASE)
def extract_measurements(text: str) -> tuple[float, ...]:
values: list[float] = []
for amount, unit in MEASUREMENT_RE.findall(text):
value = float(amount.replace(',', '.'))
values.append(value * 10.0 if unit.lower().startswith(('cm', 'centi')) else value)
return tuple(values)
# Setup code
ARGS = {
'text': 'The table is 120cm wide and 50mm tall, measuring 5.5 centimeters in depth'
}
- 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
|
| find_single_cbct |
Ran ran; our contract draft was wrong, not the code |
GIND123/CBCT-Clinical-Reasoner/src/cbct_reasoner/grand_challenge.py code served (permissive licence) · get_code("14568c6546772c53") 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 PosixPath. 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
# Create a temporary directory with a single CBCT file
temp_dir = tempfile.TemporaryDirectory()
temp_path = Path(temp_dir.name)
# Create a single .mha file (a valid CBCT volume format)
cbct_file = temp_path / "scan.mha"
cbct_file.touch()
ARGS = {
"input_dir": temp_path
}
- 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 PosixPath — a PosixPath output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a PosixPath 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
|
| generate_report |
Ran ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT) |
GIND123/CBCT-Clinical-Reasoner/src/cbct_reasoner/grand_challenge.py code served (permissive licence) · get_code("61030aa4e4cd5be7") 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 torch
import tempfile
from pathlib import Path
from unittest.mock import Mock, MagicMock
torch.manual_seed(0)
# Create a mock InferenceBundle class that satisfies the function's usage
class MockInferenceBundle:
@staticmethod
def load(model_dir: Path):
"""Mock load method that returns an InferenceBundle instance"""
bundle = MockInferenceBundle()
return bundle
def predict(self, cbct: Path) -> str:
"""Mock predict method that returns a string report"""
return "Mock CBCT Analysis Report: Normal findings."
# Patch the InferenceBundle in the module before the function is called
import sys
from unittest.mock import MagicMock
mock_module = MagicMock()
mock_module.InferenceBundle = MockInferenceBundle
sys.modules['cbct_reasoner'] = MagicMock()
sys.modules['cbct_reasoner.pipeline'] = MagicMock()
sys.modules['cbct_reasoner.pipeline.bundle'] = mock_module
# Create temporary directories to use as Path objects
with tempfile.TemporaryDirectory() as tmpdir:
cbct_path = Path(tmpdir) / "sample_cbct.nii.gz"
model_dir_path = Path(tmpdir) / "model_weights"
# Create the directories
cbct_path.parent.mkdir(parents=True, exist_ok=True)
model_dir_path.mkdir(parents=True, exist_ok=True)
# Create dummy files so the paths exist
cbct_path.touch()
(model_dir_path / "config.json").touch()
ARGS = {
"cbct": cbct_path,
"model_dir": model_dir_path,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- cbct_reasoner, 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
|
| header_features |
Ran ran, violated the contract we drafted |
GIND123/CBCT-Clinical-Reasoner/src/cbct_reasoner/decode/adaptive.py code served (permissive licence) · get_code("a548d9117a6e4b03") 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 ndarray, ndim 1, dtype family float, shape (9,) 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
from collections.abc import Sequence
# Construct valid arguments for header_features
size_zyx = [10.5, 20.3, 15.7] # Three dimensions: Z, Y, X
spacing_zyx = [1.0, 0.5, 0.5] # Three spacing values
ARGS = {
"size_zyx": size_zyx,
"spacing_zyx": spacing_zyx,
}
- 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 (9,) — shape (9,) 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
|
| load_dotenv |
Ran ran; our contract draft was wrong, not the code |
GIND123/CBCT-Clinical-Reasoner/src/cbct_reasoner/config.py code served (permissive licence) · get_code("ffd0c72a3276fba1") 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 os
from pathlib import Path
import tempfile
# Create a temporary .env file for testing
with tempfile.NamedTemporaryFile(mode='w', suffix='.env', delete=False) as f:
f.write("KEY1=value1\n")
f.write("KEY2=value2\n")
f.write("# This is a comment\n")
f.write("export KEY3=value3\n")
f.write('KEY4="quoted_value"\n')
f.write("KEY5='single_quoted'\n")
f.write("\n")
f.write("KEY6=value_with_spaces\n")
temp_env_path = f.name
ARGS = {
"path": temp_env_path,
"override": False,
}
- 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 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
|
| normalize_text |
Ran ran; our contract draft was wrong, not the code |
GIND123/CBCT-Clinical-Reasoner/src/cbct_reasoner/text.py code served (permissive licence) · get_code("fd60e97a9ffd66e8") 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 re
import unicodedata
_WHITESPACE_RE = re.compile('\\s+')
def normalize_text(text: str) -> str:
"""Collapse whitespace and unify Unicode punctuation without altering meaning."""
if not text:
return ''
cleaned = unicodedata.normalize('NFKC', text.replace('\x00', ' '))
cleaned = cleaned.translate(str.maketrans({''': "'", ''': "'", '"': '"', '"': '"', '–': '-', '—': '-', '\xa0': ' '}))
return _WHITESPACE_RE.sub(' ', cleaned).strip()
ARGS = {
'text': "Hello ''world""—test\x00with whitespace"
}
- 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
|
| plot_dataset |
Ran ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT) |
GIND123/CBCT-Clinical-Reasoner/src/cbct_reasoner/plots.py code served (permissive licence) · get_code("65bb285fb83937a0") 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.
from pathlib import Path
from collections.abc import Sequence
from typing import Any
import numpy as np
# Create stand-in classes for the entry objects
class MockEntry:
def __init__(self, center: str, reports: list, reference: str):
self.center = center
self.reports = reports
self.reference = reference
# Create mock implementations of the imported functions
class MockTokenizer:
@staticmethod
def tokenize(text: str) -> list[str]:
return text.split()
class MockTextUtils:
@staticmethod
def split_phrases(text: str) -> list[str]:
return [s.strip() for s in text.split('.') if s.strip()]
# Monkey patch the imports to avoid import errors
import sys
from unittest.mock import MagicMock
mock_metrics = MagicMock()
mock_metrics.official.tokenize = MockTokenizer.tokenize
mock_text = MagicMock()
mock_text.split_phrases = MockTextUtils.split_phrases
sys.modules['cbct_reasoner'] = MagicMock()
sys.modules['cbct_reasoner.metrics'] = MagicMock()
sys.modules['cbct_reasoner.metrics.official'] = mock_metrics
sys.modules['cbct_reasoner.text'] = mock_text
# Create sample entries
entries = [
MockEntry(
center="Center A",
reports=["report 1", "report 2"],
reference="This is a dental finding. The tooth shows decay. Treatment recommended."
),
MockEntry(
center="Center A",
reports=["report 1"],
reference="Normal dental exam. All teeth appear healthy. No issues detected."
),
MockEntry(
center="Center B",
reports=["report 1", "report 2", "report 3"],
reference="Severe periodontal disease observed. Bone loss evident. Root canal needed. Extraction may be necessary."
),
MockEntry(
center="Center B",
reports=["report 1"],
reference="Minor cavity detected. Filling recommended. Regular brushing advised."
),
]
# Create temporary directory for output
import tempfile
temp_dir = Path(tempfile.gettempdir()) / "plot_dataset_test"
ARGS = {
"entries": entries,
"directory": temp_dir,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- cbct_reasoner, matplotlib, numpy — 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
|
| plot_prototypes |
Ran ran; our contract draft was wrong, not the code |
GIND123/CBCT-Clinical-Reasoner/src/cbct_reasoner/plots.py code served (permissive licence) · get_code("5d50f41aa4d69971") 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 numpy as np
from pathlib import Path
from typing import Any
class MockPrototype:
"""Mock prototype object with required attributes."""
def __init__(self, section: str, prevalence_val: float):
self.section = section
self.prevalence_val = prevalence_val
class MockBank:
"""Mock bank object with required attributes and methods."""
def __init__(self, prototypes: list, prevalence: np.ndarray):
self.prototypes = prototypes
self.prevalence = prevalence
def __len__(self):
return len(self.prototypes)
def __iter__(self):
return iter(self.prototypes)
# Create mock prototypes with different sections
prototypes = [
MockPrototype("section_a", 0.35),
MockPrototype("section_b", 0.25),
MockPrototype("section_a", 0.20),
MockPrototype("section_c", 0.15),
MockPrototype("section_b", 0.05),
]
# Create prevalence array (sorted in some order, will be sorted again in function)
prevalence = np.array([0.35, 0.25, 0.20, 0.15, 0.05])
# Create mock bank
bank = MockBank(prototypes, prevalence)
# Create labels: 5 cases (rows) x 5 prototypes (columns)
# This is a binary matrix where each row represents a case
# and columns represent whether each prototype applies
labels = np.array([
[1, 1, 0, 1, 0],
[1, 0, 1, 0, 1],
[0, 1, 1, 1, 0],
[1, 1, 0, 0, 1],
[1, 0, 1, 1, 0],
], dtype=np.int32)
# Create a temporary directory for output
directory = Path("/tmp/plot_test")
ARGS = {
"bank": bank,
"labels": labels,
"directory": directory,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- matplotlib, numpy — 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
|
| plot_training |
Ran ran; our contract draft was wrong, not the code |
GIND123/CBCT-Clinical-Reasoner/src/cbct_reasoner/plots.py code served (permissive licence) · get_code("d8e8ea25180d5dfa") 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.
from pathlib import Path
import tempfile
ARGS = {
'history': [
{
'fold': 0,
'history': [
{'epoch': 0, 'train_loss': 2.5, 'val_map': 0.45},
{'epoch': 1, 'train_loss': 2.1, 'val_map': 0.52},
{'epoch': 2, 'train_loss': 1.8, 'val_map': 0.58},
]
},
{
'fold': 1,
'history': [
{'epoch': 0, 'train_loss': 2.6, 'val_map': 0.43},
{'epoch': 1, 'train_loss': 2.2, 'val_map': 0.50},
{'epoch': 2, 'train_loss': 1.9, 'val_map': 0.56},
]
}
],
'prior_map': 0.40,
'directory': Path(tempfile.gettempdir()) / 'plot_training_test',
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- matplotlib — 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
|
| select_consensus_report |
Ran ran; our contract draft was wrong, not the code |
GIND123/CBCT-Clinical-Reasoner/src/cbct_reasoner/model.py code served (permissive licence) · get_code("c653b2657242d8bf") 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 re
def select_consensus_report(reports: tuple[str, ...]) -> str:
"""Choose the reference with greatest average token-set agreement."""
if not reports:
raise ValueError('reports cannot be empty')
if len(reports) == 1:
return reports[0]
token_sets = [set(re.findall('\\w+', report.casefold())) for report in reports]
agreement: list[float] = []
for index, tokens in enumerate(token_sets):
scores = []
for other_index, other in enumerate(token_sets):
if index == other_index:
continue
union = tokens | other
scores.append(len(tokens & other) / len(union) if union else 1.0)
agreement.append(sum(scores) / len(scores))
best = max(range(len(reports)), key=lambda index: (agreement[index], len(reports[index])))
return reports[best]
ARGS = {
"reports": (
"The quick brown fox jumps over the lazy dog",
"A quick brown fox jumps over a lazy dog",
"The fast brown fox leaps over the lazy dog"
)
}
- 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_phrases |
Ran ran; our contract draft was wrong, not the code |
GIND123/CBCT-Clinical-Reasoner/src/cbct_reasoner/text.py code served (permissive licence) · get_code("c215557e0762676f") 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
import unicodedata
_ABBREVIATIONS = ('approx', 'cf', 'dr', 'e.g', 'et al', 'fig', 'i.e', 'n', 'no', 'nr', 'prof', 'sig', 'vs')
_ABBREVIATION_RE = re.compile('\\b(' + '|'.join((re.escape(item) for item in _ABBREVIATIONS)) + ')\\.', re.IGNORECASE)
_DECIMAL_RE = re.compile('(?<=\\d)[.,](?=\\d)')
_SENTENCE_END_RE = re.compile('(?<=[.!?])\\s+(?=[A-Z0-9\\"\'(\\[])')
_SEMICOLON_RE = re.compile('\\s*;\\s+')
_WHITESPACE_RE = re.compile('\\s+')
_BULLET_RE = re.compile('^\\s*(?:[-*•–—]|\\(?\\d{1,2}[.)])\\s+')
_PLACEHOLDER_PERIOD = '\x01'
_PLACEHOLDER_DECIMAL = '\x02'
_SPLIT_CONJUNCTIONS = re.compile(',\\s+(?:and|while|whereas)\\s+(?=(?:the|a|an|there|no|both|bilateral|left|right)\\b)', re.IGNORECASE)
_CLAUSE_VERB_RE = re.compile('\\b(?:is|are|was|were|has|have|had|shows?|showed|appears?|presents?|demonstrates?|reveals?|extends?|involves?|measures?|exhibits?|noted|observed|identified|seen|visible|detected|documented|evident|absent|present|confirmed)\\b', re.IGNORECASE)
def normalize_text(text: str) -> str:
"""Collapse whitespace and unify Unicode punctuation without altering meaning."""
if not text:
return ''
cleaned = unicodedata.normalize('NFKC', text.replace('\x00', ' '))
cleaned = cleaned.translate(str.maketrans({''': "'", ''': "'", '"': '"', '"': '"', '–': '-', '—': '-', '\xa0': ' '}))
return _WHITESPACE_RE.sub(' ', cleaned).strip()
def split_sentences(text: str) -> list[str]:
"""Split a narrative report into sentences, protecting decimals and abbreviations."""
normalized = normalize_text(text)
if not normalized:
return []
guarded = _ABBREVIATION_RE.sub(lambda m: m.group(1) + _PLACEHOLDER_PERIOD, normalized)
guarded = _DECIMAL_RE.sub(_PLACEHOLDER_DECIMAL, guarded)
parts = [piece for clause in _SEMICOLON_RE.split(guarded) for piece in _SENTENCE_END_RE.split(clause)]
sentences = []
for part in parts:
restored = part.replace(_PLACEHOLDER_PERIOD, '.').replace(_PLACEHOLDER_DECIMAL, '.')
restored = _BULLET_RE.sub('', restored).strip()
if restored:
sentences.append(restored)
return sentences
def ensure_terminal_period(text: str) -> str:
stripped = text.strip()
if not stripped:
return ''
return stripped if stripped[-1] in '.!?' else stripped + '.'
def split_phrases(text: str, *, split_conjunctions: bool=True) -> list[str]:
"""Segment a report into RadFact-style verifiable phrases.
Multi-finding sentences are broken apart because RadFact scores each finding
independently: one unsupported clause otherwise drags an otherwise-correct
sentence to ``not_entailment``.
"""
phrases: list[str] = []
for sentence in split_sentences(text):
candidates = [sentence]
if split_conjunctions:
parts = [part.strip() for part in _SPLIT_CONJUNCTIONS.split(sentence)]
if len(parts) > 1 and all((_CLAUSE_VERB_RE.search(part) for part in parts)):
candidates = parts
for candidate in candidates:
cleaned = candidate.strip(' ;,')
if len(cleaned.split()) >= 2:
phrases.append(ensure_terminal_period(cleaned))
return phrases
ARGS = {
'text': 'The patient has a small nodule, and the lesion shows no significant change. Dr. Smith noted 3.14 cm findings.',
'split_conjunctions': True
}
- 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_sentences |
Ran ran; our contract draft was wrong, not the code |
GIND123/CBCT-Clinical-Reasoner/src/cbct_reasoner/text.py code served (permissive licence) · get_code("d6c212bac3ad5dfc") 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
import unicodedata
# Define ARGS for split_sentences function
# The function takes one parameter: text (str)
ARGS = {
'text': "Dr. Smith conducted the study (see fig. 1). The results were significant! However, the decimal value was 3.14 and approximately 95% showed improvement. Prof. Johnson et al. noted the findings. The second sentence starts here. A bullet point:\n- First item\n- Second item\nFinal thoughts: e.g., more analysis is needed."
}
- 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
|
| env |
Not yet run unverified (harvested, no recorded run) |
GIND123/CBCT-Clinical-Reasoner/src/cbct_reasoner/config.py code served (permissive licence) · get_code("600ad585cdbdefff") How it ran |
| extract_teeth |
Not yet run unverified (harvested, no recorded run) |
GIND123/CBCT-Clinical-Reasoner/src/cbct_reasoner/ontology.py code served (permissive licence) · get_code("c589e9cb4b7468a9") How it ran |
| fit_gates |
Not yet run unverified (harvested, no recorded run) |
GIND123/CBCT-Clinical-Reasoner/src/cbct_reasoner/decode/adaptive.py code served (permissive licence) · get_code("aa071b9daaec7cbd") How it ran |
| read_header |
Not yet run unverified (harvested, no recorded run) |
GIND123/CBCT-Clinical-Reasoner/src/cbct_reasoner/decode/adaptive.py code served (permissive licence) · get_code("c6d143c611a38649") How it ran |
| require_env |
Not yet run unverified (harvested, no recorded run) |
GIND123/CBCT-Clinical-Reasoner/src/cbct_reasoner/config.py code served (permissive licence) · get_code("ff5930da1f24b320") How it ran |