hook-nltk.py 808 B

123456789101112131415161718192021222324252627
  1. # ------------------------------------------------------------------
  2. # Copyright (c) 2020 PyInstaller Development Team.
  3. #
  4. # This file is distributed under the terms of the GNU General Public
  5. # License (version 2.0 or later).
  6. #
  7. # The full license is available in LICENSE, distributed with
  8. # this software.
  9. #
  10. # SPDX-License-Identifier: GPL-2.0-or-later
  11. # ------------------------------------------------------------------
  12. # hook for nltk
  13. import nltk
  14. import os
  15. from PyInstaller.utils.hooks import collect_data_files
  16. # add datas for nltk
  17. datas = collect_data_files('nltk', False)
  18. # loop through the data directories and add them
  19. for p in nltk.data.path:
  20. if os.path.exists(p):
  21. datas.append((p, "nltk_data"))
  22. # nltk.chunk.named_entity should be included
  23. hiddenimports = ["nltk.chunk.named_entity"]