Ejemplo n.º 1
0
        public List <ResultEntry> GetBestCandidates(GroupedQueryResults groupedQueryResults, int maxNumberOfMatchesToReturn, IModelService modelService, QueryConfiguration queryConfiguration)
        {
            var trackIds = groupedQueryResults.GetTopTracksByHammingSimilarity(maxNumberOfMatchesToReturn).ToList();
            var tracks   = modelService.ReadTracksByReferences(trackIds);

            return(tracks.SelectMany(track => BuildResultEntries(track, groupedQueryResults, queryConfiguration)).ToList());
        }
Ejemplo n.º 2
0
        private IEnumerable <ResultEntry> BuildResultEntries(TrackData track, GroupedQueryResults groupedQueryResults, QueryConfiguration configuration)
        {
            var coverages = queryResultCoverageCalculator.GetCoverages(track, groupedQueryResults, configuration);

            return(coverages.Select(coverage =>
            {
                double confidence = confidenceCalculator.CalculateConfidence(
                    coverage.SourceMatchStartsAt,
                    coverage.SourceMatchLength,
                    coverage.QueryLength,
                    coverage.OriginMatchStartsAt,
                    track.Length);

                return new ResultEntry(
                    track,
                    coverage.SourceMatchStartsAt,
                    coverage.SourceMatchLength,
                    coverage.SourceCoverageLength,
                    coverage.OriginMatchStartsAt,
                    coverage.TrackStartsAt,
                    confidence,
                    groupedQueryResults.GetHammingSimilaritySumForTrack(track.TrackReference),
                    coverage.QueryLength);
            }));
        }
Ejemplo n.º 3
0
        private IEnumerable <ResultEntry> BuildResultEntries(TrackData track, GroupedQueryResults groupedQueryResults, QueryConfiguration configuration)
        {
            var coverages = queryResultCoverageCalculator.GetCoverages(track, groupedQueryResults, configuration);

            return(coverages.Select(coverage => new ResultEntry(track,
                                                                groupedQueryResults.GetScoreSumForTrack(track.TrackReference),
                                                                groupedQueryResults.RelativeTo.AddSeconds(coverage.QueryMatchStartsAt),
                                                                coverage)));
        }