Skip to content

Fix token frequency being discarded in BigramChain.load - #38

Open
uncle-hedgehog wants to merge 1 commit into
masterfrom
claude/wuggy-efficiency-reengineering-cb4eb7
Open

Fix token frequency being discarded in BigramChain.load#38
uncle-hedgehog wants to merge 1 commit into
masterfrom
claude/wuggy-efficiency-reengineering-cb4eb7

Conversation

@uncle-hedgehog

Copy link
Copy Markdown
Contributor

What changed

Removed a stray frequency = 1 reassignment in BigramChain.load (wuggy/utilities/bigramchain.py) that unconditionally overwrote the frequency parsed on the previous line.

Why

With the reassignment in place, load(..., token=True) silently behaved identically to type-based counting: the parsed corpus frequency was discarded, so bigram transition weights never reflected token frequencies, and the cutoff parameter was compared against the constant 1 instead of the real frequency.

Notes for reviewers

  • One-line deletion; token=False behavior is unchanged (frequency remains 1 in that mode).
  • Downstream effects when token=True: transition weights now accumulate real frequencies, and cutoff filtering becomes meaningful. Results produced with token=True before this fix were equivalent to token=False.

🤖 Generated with Claude Code

An unconditional `frequency = 1` on the line after the token check
overwrote the parsed value, so `token=True` silently behaved like
type-based counting: bigram transition weights never reflected corpus
frequencies. Remove the stray reassignment so the token flag works as
documented.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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