Skip to content
Snippets Groups Projects
Verified Commit b01e8a7f authored by Frank Sauerburger's avatar Frank Sauerburger
Browse files

Use lowercase

parent 9b6ddd23
No related branches found
No related tags found
No related merge requests found
......@@ -40,7 +40,7 @@ class QGramIndex:
jaccard = count / (n_term + n_query - count)
result.append((jaccard, term))
result.sort(key=lambda x: x[0])
result.sort(key=lambda x: -x[0])
return result
......@@ -55,7 +55,7 @@ class QGramIndex:
The beginning and end of the string is denoted by a dollar sign ($).
If the term is too short, the qgrams might be shorter than q.
"""
term = f"${term}$"
term = f"${term}$".lower()
qgrams = []
if len(term) < self.q_param:
......
......@@ -9,6 +9,12 @@ from qgram import QGramIndex
class QGramChunkTest(unittest.TestCase):
"""Test the implementation"""
def test_case(self):
"""Test the chunk converts to lower case"""
index = QGramIndex()
qgrams = index._chunk("WeaTHer")
self.assertEqual(qgrams, ["$we", "wea", "eat", "ath", "the", "her", "er$"])
def test_long(self):
"""Test the chunk method with a long string"""
index = QGramIndex()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment