Skip to content

Remove dead code in solon.py main()#1

Merged
Lulzx merged 1 commit into
mainfrom
cleanup-dead-code
Jun 4, 2026
Merged

Remove dead code in solon.py main()#1
Lulzx merged 1 commit into
mainfrom
cleanup-dead-code

Conversation

@Lulzx
Copy link
Copy Markdown
Owner

@Lulzx Lulzx commented Jun 4, 2026

Small cleanup after reviewing README and running all demos.

  • Removed unreachable for-loop that referenced lm.sentence_total(s) (method never existed on CompressionLM; only sentence_bits does).
  • The live code path (using lm_score from sentence_bits) was already present and used.
  • No behavior change. Improves code hygiene and prevents future confusion.
  • Verified: all demos still pass, CI smoke test passes, python solon.py output unchanged.

Part of addressing 'see readme' + 'do all' + user request to commit/push the cleanup.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed the grammaticality evaluation for minimal pairs assessment to properly compute and report accuracy metrics across error types. The evaluation now functions as intended with consistent scoring methods.

Leftover from editing: a for-loop calling lm.sentence_total(s) (which never existed; the class only has sentence_bits) followed by a 'pass' and redefinition of lm_score. The second loop was the live one.

This was a small hygiene cleanup after reviewing the README and running all demos.
@Lulzx Lulzx merged commit 95656ff into main Jun 4, 2026
5 of 6 checks passed
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 4, 2026

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1e42e959-0d2a-45ba-ac2c-5df0baa1d6bb

📥 Commits

Reviewing files that changed from the base of the PR and between 9a39dbb and 6aec929.

📒 Files selected for processing (1)
  • solon.py

📝 Walkthrough

Walkthrough

The PR fixes the grammaticality evaluation section in solon.py's main() function. Previously broken with placeholder logic, the code now instantiates the minimal pairs dataset, constructs ConstructionGrammar, defines an lm_score function from per-token surprisals, and evaluates accuracy via judge_accuracy for both the back-off LM and construction-grammar scorers.

Changes

Grammaticality Evaluation

Layer / File(s) Summary
Grammaticality evaluation implementation
solon.py
Data preparation generates minimal pairs and constructs ConstructionGrammar; scoring defines lm_score from sentence bits and calls judge_accuracy for both statistical and grammar-based scorers, reporting per-error-type accuracy.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A broken section now takes flight,
With pairs and grammars wired right,
Surprise bits sum to judge with care,
Two scorers dance through minimal air!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cleanup-dead-code

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant