GEM-benchmark / NL-Augmenter

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`correct_common_misspellings` throws FileNotFoundError 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:

  • Remove:
spell_corrections = os.path.join(
        "transformations", "correct_common_misspellings", "spell_corrections.json"
    )
  • Use file = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'spell_corrections.json') to get a handle on the current path relative to transformation.py script file.