@@ -10,7 +10,7 @@ import play.api.libs.json.Json
1010
1111class HybridResultTest extends AnyFunSpec with Matchers with OptionValues with Tolerance with Fixtures {
1212
13- import HybridResult .{combineScoresAndGetTopK , combinedScore , normalise , resolveHitAndFillInSemanticScore }
13+ import HybridResult .{fuseScoresAndGetTopK , fuseScores , normalise , resolveHitAndFillInSemanticScore }
1414
1515 private val tolerance = 1e-9
1616
@@ -153,7 +153,7 @@ class HybridResultTest extends AnyFunSpec with Matchers with OptionValues with T
153153 it(" blends the normalised lexical and semantic scores using vecWeight" ) {
154154 // normedLexical = 2/4 = 0.5, normedSemantic = (0 + 1)/(1 + 1) = 0.5
155155 // combined = 0.25 * 0.5 + 0.75 * 0.5 = 0.5
156- val score = combinedScore (
156+ val score = fuseScores (
157157 hybridResult(" blend" , lexicalScore = 2.0 , semanticScore = 0.0 ),
158158 maxLexicalScore = 4.0 ,
159159 maxSemanticScore = 1.0 ,
@@ -163,7 +163,7 @@ class HybridResultTest extends AnyFunSpec with Matchers with OptionValues with T
163163 }
164164
165165 it(" uses only the lexical score when vecWeight is 0" ) {
166- val score = combinedScore (
166+ val score = fuseScores (
167167 hybridResult(" lexical-only" , lexicalScore = 2.0 , semanticScore = 1.0 ),
168168 maxLexicalScore = 4.0 ,
169169 maxSemanticScore = 1.0 ,
@@ -173,7 +173,7 @@ class HybridResultTest extends AnyFunSpec with Matchers with OptionValues with T
173173 }
174174
175175 it(" uses only the semantic score when vecWeight is 1" ) {
176- val score = combinedScore (
176+ val score = fuseScores (
177177 hybridResult(" semantic-only" , lexicalScore = 2.0 , semanticScore = 0.0 ),
178178 maxLexicalScore = 4.0 ,
179179 maxSemanticScore = 1.0 ,
@@ -184,7 +184,7 @@ class HybridResultTest extends AnyFunSpec with Matchers with OptionValues with T
184184 }
185185
186186 it(" contributes 0 from the lexical side when the max lexical score is 0" ) {
187- val score = combinedScore (
187+ val score = fuseScores (
188188 hybridResult(" no-lexical" , lexicalScore = 0.0 , semanticScore = 1.0 ),
189189 maxLexicalScore = 0.0 ,
190190 maxSemanticScore = 1.0 ,
@@ -196,7 +196,7 @@ class HybridResultTest extends AnyFunSpec with Matchers with OptionValues with T
196196 }
197197
198198 it(" contributes 0 from the semantic side when the max semantic score is -1" ) {
199- val score = combinedScore (
199+ val score = fuseScores (
200200 hybridResult(" no-semantic" , lexicalScore = 4.0 , semanticScore = - 1.0 ),
201201 maxLexicalScore = 4.0 ,
202202 maxSemanticScore = - 1.0 ,
@@ -210,7 +210,7 @@ class HybridResultTest extends AnyFunSpec with Matchers with OptionValues with T
210210
211211 describe(" combineScoresAndGetTopK" ) {
212212 it(" returns an empty list if the input is empty" ) {
213- combineScoresAndGetTopK (List (), vecWeight = 0.0 , k = 3 ) should be (List ())
213+ fuseScoresAndGetTopK (List (), vecWeight = 0.0 , k = 3 ) should be (List ())
214214 }
215215
216216 it(" doesn't break when tha max lexical score is 0" ) {
@@ -228,7 +228,7 @@ class HybridResultTest extends AnyFunSpec with Matchers with OptionValues with T
228228 hybridResult(" mid-lexical" , lexicalScore = 5.0 , semanticScore = 0.0 )
229229 )
230230
231- val ranked = combineScoresAndGetTopK (results, vecWeight = 0.0 , k = 3 )
231+ val ranked = fuseScoresAndGetTopK (results, vecWeight = 0.0 , k = 3 )
232232
233233 ranked.map(_.id) should be(List (" high-lexical" , " mid-lexical" , " low-lexical" ))
234234 }
@@ -240,7 +240,7 @@ class HybridResultTest extends AnyFunSpec with Matchers with OptionValues with T
240240 hybridResult(" mid-lexical" , lexicalScore = 5.0 , semanticScore = - 1.0 )
241241 )
242242
243- val ranked = combineScoresAndGetTopK (results, vecWeight = 0.5 , k = 3 )
243+ val ranked = fuseScoresAndGetTopK (results, vecWeight = 0.5 , k = 3 )
244244
245245 ranked.map(_.id) should be(List (" high-lexical" , " mid-lexical" , " low-lexical" ))
246246 }
@@ -252,7 +252,7 @@ class HybridResultTest extends AnyFunSpec with Matchers with OptionValues with T
252252 hybridResult(" mid-semantic" , lexicalScore = 5.0 , semanticScore = 0.0 )
253253 )
254254
255- val ranked = combineScoresAndGetTopK (results, vecWeight = 1.0 , k = 3 )
255+ val ranked = fuseScoresAndGetTopK (results, vecWeight = 1.0 , k = 3 )
256256
257257 ranked.map(_.id) should be(List (" high-semantic" , " mid-semantic" , " low-semantic" ))
258258 }
@@ -264,7 +264,7 @@ class HybridResultTest extends AnyFunSpec with Matchers with OptionValues with T
264264 hybridResult(" mid-semantic" , lexicalScore = 0.0 , semanticScore = 0.0 )
265265 )
266266
267- val ranked = combineScoresAndGetTopK (results, vecWeight = 0.5 , k = 3 )
267+ val ranked = fuseScoresAndGetTopK (results, vecWeight = 0.5 , k = 3 )
268268
269269 ranked.map(_.id) should be(List (" high-semantic" , " mid-semantic" , " low-semantic" ))
270270 }
@@ -276,7 +276,7 @@ class HybridResultTest extends AnyFunSpec with Matchers with OptionValues with T
276276 hybridResult(" c" , lexicalScore = 5.0 , semanticScore = 1.0 )
277277 )
278278
279- val ranked = combineScoresAndGetTopK (results, vecWeight = 0.0 , k = 2 )
279+ val ranked = fuseScoresAndGetTopK (results, vecWeight = 0.0 , k = 2 )
280280
281281 ranked should have size 2
282282 ranked.map(_.id) should be(List (" b" , " c" ))
@@ -292,7 +292,7 @@ class HybridResultTest extends AnyFunSpec with Matchers with OptionValues with T
292292 hybridResult(" blend" , lexicalScore = 2.0 , semanticScore = 0.0 )
293293 )
294294
295- val ranked = combineScoresAndGetTopK (results, vecWeight = 0.25 , k = 3 )
295+ val ranked = fuseScoresAndGetTopK (results, vecWeight = 0.25 , k = 3 )
296296
297297 val blend = ranked.find(_.id == " blend" ).value
298298 // Recompute the expected combined score independently of ordering.
0 commit comments