Skip to content

Commit

Permalink
DNode.full_value now calculates the total_score as a float.
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzeman committed Oct 11, 2013
1 parent 8587987 commit 4d06f0c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion qcond/transformers/merge.py
Expand Up @@ -190,7 +190,7 @@ def full_value(self):

cur = cur.parent

return total_score / len(words), ' '.join(words)
return float(total_score) / len(words), ' '.join(words)

def __repr__(self):
return '<%s value:"%s", weight: %s%s>' % (
Expand Down
4 changes: 2 additions & 2 deletions tests/test_query_condenser.py
Expand Up @@ -62,6 +62,6 @@ def test_distinct(self):
"La Leggenda Di Korra"
]), [
'the korra',
'legend of korra',
'la leggenda di korra'
'la leggenda di korra',
'legend of korra'
])
25 changes: 25 additions & 0 deletions tests/test_transformers.py
Expand Up @@ -31,6 +31,20 @@ def test_run(self):
'apartment 23'
])

self.assertSequenceEqual(self.merge.run([
"The Legend of Korra",
"The Last Airbender The Legend of Korra",
"Avatar: The Legend of Korra",
"Legend of Korra",
"La Leggenda Di Korra"
]), [
'the',
'the korra',
'avatar the legend of korra',
'la leggenda di korra',
'legend of korra'
])

def test_merge(self):
pass

Expand All @@ -55,3 +69,14 @@ def test_run(self):
"Don't Trust the B in Apt 23",
'Dont Trust the Bitch in Apartment 23'
])

self.assertSequenceEqual(self.slice.run([
"The Legend of Korra",
"The Last Airbender The Legend of Korra",
"Avatar: The Legend of Korra",
"Legend of Korra",
"La Leggenda Di Korra"
]), [
'Legend of Korra',
'La Leggenda Di Korra'
])

0 comments on commit 4d06f0c

Please sign in to comment.