GEM-benchmark / NL-Augmenter

NL-Augmenter 🦎 → 🐍 A Collaborative Repository of Natural Language Transformations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`insert_abbreviation` incorrectly imports python file and incorrectly assumes resources are relative to transformation directory

Saad-Mahamood opened this issue · comments

These issues appear when trying to use this transformation outside of the root NL-Augumenter directory. For example in another sub-directory off the root directory. The fixes needed are the following:

  • import grammaire.py using the full import path: import transformations.insert_abbreviation.grammaire as grammaire
  • Remove sys.path.append("./transformations/insert_abbreviation")
  • Use file = os.path.join(os.path.dirname(os.path.abspath(__file__)), '<file_name>.txt') to get a handle on the current path relative to transformation.py script file. This will allow easy access to the two .txt resource files.