diff --git a/README.md b/README.md index 4098caf..686e8db 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,11 @@ The system uses a client-server model where the LanguageTool server processes re 1. Configure LanguageTool Server (optional) - Before starting the LanguageTool server, ensure that a server configuration file exists in `awe_languagetool/LanguageTool5_5/`. We provide a sample configuration file called `languagetool.tmp.cfg`. To use it, copy and rename this file to `languagetool.cfg`. + Before starting the LanguageTool server, ensure that a server configuration file exists in `awe_languagetool/LanguageTool5_5/`. We provide a sample configuration file called `languagetool.tmp.cfg`. To use it, copy and rename this file to `languagetool.cfg`. Create a copy with the following: + + ```bash + python -m awe_languagetool.setup.copy_config + ``` To improve performance, particularly under high request loads, adjust the server settings in `awe_languagetool/LanguageTool5_5/languagetool.cfg`. For suggested settings, see [this forum post](https://forum.languagetool.org/t/too-many-parallel-requests/8290/3) on server configurations. For a full list of configuration options, refer to the [LanguageTool server code](https://github.com/languagetool-org/languagetool/blob/c6321ab5837a9e1ae5501d746f947f5706b4b274/languagetool-server/src/main/java/org/languagetool/server/HTTPServerConfig.java). diff --git a/awe_languagetool/languagetoolClient.py b/awe_languagetool/languagetoolClient.py index cb86c71..482b386 100644 --- a/awe_languagetool/languagetoolClient.py +++ b/awe_languagetool/languagetoolClient.py @@ -43,7 +43,8 @@ def test_server_connection(server): 'Please make sure to run the LanguageTool Server before using LanguageTool Client. Run:\n'\ '`python -m awe_languagetool.languagetoolServer`\n'\ 'OR with a configuration file\n'\ - '`python -m awe_languagetool.languagetoolServer --config /path/to/config.cfg`\n'\ + '`python -m awe_languagetool.setup.copy_config`\n'\ + '`python -m awe_languagetool.languagetoolServer --config languagetool.cfg`\n'\ 'Ensure you are using the correct url.' try: diff --git a/awe_languagetool/setup/copy_config.py b/awe_languagetool/setup/copy_config.py new file mode 100644 index 0000000..f518604 --- /dev/null +++ b/awe_languagetool/setup/copy_config.py @@ -0,0 +1,25 @@ +import os +import shutil + + +def copy_temp_config(): + package_path = os.path.dirname(os.path.dirname(__file__)) + + # Define the source file path + source_file = os.path.join(package_path, 'languagetool.tmp.cfg') + + # Check if the file exists + if not os.path.exists(source_file): + raise FileNotFoundError(f"File 'languagetool.tmp.cfg' is missing and could not be copied.") + + # Define the destination file path (current directory) + destination_file = os.path.join(os.getcwd(), 'languagetool.cfg') + + # Copy the file + shutil.copy(source_file, destination_file) + + print(f"File 'languagetool.tmp.cfg' copied to {destination_file}") + + +if __name__ == '__main__': + copy_temp_config()