williamleif / socialsent

Code and data for inducing domain-specific sentiment lexicons.
Apache License 2.0
195 stars 75 forks source link

AttributeError: 'module' object has no attribute 'linear' #4

Closed ndrmahmoudi closed 7 years ago

ndrmahmoudi commented 7 years ago

Hi William,

Thanks a lot for the code. I was ring to run the example.py to see how the code works. However, I got an error as follows:

In [1]: %run example.py
Using TensorFlow backend.
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/Desktop/socialsent-master/example.py in <module>()
      2 from socialsent import lexicons
      3 from socialsent.polarity_induction_methods import random_walk
----> 4 from socialsent.evaluate_methods import binary_metrics
      5 from socialsent.representations.representation_factory import create_representation
      6 

/Desktop/socialsent-master/socialsent/evaluate_methods.py in <module>()
    474 
    475 def run_method(positive_seeds, negative_seeds, embeddings, transform_embeddings=False, post_densify=False,
--> 476         method=polarity_induction_methods.linear, **kwargs):
    477     if transform_embeddings:
    478         print "Transforming embeddings..."

AttributeError: 'module' object has no attribute 'linear'

Can you please let me know how to fix this? Moreover, the code is not python3-friendly because of print function you've used in the code. I mean, when I am running the code in python3, it gives me syntax error regarding the print function as it prints without parantheses.

Regards, Nader

williamleif commented 7 years ago

Apologies! There was an old method/deprecated header as a default (optional param) in evaluate_methods.py. It should be fixed now though. I am curious why this didn't throw an error for me/others..

Re Python 3. I have opened a separate issue for this. I am a bit busy now, but python 3 support would be great. I think it is just the print statements that need to be changed to the future syntax. Feel free to submit a PR for this if you like.

williamleif commented 7 years ago

(Sorry keeping open until you confirm the fix worked).

ndrmahmoudi commented 7 years ago

I realised that and fixed it by importing another method. Many thanks.