textaugment icon indicating copy to clipboard operation
textaugment copied to clipboard

Possibly conflict with gensim 4.0.1

Open dinhanhx opened this issue 3 years ago • 3 comments

This error yield out when I usse textaugment with gensim 4 but not gensim 3

  File "aug.py", line 15, in <module>
    data_df['paraphrased_text'] = data_df['text'].progress_apply(lambda x: w2v.augment(x))
  File "/home/anhvd/.local/lib/python3.7/site-packages/tqdm/std.py", line 770, in inner
    return getattr(df, df_function)(wrapper, **kwargs)
  File "/home/anhvd/miniconda3/envs/textaug/lib/python3.7/site-packages/pandas/core/series.py", line 4138, in apply
    mapped = lib.map_infer(values, f, convert=convert_dtype)
  File "pandas/_libs/lib.pyx", line 2467, in pandas._libs.lib.map_infer
  File "/home/anhvd/.local/lib/python3.7/site-packages/tqdm/std.py", line 765, in wrapper
    return func(*args, **kwargs)
  File "aug.py", line 15, in <lambda>
    data_df['paraphrased_text'] = data_df['text'].progress_apply(lambda x: w2v.augment(x))
  File "/home/anhvd/miniconda3/envs/textaug/lib/python3.7/site-packages/textaugment/word2vec.py", line 146, in augment
    similar_words_and_weights = [(syn, t) for syn, t in self.model.wv.most_similar(w[1])]
AttributeError: 'KeyedVectors' object has no attribute 'wv

dinhanhx avatar May 14 '21 02:05 dinhanhx

Thank you @dinhanhx , @JosephSefara can you take a look.

vukosim avatar May 14 '21 05:05 vukosim

I suggest that you should write some code to handle gensim 4 and gensim 3 therefore, when users install they don't need to worry about gensim version. Moreover, gensim 3 is more common than gensim 4 as of writing.

dinhanhx avatar May 14 '21 06:05 dinhanhx

This will be fixed in the major release

JosephSefara avatar Oct 05 '21 09:10 JosephSefara

@dinhanhx Fixed.

vukosim avatar Nov 17 '23 08:11 vukosim