Skip to content

Commit 466f210

Browse files
committed
FIX python 2 vector
1 parent 0c5f92d commit 466f210

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

pattern/db/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2134,7 +2134,7 @@ def csv_header_encode(field, type=STRING):
21342134
# csv_header_encode("age", INTEGER) => "age (INTEGER)".
21352135
t = re.sub(r"^varchar\(.*?\)", "string", (type or ""))
21362136
t = t and " (%s)" % t or ""
2137-
s = "%s%s" % (encode_utf8(field or ""), t.upper())
2137+
s = "%s%s" % (field or "", t.upper())
21382138
return s
21392139

21402140

pattern/vector/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ def _repr(self):
780780
self.type and ", type=%s" % repr(self.type) or "")
781781

782782
def __repr__(self):
783-
return "Document(id=%s%s%s)" % self._repr()
783+
return "Document(id=%s)" % self._repr()
784784

785785
def __hash__(self):
786786
return hash(self._repr())

test/test_vector.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,8 @@ def test_frequent_concept_sets(self):
464464
# Assert Apriori algorithm.
465465
v = self.model.frequent(threshold=0.5)
466466
self.assertEqual(
467-
sorted(v.keys()), [frozenset(["cats"]), frozenset(["dogs"])])
467+
sorted(v.keys(), key=lambda x: str(x)),
468+
[frozenset(["cats"]), frozenset(["dogs"])])
468469
print("pattern.vector.Model.frequent()")
469470

470471
def test_cosine_similarity(self):

0 commit comments

Comments
 (0)