| Conditions | 2 |
| Total Lines | 13 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | """Ensemble backend that combines results from multiple projects""" |
||
| 19 | def _suggest_with_sources(self, text, sources): |
||
| 20 | hits_from_sources = [] |
||
| 21 | for project_id, weight in sources: |
||
| 22 | source_project = annif.project.get_project(project_id) |
||
| 23 | hits = source_project.suggest(text) |
||
| 24 | self.debug( |
||
| 25 | 'Got {} hits from project {}'.format( |
||
| 26 | len(hits), source_project.project_id)) |
||
| 27 | norm_hits = self._normalize_hits(hits, source_project) |
||
| 28 | hits_from_sources.append( |
||
| 29 | annif.suggestion.WeightedSuggestion( |
||
| 30 | hits=norm_hits, weight=weight)) |
||
| 31 | return hits_from_sources |
||
| 32 | |||
| 40 |