Bånder

GenreHierarchyService
in package

Table of Contents

Properties

$discogsClient  : DiscogsClient
$lastFmClient  : LastFmClient
$logger  : LoggerInterface
$musicBrainzClient  : MusicBrainzClient

Methods

__construct()  : mixed
buildGenreHierarchyBatch()  : array<string|int, mixed>
Build genre hierarchy using batch processing
buildGenreHierarchySimple()  : array<string|int, mixed>
Simplified approach without Discogs data for testing
getGenreSimilarity()  : float
Get similarity score between two genres from the hierarchy data
buildGenreRelationships()  : array<string|int, mixed>
Build relationships between genres using multiple strategies
buildSimilarityMatrix()  : array<string|int, mixed>
Build a normalized similarity matrix for fast lookup
calculateFallbackSimilarity()  : float
Calculate fallback similarity when no direct relationship exists
calculateStringSimilarity()  : float
Calculate string-based similarity
deduplicateRelationships()  : array<string|int, mixed>
Remove duplicate relationships, keeping the highest similarity score
getDiscogsGenreData()  : array<string|int, mixed>
Get Discogs genre data using search results only (avoids problematic lookup calls)
getDiscogsStyleRelationships()  : array<string|int, mixed>
Find relationships based on shared Discogs styles
getManualGenreRelationships()  : array<string|int, mixed>
Get manual genre hierarchy rules
getStringBasedRelationships()  : array<string|int, mixed>
Find relationships based on string patterns
organizeHierarchyWithAlternatives()  : array<string|int, mixed>
Organize genre hierarchy using multiple relationship strategies

Properties

Methods

buildGenreHierarchyBatch()

Build genre hierarchy using batch processing

public buildGenreHierarchyBatch(array<string|int, mixed> $genres[, int $batchSize = 5 ]) : array<string|int, mixed>
Parameters
$genres : array<string|int, mixed>
$batchSize : int = 5
Return values
array<string|int, mixed>

buildGenreHierarchySimple()

Simplified approach without Discogs data for testing

public buildGenreHierarchySimple(array<string|int, mixed> $genres) : array<string|int, mixed>
Parameters
$genres : array<string|int, mixed>
Return values
array<string|int, mixed>

getGenreSimilarity()

Get similarity score between two genres from the hierarchy data

public getGenreSimilarity(array<string|int, mixed> $hierarchyData, string $genre1, string $genre2) : float
Parameters
$hierarchyData : array<string|int, mixed>
$genre1 : string
$genre2 : string
Return values
float

buildGenreRelationships()

Build relationships between genres using multiple strategies

private buildGenreRelationships(string $genre, array<string|int, mixed> $allGenres, array<string|int, mixed> $genreData) : array<string|int, mixed>
Parameters
$genre : string
$allGenres : array<string|int, mixed>
$genreData : array<string|int, mixed>
Return values
array<string|int, mixed>

buildSimilarityMatrix()

Build a normalized similarity matrix for fast lookup

private buildSimilarityMatrix(array<string|int, mixed> $genreData, array<string|int, mixed> $allGenres, array<string|int, mixed> $genreDetails) : array<string|int, mixed>
Parameters
$genreData : array<string|int, mixed>
$allGenres : array<string|int, mixed>
$genreDetails : array<string|int, mixed>
Return values
array<string|int, mixed>

calculateFallbackSimilarity()

Calculate fallback similarity when no direct relationship exists

private calculateFallbackSimilarity(string $genre1, string $genre2, array<string|int, mixed> $genreData) : float
Parameters
$genre1 : string
$genre2 : string
$genreData : array<string|int, mixed>
Return values
float

calculateStringSimilarity()

Calculate string-based similarity

private calculateStringSimilarity(string $genre1, string $genre2) : float
Parameters
$genre1 : string
$genre2 : string
Return values
float

deduplicateRelationships()

Remove duplicate relationships, keeping the highest similarity score

private deduplicateRelationships(array<string|int, mixed> $relationships) : array<string|int, mixed>
Parameters
$relationships : array<string|int, mixed>
Return values
array<string|int, mixed>

getDiscogsGenreData()

Get Discogs genre data using search results only (avoids problematic lookup calls)

private getDiscogsGenreData(string $genre) : array<string|int, mixed>
Parameters
$genre : string
Return values
array<string|int, mixed>

getDiscogsStyleRelationships()

Find relationships based on shared Discogs styles

private getDiscogsStyleRelationships(string $genre, array<string|int, mixed> $allGenres, array<string|int, mixed> $genreData) : array<string|int, mixed>
Parameters
$genre : string
$allGenres : array<string|int, mixed>
$genreData : array<string|int, mixed>
Return values
array<string|int, mixed>

getManualGenreRelationships()

Get manual genre hierarchy rules

private getManualGenreRelationships(string $genre) : array<string|int, mixed>
Parameters
$genre : string
Return values
array<string|int, mixed>

getStringBasedRelationships()

Find relationships based on string patterns

private getStringBasedRelationships(string $genre, array<string|int, mixed> $allGenres) : array<string|int, mixed>
Parameters
$genre : string
$allGenres : array<string|int, mixed>
Return values
array<string|int, mixed>

organizeHierarchyWithAlternatives()

Organize genre hierarchy using multiple relationship strategies

private organizeHierarchyWithAlternatives(array<string|int, mixed> $genreData, array<string|int, mixed> $allGenres) : array<string|int, mixed>
Parameters
$genreData : array<string|int, mixed>
$allGenres : array<string|int, mixed>
Return values
array<string|int, mixed>

        
On this page

Search results