Compare commits

..

No commits in common. "master" and "1.0.1" have entirely different histories.

3 changed files with 11 additions and 24 deletions

View file

@ -5,13 +5,6 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.0.2] - 2023-07-29
### Fixed
* Minor bug fix
## [1.0.1] - 2023-07-29
### Fixed
@ -19,7 +12,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
wrapper class.
## [1.0.0] - 2023-07-23
### Added

View file

@ -12,7 +12,7 @@
"assembly": {
"name": "Keybert",
"package": "net.nosial.keybert",
"version": "1.0.2",
"version": "1.0.1",
"uuid": "1695515c-2857-11ee-a7a6-6d740ea6cd07"
},
"execution_policies": [

View file

@ -346,27 +346,26 @@
*/
private function parseResults($results): array
{
if (is_array($results))
{
// check if the results are multi or single
if(is_array($results[0][0]))
{
// This is a multi-results
$parsedResults = [];
if (is_array($results) && isset($results[0]))
{
// Check if the results are multi or single
if (is_array($results[0]) && isset($results[0][0]) && is_array($results[0][0]))
{
// This is multi-results
foreach ($results as $result)
foreach($results as $result)
{
$parsedResults[] = $this->parseSingleResult($result);
}
}
elseif (is_array($results[0]))
else
{
// This is a single-result
$parsedResults = $this->parseSingleResult($results);
}
}
return $parsedResults;
return $parsedResults ?? [];
}
/**
@ -378,14 +377,10 @@
private function parseSingleResult($result): array
{
$parsedResult = [];
foreach ($result as $keywordScore)
{
if (is_array($keywordScore) && count($keywordScore) === 2)
foreach($result as $keywordScore)
{
$parsedResult[$keywordScore[0]] = $keywordScore[1];
}
}
return $parsedResult;
}