You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`PYTHAINLP_DATA`| Path to the data directory (default: `~/pythainlp-data`). | Current |
94
+
|`PYTHAINLP_DATA_DIR`| Legacy alias for `PYTHAINLP_DATA`. Emits a `DeprecationWarning`. Setting both raises `ValueError`. | Deprecated; use `PYTHAINLP_DATA`|
95
+
|`PYTHAINLP_OFFLINE`| Set to `1` to disable automatic corpus downloads. Explicit `download()` calls still work. | Current |
96
+
|`PYTHAINLP_READ_ONLY`| Set to `1` to enable read-only mode, which prevents implicit background writes to PyThaiNLP's internal data directory (corpus downloads, catalog updates, directory creation). Explicit user-initiated saves to user-specified paths are unaffected. | Current |
97
+
|`PYTHAINLP_READ_MODE`| Legacy alias for `PYTHAINLP_READ_ONLY`. Emits a `DeprecationWarning`. Setting both raises `ValueError`. | Deprecated; use `PYTHAINLP_READ_ONLY`|
98
+
89
99
### Offline mode
90
100
91
-
Set `PYTHAINLP_OFFLINE=1` to disable automatic corpus downloads.
101
+
Set `PYTHAINLP_OFFLINE=1` to disable **automatic** corpus downloads.
92
102
When this variable is set and a corpus is not already cached locally,
93
103
a `FileNotFoundError` is raised instead of attempting a network download.
104
+
Explicit calls to `pythainlp.corpus.download()` are unaffected.
94
105
Use `pythainlp.is_offline_mode()` to check the current state programmatically.
95
106
96
107
```python
97
108
import pythainlp
98
109
print(pythainlp.is_offline_mode()) # True if PYTHAINLP_OFFLINE=1
99
110
```
100
111
112
+
### Read-only mode
113
+
114
+
Set `PYTHAINLP_READ_ONLY=1` to prevent implicit background writes to PyThaiNLP's
115
+
internal data directory. This blocks corpus downloads, catalog updates, and
116
+
automatic data directory creation — writes that happen as side effects the user
117
+
may not be aware of.
118
+
119
+
Operations where the user explicitly specifies an output path are unaffected
0 commit comments