Fix token frequency being discarded in BigramChain.load - #38
Open
uncle-hedgehog wants to merge 1 commit into
Open
Fix token frequency being discarded in BigramChain.load#38uncle-hedgehog wants to merge 1 commit into
uncle-hedgehog wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Removed a stray
frequency = 1reassignment inBigramChain.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 thecutoffparameter was compared against the constant 1 instead of the real frequency.Notes for reviewers
token=Falsebehavior is unchanged (frequency remains 1 in that mode).token=True: transition weights now accumulate real frequencies, andcutofffiltering becomes meaningful. Results produced withtoken=Truebefore this fix were equivalent totoken=False.🤖 Generated with Claude Code