INK-USC / shifted-label-distribution

Source code for paper "Looking Beyond Label Noise: Shifted Label Distribution Matters in Distantly Supervised Relation Extraction" (EMNLP 2019)
https://arxiv.org/abs/1904.09331
Apache License 2.0
39 stars 2 forks source link

nltk requires python3.5+ #4

Closed Chenhao-Leon closed 3 years ago

Chenhao-Leon commented 3 years ago

hello, when I am running feature_extraction.sh the program returns following errors :

KBP
Generate Features
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Requirement already satisfied: tqdm in /home/ch/.local/lib/python2.7/site-packages (4.56.0)
Requirement already satisfied: stanza in /home/ch/.local/lib/python2.7/site-packages (0.3)
Requirement already satisfied: ujson in /home/ch/.local/lib/python2.7/site-packages (2.0.3)
Requirement already satisfied: unidecode in /home/ch/.local/lib/python2.7/site-packages (1.1.2)
Requirement already satisfied: requests in /home/ch/.local/lib/python2.7/site-packages (2.25.1)
Requirement already satisfied: nltk in /home/ch/.local/lib/python2.7/site-packages (3.5)
Requirement already satisfied: chardet<5,>=3.0.2 in /home/ch/.local/lib/python2.7/site-packages (from requests) (4.0.0)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /home/ch/.local/lib/python2.7/site-packages (from requests) (1.26.2)
Requirement already satisfied: idna<3,>=2.5 in /home/ch/.local/lib/python2.7/site-packages (from requests) (2.10)
Requirement already satisfied: certifi>=2017.4.17 in /home/ch/.local/lib/python2.7/site-packages (from requests) (2020.12.5)
Requirement already satisfied: regex in /home/ch/.local/lib/python2.7/site-packages (from nltk) (2020.11.13)
Requirement already satisfied: click in /home/ch/.local/lib/python2.7/site-packages (from nltk) (7.1.2)
Requirement already satisfied: joblib in /home/ch/.local/lib/python2.7/site-packages (from nltk) (0.14.1)
Traceback (most recent call last):
  File "DataProcessor/feature_generation.py", line 8, in <module>
    from ner_feature import pipeline, filter, pipeline_test
  File "/home/ch/experiment/shifted-label-distribution/DataProcessor/ner_feature.py", line 3, in <module>
    from Feature import *
  File "/home/ch/experiment/shifted-label-distribution/DataProcessor/Feature/__init__.py", line 3, in <module>
    from token_feature import HeadFeature, EntityMentionTokenFeature, BetweenEntityMentionTokenFeature, ContextFeature, ContextGramFeature
  File "/home/ch/experiment/shifted-label-distribution/DataProcessor/Feature/token_feature.py", line 4, in <module>
    from nltk.stem.wordnet import WordNetLemmatizer
  File "/home/ch/.local/lib/python2.7/site-packages/nltk/__init__.py", line 128, in <module>
    from nltk.collocations import *
  File "/home/ch/.local/lib/python2.7/site-packages/nltk/collocations.py", line 35, in <module>
    from nltk.probability import FreqDist
  File "/home/ch/.local/lib/python2.7/site-packages/nltk/probability.py", line 333
    print("%*s" % (width, samples[i]), end=" ")
                                          ^
SyntaxError: invalid syntax

I think because nltk need python 3.5+ while you use python2. I want to ask how to solve this problem. Thank you