Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand Down
3 changes: 2 additions & 1 deletion awe_languagetool/languagetoolClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
25 changes: 25 additions & 0 deletions awe_languagetool/setup/copy_config.py
Original file line number Diff line number Diff line change
@@ -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()