Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small fixes to resolve tests failures #1080

Merged
merged 5 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions orangecontrib/text/corpus.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
from collections import Counter, defaultdict
from copy import copy, deepcopy
from copy import copy
from numbers import Integral
from itertools import chain
from typing import Union, Optional, List, Tuple, Dict
Expand All @@ -19,15 +19,6 @@
)
from Orange.preprocess.transformation import Identity
from Orange.data.util import get_unique_names

# Gensim is 4.3.2 is incompatible with scipy 1.3, where they removed triu/
# thus hack what it is missing here it.
# Remove this section after we depend on newer gensim
import scipy.linalg
if "triu" not in scipy.linalg.__dict__:
scipy.linalg.triu = np.triu

from gensim import corpora
from orangewidget.utils.signals import summarize, PartialSummary
import scipy.sparse as sp

Expand Down
4 changes: 2 additions & 2 deletions orangecontrib/text/misc/nltk_data_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
'punkt',
'opinion_lexicon',
'vader_lexicon',
'averaged_perceptron_tagger',
'maxent_treebank_pos_tagger',
'averaged_perceptron_tagger_eng',
'maxent_treebank_pos_tagger_tab',
'omw-1.4',
]

Expand Down
14 changes: 0 additions & 14 deletions orangecontrib/text/tests/test_corpus.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os
import pickle
import unittest
from datetime import datetime

import numpy as np
from numpy.testing import assert_array_equal
Expand All @@ -16,7 +15,6 @@
from orangewidget.utils.signals import summarize
from scipy.sparse import csr_matrix, issparse

import orangecontrib
from orangecontrib.text import preprocess
from orangecontrib.text.corpus import Corpus
from orangecontrib.text.preprocess import (
Expand All @@ -27,18 +25,6 @@
from orangecontrib.text.tag import AveragedPerceptronTagger


class ImportHack(unittest.TestCase):

def test_perhaps_remove_gensim_hack(self):
now = datetime.now()
if (now.year, now.month) >= (2024, 7):
self.fail(
"Check if gensim newer than 4.3.2 is available; if so, add it "
"to requirements, remove the scipy monkey-patch in corpus.py "
"and this test."
)


class CorpusTests(unittest.TestCase):
def setUp(self):
self.pos_tagger = AveragedPerceptronTagger()
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ beautifulsoup4
biopython # Enables Pubmed widget.
conllu
docx2txt>=0.6
gensim>=4.3.0,!=4.3.1 # gensim 4.3.1 is build on numpy 1.24, causing error on older numpys
gensim>=4.3.3
httpx!=0.23.1 # temporary fix - semantic search fail (but only in tests)
langdetect
lemmagen3
nltk>=3.0.5 # TweetTokenizer introduced in 3.0.5
nltk>=3.9.1
numpy
odfpy>=1.3.5
Orange3 >=3.35.0
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ deps =
oldest: orange-canvas-core==0.1.30
oldest: orange-widget-base==4.20.0
oldest: pandas==1.4.0
oldest: nltk==3.9.1
latest: https://github.com/biolab/orange3/archive/refs/heads/master.zip#egg=orange3
latest: https://github.com/biolab/orange3-network/archive/refs/heads/master.zip#egg=orange3-network
latest: https://github.com/biolab/orange-canvas-core/archive/refs/heads/master.zip#egg=orange-canvas-core
Expand Down
Loading