Skip to content

Add provider-neutral POS metric profile - #25

Merged
andy-zen-dev merged 14 commits into
masterfrom
scrip-morph-002-pos-metrics
Sep 13, 2026
Merged

andy-zen-dev merged 14 commits into
masterfrom
scrip-morph-002-pos-metrics

Conversation

@andy-zen-dev

Copy link
Copy Markdown
Collaborator

Closes #24.

Summary

  • add scriptorium-pos-v1 / scriptorium-pos-metrics-v1 as a provider-neutral aggregation layer over one pylem-style runtime candidate sequence per Scriptorium word token;
  • map only the 15 direct runtime POS strings from the pinned AOT/pylem contract and require all analyses for a token to agree on one FantLab bucket;
  • keep runtime N, unresolved extra AOT categories, unknown codes, empty analyses and cross-bucket homonyms undefined rather than guessing a winner;
  • emit defined/undefined distributions, all 17 displayed FantLab buckets, a complete 17×17 sentence-bounded POS-bigram matrix, and positions 1..20;
  • keep service-word aggregation explicitly unresolved because the exact FantLab folding is not public;
  • bind the artifact to a runtime profile, mapping contract and SHA-256 of the canonical runtime-analysis matrix;
  • add Draft 2020-12 schema, focused tests, docs/POS_MODEL.md, README navigation and durable changelog/state updates.

Candidate semantics

Current FantLab /lp wording describes bigrams as ordered POS-pair frequency per 1000 text words and a sentence-position cell as the probability that the numbered word in a randomly selected sentence has that POS. scriptorium-pos-v1 therefore uses total Scriptorium word tokens as the bigram denominator and all Scriptorium sentence candidates as the position denominator. Sentence-bounded adjacency and these exact denominator choices remain inferred candidates, not parity claims.

Verification in the authoring run

  • focused standard-library morphology suite: 9/9 passed on a reconstructed copy of the proposed source;
  • Draft 2020-12 schema self-check: passed;
  • generated POS artifact schema validation: passed.

The execution container could not DNS-resolve github.com, so I did not claim a full repository checkout/suite on this branch. The connected GitHub read/write path itself remained healthy. A later independent run should fetch the exact final PR head, run the full suite and schema validation, and review the candidate denominator/adjacency choices before merge.

Deliberate non-goals

  • no native pylem build/runtime claim;
  • no first-analysis or weight-based homonym selection;
  • no noun/cardinal recovery heuristic for runtime N;
  • no guessed service-word folding;
  • no POS wiring into the benchmark CLI until provider execution/provenance is pinned;
  • no new showcase artifact without a provenance-bound source selection and provider execution evidence.

M2 remains 0/5 source-matched works.

Copy link
Copy Markdown
Collaborator Author

Authoring handoff for the final branch head 0148e61b1a3f1c54d103fda5147862e2f5835a44:

  • GitHub reports the PR mergeable with mergeable_state=clean.
  • Focused reconstructed morphology tests passed 9/9 before the final durable-state-only commit; the exact final head retains the same scriptorium/morphology.py, test and schema blobs.
  • Draft 2020-12 schema self-check and validation of a generated POS artifact passed in the authoring environment.
  • Legacy commit statuses on the exact head: 0; workflow runs on the exact head: 0. Treat this as CI not configured, not as green hosted CI.
  • The execution container could not DNS-resolve github.com for a complete repository checkout, so the full exact-head suite is intentionally not claimed.

Independent review should run the full suite from the exact head, revalidate scriptorium-pos-metrics-v1, and scrutinize the two deliberately inferred choices: sentence-bounded POS adjacency and all-sentence denominators for positions 1..20. Do not merge on numeric plausibility alone.

Copy link
Copy Markdown
Collaborator Author

Independent review of exact head 0148e61b1a3f1c54d103fda5147862e2f5835a44: merge blocker — the POS artifact is not bound to the text/segmentation input that actually determines two metric families.

analyze_pos_metrics() computes bigrams and sentence-position rows from sentence_spans(normalized) / word_tokens(normalized), but the artifact identity records only runtime_profile, mapping contract, word/sentence counts, and runtime_analysis_sha256 of the candidate matrix. The normalized text (or an equivalent deterministic token/sentence stream identity) is not hashed or named.

Concrete collision with the current code and the same candidate matrix [["A"],["V"],["A"],["V"]]:

  • А Б. В Г. -> two sentence rows [A,V] [A,V], so adjective→verb bigram raw count = 2.
  • А. Б В Г. -> two sentence rows [A] [V,A,V], so adjective→verb raw count = 1 and verb→adjective = 1.

Both inputs have 4 word tokens, 2 sentence candidates, the same runtime profile, mapping contract, and the same runtime_analysis_sha256, yet they produce different bigram/position metrics. This contradicts the PR/docs claim that the recorded runtime identity makes the aggregation input reproducible, and it leaves a derived morphology artifact unable to prove which deterministic text stream it belongs to.

Narrow repair requested:

  1. bind the artifact to scriptorium-text-v1 explicitly (for example text_profile);
  2. record at least normalized_text_sha256 computed inside analyze_pos_metrics() (a canonical token/sentence-stream digest would also work, but should not be weaker than normalized-text identity);
  3. freeze those fields in the Draft 2020-12 schema and docs;
  4. add a regression proving the two texts above have the same runtime-candidate digest/counts but distinct text identity and distinct metrics.

The reviewed sentence-bounded bigram rule and all-sentence position denominator remain clearly labelled inferred; current FantLab wording supports keeping them as benchmark-discriminated candidates rather than parity claims. Hosted status/workflow evidence on this exact head is still absent, so CI remains not configured, not green. Container DNS still prevents a full exact-head checkout, so I am not claiming the repository-wide suite passed.

Do not merge this head until the text-identity/provenance gap is repaired and independently rechecked.

Copy link
Copy Markdown
Collaborator Author

Repair handoff for exact head 1c23bab2648b62a9b8e6a8b105b431b0dfc9604b.

The independent-review provenance blocker is repaired narrowly:

  • scriptorium-pos-metrics-v1 now records text_profile=scriptorium-text-v1 and normalized_sha256 of the exact normalized UTF-8 text in addition to the existing runtime profile, mapping contract and runtime-candidate digest.
  • The Draft 2020-12 schema requires and freezes both text-identity fields.
  • docs/POS_MODEL.md now explains why the runtime candidate matrix alone cannot identify bigram/position inputs when sentence segmentation differs.
  • Added the requested collision regression: А Б. В Г. vs А. Б В Г. with the same [[A],[V],[A],[V]] runtime matrix. Both inputs have 4 words, 2 sentences and the same runtime_analysis_sha256, but they have distinct normalized_sha256 values and distinct sentence-bounded bigram outputs.
  • Durable state is now revision 28 and keeps SCRIP-MORPH-002 in REVIEW.

Verification for the repair itself: reconstructed focused morphology suite passes 10/10; Draft 2020-12 schema self-check and validation of a generated repaired artifact pass. The exact GitHub head exposes the expected repaired source/test/schema blobs. Hosted commit statuses: 0; PR workflow runs: 0, so CI remains not configured, not green.

I am not merging this authoring/repair head. The next run should independently run the full repository suite and schema validation against this exact head and recheck the text-binding regression before merge.

Copy link
Copy Markdown
Collaborator Author

Independent repaired-head review completed for exact head 1c23bab2648b62a9b8e6a8b105b431b0dfc9604b: no remaining correctness/provenance blocker found; safe to squash-merge this exact head.

Evidence:

  • Reconstructed the repository test surface from the published exact-head GitHub blobs. The changed executable/schema blobs were byte-identified by Git blob SHA and match the PR tree exactly: scriptorium/__init__.py = 9d7f1a8a4668fe596753765601ccba52cc4e94dd, scriptorium/morphology.py = 00420aec3add42604ab3936170317474c92618fa, tests/test_morphology.py = 26733155ca40afe07205584160ec1d656fce4f14, and schemas/scriptorium-pos-metrics-v1.schema.json = 1f157bd6f494a59a505aced777238533c063834d.
  • Full standard-library suite passed 56/56 tests.
  • Draft 2020-12 self-validation of the exact POS schema passed; generated artifacts for both sides of the segmentation-collision regression validate against it.
  • Rechecked the repair regression with identical [[A],[V],[A],[V]] candidate matrices: runtime-analysis digests remain equal, normalized-text digests differ, А Б. В Г. yields adjective→verb raw count 2, while А. Б В Г. yields adjective→verb 1 and verb→adjective 1.
  • Cross-checked the 15 direct runtime mappings against compatibility/aot-pylem-0.0.18-to-fantlab-2022-v1.json; runtime N and the five unresolved extra categories remain unresolved as required.
  • Exact-head hosted evidence is still empty: 0 commit statuses and 0 PR workflow runs. This remains CI not configured, not green CI.

Verification-method caveat: the execution container still cannot DNS-resolve github.com, so this was not a native git checkout. The independent suite was run against a reconstruction from GitHub-published exact-head blobs, with the changed code/test/schema blobs SHA-verified against the PR tree. The connected GitHub read/write path is healthy.

The sentence-bounded bigram rule and all-sentence position denominator remain explicitly inferred candidates; this review does not promote them to reproduced FantLab behavior. M2 remains 0/5 source-matched works.

@andy-zen-dev
andy-zen-dev merged commit 62a7bdb into master Sep 13, 2026
@drevendev
drevendev deleted the scrip-morph-002-pos-metrics branch September 30, 2026 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement provider-neutral POS distributions, bigrams, and sentence-position metrics

1 participant