mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 17:58:41 +00:00
code fixes
This commit is contained in:
parent
6b74b8d968
commit
d1edf04232
|
|
@ -84,6 +84,7 @@ abstract class NgramParser
|
||||||
* @return array
|
* @return array
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
|
* @phpstan-ignore
|
||||||
*/
|
*/
|
||||||
protected function getNgrams(string $str) : array
|
protected function getNgrams(string $str) : array
|
||||||
{
|
{
|
||||||
|
|
@ -101,7 +102,6 @@ abstract class NgramParser
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var array|non-empty-array $tokens */
|
|
||||||
foreach ($tokens as $i => $token) {
|
foreach ($tokens as $i => $token) {
|
||||||
$sum = \array_sum($token);
|
$sum = \array_sum($token);
|
||||||
|
|
||||||
|
|
@ -115,7 +115,10 @@ abstract class NgramParser
|
||||||
}
|
}
|
||||||
|
|
||||||
$tokens = \array_merge(...$tokens);
|
$tokens = \array_merge(...$tokens);
|
||||||
unset($tokens['_']);
|
|
||||||
|
if (isset($tokens['_'])) {
|
||||||
|
unset($tokens['_']);
|
||||||
|
}
|
||||||
|
|
||||||
\arsort($tokens, \SORT_NUMERIC);
|
\arsort($tokens, \SORT_NUMERIC);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@ final class KernelsND
|
||||||
|
|
||||||
$cov = $bandwithMatrix->mult($identityMatrix);
|
$cov = $bandwithMatrix->mult($identityMatrix);
|
||||||
|
|
||||||
|
/** @phpstan-ignore-next-line */
|
||||||
$exponent = $distnaceMatrix->dot($cov->inverse())->mult($distnaceMatrix)->sum(1)->mult(-0.5);
|
$exponent = $distnaceMatrix->dot($cov->inverse())->mult($distnaceMatrix)->sum(1)->mult(-0.5);
|
||||||
|
|
||||||
return $exponent->exp()->mult((1 / \pow(2 * \M_PI, $dim / 2)) * \pow($cov->det(), 0.5))->matrix;
|
return $exponent->exp()->mult((1 / \pow(2 * \M_PI, $dim / 2)) * \pow($cov->det(), 0.5))->matrix;
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ final class DataMapperAbstractTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
protected BaseModel $model;
|
protected BaseModel $model;
|
||||||
|
|
||||||
protected array $modelArray;
|
protected array $modelArray;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
|
|
@ -42,6 +42,8 @@ final class DataMapperAbstractTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
$this->model = new BaseModel();
|
$this->model = new BaseModel();
|
||||||
|
|
||||||
|
var_dump($GLOBALS['dbpool']->get());
|
||||||
|
|
||||||
$GLOBALS['dbpool']->get()->con->prepare(
|
$GLOBALS['dbpool']->get()->con->prepare(
|
||||||
'CREATE TABLE `test_base` (
|
'CREATE TABLE `test_base` (
|
||||||
`test_base_id` int(11) NOT NULL AUTO_INCREMENT,
|
`test_base_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user