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

Fix wrapper tests #1323

Closed
menshikh-iv opened this issue May 15, 2017 · 3 comments
Closed

Fix wrapper tests #1323

menshikh-iv opened this issue May 15, 2017 · 3 comments

Comments

@menshikh-iv
Copy link
Contributor

menshikh-iv commented May 15, 2017

After running all tests I found some problems

  1. ldavw wrapper
    (replace assertEqual to assertAlmostEqual for second element)
Traceback (most recent call last):
  File "/home/ivan/release/test/gensim/gensim/test/test_ldavowpalwabbit_wrapper.py", line 223, in testvwmodel2ldamodel
    self.assertEqual(tm1[document][0], tm2[document][0])
AssertionError: Tuples differ: (1, 0.99731147) != (1, 0.99731144183873388)

First differing element 1:
0.99731147
0.99731144183873388

- (1, 0.99731147)
+ (1, 0.99731144183873388)
?              +++++ ++++
  1. ldamallet wrapper
    (replace assertEqual to assertAlmostEqual for second element with places=1)
Traceback (most recent call last):
  File "/home/ivan/release/test/gensim/gensim/test/test_ldamallet_wrapper.py", line 110, in testMallet2Model
    self.assertEqual(tm1[document][0], tm2[document][0])
AssertionError: Tuples differ: (0, 0.5157232704402516) != (0, 0.50981136383330472)

First differing element 1:
0.5157232704402516
0.509811363833

- (0, 0.5157232704402516)
+ (0, 0.50981136383330472)
  1. varembed wrapper
    (remove test because we don't support 2.6 from 1.0.0)

  2. dtm wrapper

Traceback (most recent call last):
  File "/home/ivan/release/test/gensim/gensim/test/test_dtm.py", line 55, in testDim
    rng_seed=1)
  File "/home/ivan/release/test/gensim/gensim/models/wrappers/dtmmodel.py", line 96, in __init__
    if model == "fixed" and any([i == 0 for i in [len(text) for text in corpus.get_texts()]]):
AttributeError: 'MmCorpus' object has no attribute 'get_texts'
  1. varembed wrapper
Traceback (most recent call last):
  File "/home/ivan/release/test/gensim/gensim/test/test_varembed_wrapper.py", line 56, in testAddMorphemesToEmbeddings
    vectors=varembed_model_vector_file, morfessor_model=varembed_model_morfessor_file)
  File "/home/ivan/release/test/gensim/gensim/models/wrappers/varembed.py", line 69, in load_varembed_format
    morfessor_model = morfessor.MorfessorIO().read_binary_model_file(morfessor_model)
  File "/home/ivan/.virtualenvs/clean-2.7/local/lib/python2.7/site-packages/morfessor/io.py", line 179, in read_binary_model_file
    model = pickle.load(fobj)
AttributeError: 'module' object has no attribute 'FixedCorpusWeight'
  1. ldamallet wrapper (python 3 only)
Traceback (most recent call last):
  File "/home/ivan/release/test/gensim/gensim/test/test_ldamallet_wrapper.py", line 144, in testLargeMmap
    model = ldamallet.LdaMallet(self.mallet_path, self.corpus, num_topics=2, iterations=100)
  File "/home/ivan/release/test/gensim/gensim/models/wrappers/ldamallet.py", line 100, in __init__
    self.train(corpus)
  File "/home/ivan/release/test/gensim/gensim/models/wrappers/ldamallet.py", line 168, in train
    self.word_topics = self.load_word_topics()
  File "/home/ivan/release/test/gensim/gensim/models/wrappers/ldamallet.py", line 193, in load_word_topics
    word2id = dict((v, k) for k, v in iteritems(self.id2word))
  File "/home/ivan/.virtualenvs/clean-3.5/lib/python3.5/site-packages/six.py", line 581, in iteritems
    return iter(d.items(**kw))
AttributeError: 'FakeDict' object has no attribute 'items'
@tmylk
Copy link
Contributor

tmylk commented May 16, 2017

Best way to test this fix is in the docker container in #1121

shubhamdotjain added a commit to shubhamdotjain/gensim that referenced this issue May 23, 2017
@shubhamdotjain
Copy link
Contributor

shubhamdotjain commented May 23, 2017

In 4th, get_texts() is an attribute of wiki_corpus, not mmcorpus. Also mmcorpus doesn't have any similar attribute that would get the text from the document. How to go about this?

shubhamdotjain added a commit to shubhamdotjain/gensim that referenced this issue May 24, 2017
shubhamdotjain added a commit to shubhamdotjain/gensim that referenced this issue May 24, 2017
menshikh-iv added a commit that referenced this issue May 25, 2017
@menshikh-iv
Copy link
Contributor Author

Fixed in PR1359

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants