Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FreqDist::getKeyValuesByWeight #76

Open
massadm opened this issue Oct 5, 2023 · 1 comment
Open

FreqDist::getKeyValuesByWeight #76

massadm opened this issue Oct 5, 2023 · 1 comment

Comments

@massadm
Copy link

massadm commented Oct 5, 2023

$weightPerToken = $this->getWeightPerToken();
//make a copy of the array
$keyValuesByWeight = $this->keyValues;
array_walk($keyValuesByWeight, function(&$value, $key, $weightPerToken) {
$value /= $weightPerToken;
}, $this->totalTokens);

Perhaps there is a mistake.

array_walk: If the optional third parameter is supplied, it will be passed as the third parameter to the callback funcname.

So, $weightPerToken inside callback is just $this->totalTokens not $this->getWeightPerToken().

@yooper
Copy link
Owner

yooper commented Oct 9, 2023

It has been awhile since I worked on the code base. Can you provide an example that tests the differences in your suggestion and provide the information here in this issue?

Thank you

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

No branches or pull requests

2 participants