Documents not sortable in py3
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- python
- Domain
- machine-learning
Research direction
Reproduce the failure with the provided Python example, then trace Model.search into vector_space_search and the nsmallest call for duplicate Documents. Done means the search completes under Python 3.6 and returns the expected sorted results when duplicate documents are present.
Written by the indexing model from the issue text.
Description
We're having an issue with pattern==3.6 where if there are duplicates, etc in the model documents, getting the nsmallest fails for vector_space_search:
from pattern.en import lexeme
from pattern.vector import Document, LEMMA, TFIDF, Model
responses = ['it is works great. ', 'bristles are soft and compact enough', 'the aftertaste isnt as bad as others. ', 'i dont know. it isnt something i think about.', 'bristles are soft and compact enough']
exclude = ['t', 'im']
docs = [Document(response, stemmer=LEMMA, name=str(i), exclude=exclude, stopwords=False) for i, response in enumerate(responses)]
m = Model(documents=docs, weight=TFIDF)
results = m.search(words=lexeme('bristle'), top=100)
Results in:

(if you're wondering, here's why it works in py2 - from https://docs.python.org/2/library/stdtypes.html#comparisons)

- Dominant language
- Python
- Stars
- 8.9k
- Forks
- 1.6k
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from clips/pattern
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
-
Difficulty 1/5 Under an hour Newbie friendliness 65/100
-
Difficulty 1/5 Under an hour Newbie friendliness 45/100
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
syfoud/Simulated_Scepter#172 ·
-
A cancelled tests run makes the coverage comment workflow fail and reports it as a red check on main Openarea: ci bug perceived difficulty: 3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Nitjsefnie-Harness-Commons/daedalus#921 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
EleutherAI/lm-evaluation-harness#4207 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ClickHouse/clickhouse-connect#1057 ·