Compare commits
1 commit
Author | SHA1 | Date | |
---|---|---|---|
4d8a510c45 |
3 changed files with 24 additions and 11 deletions
|
@ -5,6 +5,13 @@ 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/),
|
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).
|
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
|
## [1.0.1] - 2023-07-29
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
@ -12,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
wrapper class.
|
wrapper class.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [1.0.0] - 2023-07-23
|
## [1.0.0] - 2023-07-23
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
"assembly": {
|
"assembly": {
|
||||||
"name": "Keybert",
|
"name": "Keybert",
|
||||||
"package": "net.nosial.keybert",
|
"package": "net.nosial.keybert",
|
||||||
"version": "1.0.1",
|
"version": "1.0.2",
|
||||||
"uuid": "1695515c-2857-11ee-a7a6-6d740ea6cd07"
|
"uuid": "1695515c-2857-11ee-a7a6-6d740ea6cd07"
|
||||||
},
|
},
|
||||||
"execution_policies": [
|
"execution_policies": [
|
||||||
|
|
|
@ -346,26 +346,27 @@
|
||||||
*/
|
*/
|
||||||
private function parseResults($results): array
|
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 = [];
|
$parsedResults = [];
|
||||||
foreach($results as $result)
|
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
$parsedResults[] = $this->parseSingleResult($result);
|
$parsedResults[] = $this->parseSingleResult($result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
elseif (is_array($results[0]))
|
||||||
{
|
{
|
||||||
// This is a single-result
|
// This is a single-result
|
||||||
$parsedResults = $this->parseSingleResult($results);
|
$parsedResults = $this->parseSingleResult($results);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $parsedResults ?? [];
|
return $parsedResults;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -377,10 +378,14 @@
|
||||||
private function parseSingleResult($result): array
|
private function parseSingleResult($result): array
|
||||||
{
|
{
|
||||||
$parsedResult = [];
|
$parsedResult = [];
|
||||||
foreach($result as $keywordScore)
|
|
||||||
|
foreach ($result as $keywordScore)
|
||||||
|
{
|
||||||
|
if (is_array($keywordScore) && count($keywordScore) === 2)
|
||||||
{
|
{
|
||||||
$parsedResult[$keywordScore[0]] = $keywordScore[1];
|
$parsedResult[$keywordScore[0]] = $keywordScore[1];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $parsedResult;
|
return $parsedResult;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue