in hugegraph-llm/src/hugegraph_llm/operators/common_op/nltk_helper.py [0:0]
def get_cache_dir() -> str:
"""Locate a platform-appropriate cache directory for hugegraph-llm,
and create it if it doesn't yet exist
"""
# User override
if "HG_AI_CACHE_DIR" in os.environ:
path = Path(os.environ["HG_AI_CACHE_DIR"])
# Linux, Unix, AIX, etc.
elif os.name == "posix" and sys.platform != "darwin":
path = Path("/tmp/hugegraph_llm")
# Mac OS
elif sys.platform == "darwin":
path = Path(os.path.expanduser("~"), "Library/Caches/hugegraph_llm")
# Windows (hopefully)
else:
local = os.environ.get("LOCALAPPDATA", None) or os.path.expanduser("~\\AppData\\Local")
path = Path(local, "hugegraph_llm")
if not os.path.exists(path):
os.makedirs(path, exist_ok=True)
return str(path)