Skip to content

Replace uninitialized @separator with @word_separator in NGram#parse#1

Open
le-blau wants to merge 1 commit intotkellen:masterfrom
le-blau:replace-separator
Open

Replace uninitialized @separator with @word_separator in NGram#parse#1
le-blau wants to merge 1 commit intotkellen:masterfrom
le-blau:replace-separator

Conversation

@le-blau
Copy link
Copy Markdown

@le-blau le-blau commented Oct 10, 2024

Problem Overview

In the parse method of the NGram class, @separator was being used without being properly defined or initialized. However, due to Ruby's behavior, split(nil) defaulted to splitting by whitespace, so no error was occurring.

The code will not behave as expected when trying to specify a custom separator.

Fix Details

@separator has been replaced with @word_separator to ensure that an intentionally set separator is used.

@le-blau le-blau marked this pull request as ready for review October 10, 2024 09:52
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