Skip to content
This repository was archived by the owner on Jul 29, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions backend_old/src/edcmbone/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=28:7 imports_exports=3:1 calls_definitions=0:0
__version__ = "0.1.0"

from .canon import CanonLoader
Expand Down Expand Up @@ -35,3 +36,4 @@
"A_MATRIX", "PROJECTION_MAP", "ALERT_THRESHOLDS", "RISK_TO_ALERT",
"MATRIX_VERSION", "freeze", "diff",
]
# ratios: loc_comments=28:7 imports_exports=3:1 calls_definitions=0:0
2 changes: 2 additions & 0 deletions backend_old/src/edcmbone/canon/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# ratios: loc_comments=2:0 imports_exports=1:1 calls_definitions=0:0
from .loader import CanonLoader

__all__ = ["CanonLoader"]
# ratios: loc_comments=2:0 imports_exports=1:1 calls_definitions=0:0
2 changes: 2 additions & 0 deletions backend_old/src/edcmbone/canon/loader.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=80:79 imports_exports=3:1 calls_definitions=40:15
"""
edcmbone.canon.loader
~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -194,3 +195,4 @@ def meta(self, dataset):
dataset, list(mapping.keys())
))
return mapping[dataset].get("_meta", {})
# ratios: loc_comments=80:79 imports_exports=3:1 calls_definitions=40:15
2 changes: 2 additions & 0 deletions backend_old/src/edcmbone/compress.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=168:115 imports_exports=9:5 calls_definitions=63:11
"""
edcmbone.compress
~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -348,3 +349,4 @@ def compression_stats(original_text, compressed_bytes, parsed):
"bone_stream_huffman_bits": round(bone_huffman_bits, 1),
"bone_stream_savings_pct": round(bone_savings, 2),
}
# ratios: loc_comments=168:115 imports_exports=9:5 calls_definitions=63:11
2 changes: 2 additions & 0 deletions backend_old/src/edcmbone/metrics/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=34:6 imports_exports=6:1 calls_definitions=0:0
from .compute import RoundMetrics, compute_round, compute_transcript, energy_step
from .stats import (
tokenize, ngrams, ttr, repetition_ratio, shannon_entropy,
Expand Down Expand Up @@ -39,3 +40,4 @@
"AxisState", "MetricAxis", "MetricReadout", "ConstraintField", "FieldMotion",
"canonical_axes", "field_motion_fixture", "FIELD_MOTION_FIXTURE_MATRIX",
]
# ratios: loc_comments=34:6 imports_exports=6:1 calls_definitions=0:0
4 changes: 3 additions & 1 deletion backend_old/src/edcmbone/metrics/compute.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=200:145 imports_exports=6:4 calls_definitions=89:20
"""
edcmbone.metrics.compute
~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -423,4 +424,5 @@ def compute_transcript(parsed_transcript, canon=None, alpha=0.85, delta_max=0.3)
prev_kappa = m.kappa
prev_entropy = shannon_entropy(tokenize(" ".join(t.text for t in rnd.turns)))

return results
return results
# ratios: loc_comments=200:145 imports_exports=6:4 calls_definitions=89:20
Comment on lines +427 to +428
2 changes: 2 additions & 0 deletions backend_old/src/edcmbone/metrics/matrix.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=118:125 imports_exports=4:2 calls_definitions=15:2
"""
edcmbone.metrics.matrix
~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -265,3 +266,4 @@ def diff(matrix_a: dict, matrix_b: dict) -> dict:
if wa != wb:
changes[(metric, prim)] = (wa, wb)
return changes
# ratios: loc_comments=118:125 imports_exports=4:2 calls_definitions=15:2
2 changes: 2 additions & 0 deletions backend_old/src/edcmbone/metrics/orthogonality.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=230:94 imports_exports=4:7 calls_definitions=44:25
"""EDCM / UCNS metric orthogonality primitives.

Implements the v0.2 signed-axis model for metric identity and state transport,
Expand Down Expand Up @@ -388,3 +389,4 @@ def canonical_axes() -> Dict[str, MetricAxis]:
"edcm.projection.TBF": MetricAxis("edcm.projection.TBF", "speaker-share fairness projection", "projection", primitive=False),
}
return axes
# ratios: loc_comments=230:94 imports_exports=4:7 calls_definitions=44:25
2 changes: 2 additions & 0 deletions backend_old/src/edcmbone/metrics/projection.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=77:96 imports_exports=4:6 calls_definitions=28:10
"""
edcmbone.metrics.projection
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -214,3 +215,4 @@ def project_transcript(parsed_transcript, layer1_metrics):
for rnd, m in zip(parsed_transcript.rounds, layer1_metrics):
results.append(project(m, rnd.turns))
return results
# ratios: loc_comments=77:96 imports_exports=4:6 calls_definitions=28:10
2 changes: 2 additions & 0 deletions backend_old/src/edcmbone/metrics/risk.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=37:66 imports_exports=2:5 calls_definitions=25:5
"""
edcmbone.metrics.risk
~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -127,3 +128,4 @@ def loop_risk(tokens_a, tokens_b):
rep_ngram = rep_ngram_density(tokens_b, n=3)
cos = cosine_sim(tokens_a, tokens_b)
return clamp(0.5 * rep_b + 0.3 * rep_ngram + 0.2 * cos)
# ratios: loc_comments=37:66 imports_exports=2:5 calls_definitions=25:5
2 changes: 2 additions & 0 deletions backend_old/src/edcmbone/metrics/stats.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=76:84 imports_exports=4:13 calls_definitions=46:14
"""
edcmbone.metrics.stats
~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -206,3 +207,4 @@ def norm_per_100(x, tokens):
if not tokens:
return 0.0
return float(x) * 100.0 / len(tokens)
# ratios: loc_comments=76:84 imports_exports=4:13 calls_definitions=46:14
2 changes: 2 additions & 0 deletions backend_old/src/edcmbone/parser/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=9:0 imports_exports=1:1 calls_definitions=0:0
from .turns_rounds import parse_transcript, ParsedTranscript, Turn, Round, BoneToken, FleshToken

__all__ = [
Expand All @@ -8,3 +9,4 @@
"BoneToken",
"FleshToken",
]
# ratios: loc_comments=9:0 imports_exports=1:1 calls_definitions=0:0
2 changes: 2 additions & 0 deletions backend_old/src/edcmbone/parser/turns_rounds.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=225:119 imports_exports=5:6 calls_definitions=82:26
"""
edcmbone.parser.turns_rounds
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -427,3 +428,4 @@ def _ordered_unique(iterable):
seen.add(item)
result.append(item)
return result
# ratios: loc_comments=225:119 imports_exports=5:6 calls_definitions=82:26
2 changes: 2 additions & 0 deletions backend_old/src/edcmbone/ucns/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=8:1 imports_exports=1:1 calls_definitions=0:0
# edcmbone.ucns — UCNS (Universal Cognitive Notation System) encoders
from .closed_tokens import encode, class_of, feature_payload_of, DISPATCH, CLASS_NAMES

Expand All @@ -8,3 +9,4 @@
"DISPATCH",
"CLASS_NAMES",
]
# ratios: loc_comments=8:1 imports_exports=1:1 calls_definitions=0:0
2 changes: 2 additions & 0 deletions backend_old/src/edcmbone/ucns/closed_tokens.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=351:140 imports_exports=6:3 calls_definitions=70:9
"""
edcmbone — Closed-Token UCNS Encoder

Expand Down Expand Up @@ -572,3 +573,4 @@ def feature_payload_of(obj: UCNSObject) -> Optional[UCNSObject]:
if len(obj.anchors_pos) != 2:
return None
return obj.anchors_pos[1].payload
# ratios: loc_comments=351:140 imports_exports=6:3 calls_definitions=70:9
2 changes: 2 additions & 0 deletions backend_old/src/edcmbone/ucns/ucns_v04.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=118:70 imports_exports=5:6 calls_definitions=40:14
"""
ucns_v04 — UCNS Engine (turn-fraction angle convention)
========================================================
Expand Down Expand Up @@ -226,3 +227,4 @@ def multiply(A: UCNSObject, B: UCNSObject) -> UCNSObject:
anchors_pos=tuple(new_anchors),
faces_pos=tuple(new_faces),
)
# ratios: loc_comments=118:70 imports_exports=5:6 calls_definitions=40:14
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
from pathlib import Path

ROOT = Path(__file__).resolve().parents[1]
BACKEND_SRC = ROOT / "backend" / "src"
BACKEND_SRC = ROOT / "backend_old" / "src"

# BACKEND_SRC must precede ROOT on sys.path: both contain an ``edcmbone``
# package, but only backend/src/edcmbone carries CanonLoader + metrics. ROOT
# package, but only backend_old/src/edcmbone carries CanonLoader + metrics. ROOT
# stays on the path for the top-level test modules (core, engine, ucns_v04,
# closed_tokens); the repo-root ``edcmbone`` package is only ever loaded by
# tests under an explicit alias (see test_ucns_g_schema), never as ``edcmbone``.
Expand Down
2 changes: 1 addition & 1 deletion tests/test_affix_residual_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import sys

ROOT = Path(__file__).resolve().parents[1]
BACKEND_SRC = ROOT / "backend" / "src"
BACKEND_SRC = ROOT / "backend_old" / "src"
if str(BACKEND_SRC) not in sys.path:
sys.path.insert(0, str(BACKEND_SRC))

Expand Down
2 changes: 1 addition & 1 deletion tests/test_apostrophe_normalization_and_tokenization.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

def _parser_word_re():
repo_root = Path(__file__).resolve().parents[1]
src_path = repo_root / "backend" / "src" / "edcmbone" / "parser" / "turns_rounds.py"
src_path = repo_root / "backend_old" / "src" / "edcmbone" / "parser" / "turns_rounds.py"
src = src_path.read_text()
m = re.search(r"_WORD_RE\s*=\s*re\.compile\(r\"([^\"]+)\"\)", src)
assert m, "Could not locate _WORD_RE in parser/turns_rounds.py"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_metric_orthogonality_v02.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from pathlib import Path

ROOT = Path(__file__).resolve().parents[1]
BACKEND_SRC = ROOT / "backend" / "src"
BACKEND_SRC = ROOT / "backend_old" / "src"


def _load_package(package_name: str, package_dir: Path):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_metrics_layer_designation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from pathlib import Path

ROOT = Path(__file__).resolve().parents[1]
BACKEND_SRC = ROOT / "backend" / "src"
BACKEND_SRC = ROOT / "backend_old" / "src"


def _load_package(package_name: str, package_dir: Path):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_polarity_balance.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from pathlib import Path

REPO_ROOT = Path(__file__).resolve().parents[1]
WORDS_PATH = REPO_ROOT / "backend" / "src" / "edcmbone" / "canon" / "data" / "bones_words_v1.json"
WORDS_PATH = REPO_ROOT / "backend_old" / "src" / "edcmbone" / "canon" / "data" / "bones_words_v1.json"


def _word_tokens():
Expand Down
2 changes: 1 addition & 1 deletion tests/test_ucns_g_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Grain order is token < turn < round < session < archive.

These tests do not exercise the scalar EDCM metric vector in
``backend/src/edcmbone/metrics/compute.py`` — UCNS-G is additive to the
``backend_old/src/edcmbone/metrics/compute.py`` — UCNS-G is additive to the
scalar layer, not a replacement.
"""

Expand Down
2 changes: 1 addition & 1 deletion tests/test_ucns_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from pathlib import Path

ROOT = Path(__file__).resolve().parents[1]
BACKEND_SRC = ROOT / "backend" / "src"
BACKEND_SRC = ROOT / "backend_old" / "src"


def _load_package(package_name: str, package_dir: Path):
Expand Down
Loading