Skip to content

Update: update Dict init use nil not Load, rm unused test#202

Merged
vcaesar merged 1 commit intomasterfrom
dev-v2
Mar 2, 2026
Merged

Update: update Dict init use nil not Load, rm unused test#202
vcaesar merged 1 commit intomasterfrom
dev-v2

Conversation

@vcaesar
Copy link
Member

@vcaesar vcaesar commented Mar 2, 2026

Please provide Issues links to:

  • Issues: #

Provide test code:

Description

...

Copilot AI review requested due to automatic review settings March 2, 2026 18:52
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@vcaesar vcaesar added this to the v0.90.0 milestone Mar 2, 2026
@vcaesar vcaesar merged commit a8b9b7c into master Mar 2, 2026
9 of 10 checks passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates dictionary initialization logic in the segmenter to rely on seg.Dict == nil rather than a separate seg.Load flag, bumps the library version constant, and removes an unused test.

Changes:

  • Bump Version constant in gse.go.
  • Update LoadDict / LoadTFIDFDict initialization guard to check seg.Dict == nil (and stop using seg.Load).
  • Remove dict_util_test.go (test that only printed values and performed no assertions).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
gse.go Updates the exported version string.
dict_util.go Changes dictionary initialization condition from !seg.Load to seg.Dict == nil and removes some stray whitespace.
dict_util_test.go Removes a non-asserting/printing-only test.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +154 to 158
if seg.Dict == nil {
seg.Dict = NewDict()
seg.Load = true
// seg.Load = true
seg.Init()
}
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Segmenter still exposes the Load bool field (see segmenter.go), but LoadDict no longer uses it to decide whether to (re)initialize. This silently changes behavior for any callers that relied on seg.Load = false to force a fresh dictionary/init (and it leaves Load effectively unused). Either remove/deprecate the Load field and update callers/tests accordingly, or keep backward-compatible behavior by honoring !seg.Load here (and keeping Load in sync when initializing/emptying).

Copilot uses AI. Check for mistakes.
Comment on lines +224 to 228
if seg.Dict == nil {
seg.Dict = NewDict()
seg.Load = true
// seg.Load = true
seg.Init()
}
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commented-out // seg.Load = true suggests Load state is still expected to exist, but LoadTFIDFDict no longer updates or checks it. Please either remove this dead/commented code and the Load field entirely, or restore consistent state management (honor !seg.Load and set it true after init) to avoid confusing/partially-removed API behavior.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants