nlqk
Natural Language Qu Kit (NLQK) - A Quantum Natural Language Processing (QNLP) Library
(C) 2024-2025 by Damir Cavar and NLP Lab
This is a collection of modules and functions necessary for Quantum Natural Language Processing.
1# coding: utf-8 2 3""" 4[Natural Language Qu Kit](https://nlqk.ai/) ([NLQK](https://nlqk.ai/)) - A Quantum Natural Language Processing (QNLP) Library 5 6(C) 2024-2025 by [Damir Cavar](http://damir.cavar.me/) and [NLP Lab](https://nlp-lab.org/) 7 8 9This is a collection of modules and functions necessary for Quantum Natural Language Processing. 10""" 11 12 13from sys import platform 14import os 15from pathlib import Path 16if os.getenv("GITHUB_ACTIONS") == "true": 17 import numpy as np 18else: 19 try: # prefer RAPIDS libraries and GPU over numpy and CPU 20 import cupy as np # Try to import cupy and alias it as np 21 _USE_GPU = True 22 except ModuleNotFoundError: 23 import numpy as np # If cupy not found, import numpy and alias it as np 24 _USE_GPU = False 25# import GPUtil # If you're using GPUtil 26from nlqk import defaults 27 28 29def get_data_folder() -> Path: 30 """Get the path to the data folder for NLQK. 31 As a side-effect the folder is created if it does not exist. 32 Returns: 33 """ 34 if platform == "linux" or platform == "linux2": 35 data_directory = Path.home() / defaults.DATA_FOLDER_NAME 36 elif platform == "darwin": 37 data_directory = Path.home() / defaults.DATA_FOLDER_NAME 38 elif platform == "win32": 39 data_directory = Path.home() / defaults.DATA_FOLDER_WIN / defaults.DATA_FOLDER_NAME 40 else: 41 data_directory = Path(".") 42 43 # check whether folder exists 44 if not data_directory.exists(): 45 data_directory.mkdir(parents=True) 46 47 return data_directory
def
get_data_folder() -> pathlib._local.Path:
30def get_data_folder() -> Path: 31 """Get the path to the data folder for NLQK. 32 As a side-effect the folder is created if it does not exist. 33 Returns: 34 """ 35 if platform == "linux" or platform == "linux2": 36 data_directory = Path.home() / defaults.DATA_FOLDER_NAME 37 elif platform == "darwin": 38 data_directory = Path.home() / defaults.DATA_FOLDER_NAME 39 elif platform == "win32": 40 data_directory = Path.home() / defaults.DATA_FOLDER_WIN / defaults.DATA_FOLDER_NAME 41 else: 42 data_directory = Path(".") 43 44 # check whether folder exists 45 if not data_directory.exists(): 46 data_directory.mkdir(parents=True) 47 48 return data_directory
Get the path to the data folder for NLQK. As a side-effect the folder is created if it does not exist. Returns: