Skip to content

Commit 6a3e113

Browse files
committed
Update PYTHAINLP_DATA examples
1 parent 44a6b78 commit 6a3e113

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

README_TH.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ PyThaiNLP ดาวน์โหลดข้อมูล (ดูแค็ตต
110110
[pythainlp-corpus](https://github.com/PyThaiNLP/pythainlp-corpus))
111111
ไปที่ `~/pythainlp-data` ตามค่าเริ่มต้น
112112
ตั้งค่า environment variable `PYTHAINLP_DATA` เพื่อเปลี่ยนตำแหน่งนี้
113-
(`PYTHAINLP_DATA_DIR` ยังคงใช้ได้แต่เลิกใช้แล้ว)
113+
(`PYTHAINLP_DATA_DIR` ยังคงใช้ได้ แต่จะเลิกใช้ในอนาคต)
114114

115115
เมื่อใช้ PyThaiNLP ในสภาพแวดล้อมการคำนวณแบบกระจาย
116116
(เช่น Apache Spark) ให้ตั้งค่า environment variable `PYTHAINLP_DATA`

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ services:
88
stdin_open: true
99
tty: true
1010
environment:
11-
- PYTHAINLP_DATA_DIR=/workspace/pythainlp-data
11+
- PYTHAINLP_DATA=/workspace/pythainlp-data

examples/distributed_pyspark.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Example: Using PyThaiNLP in PySpark Distributed Environment
66
77
This example demonstrates how to use PyThaiNLP in a distributed environment
8-
like Apache Spark. The key is to set the PYTHAINLP_DATA_DIR environment
8+
like Apache Spark. The key is to set the PYTHAINLP_DATA environment
99
variable inside the function that will be distributed to executor nodes.
1010
1111
PyThaiNLP's core tokenization engines are thread-safe, making them suitable
@@ -45,9 +45,9 @@ def tokenize_thai(text):
4545
"""
4646
import os
4747

48-
# Set PYTHAINLP_DATA_DIR before importing pythainlp
48+
# Set PYTHAINLP_DATA before importing pythainlp
4949
# Use './pythainlp-data' to store data in current working directory
50-
os.environ["PYTHAINLP_DATA_DIR"] = "./pythainlp-data"
50+
os.environ["PYTHAINLP_DATA"] = "./pythainlp-data"
5151

5252
# Now import pythainlp modules
5353
from pythainlp.tokenize import word_tokenize
@@ -96,7 +96,7 @@ def tokenize_udf(text):
9696
"""
9797
import os
9898

99-
os.environ["PYTHAINLP_DATA_DIR"] = "./pythainlp-data"
99+
os.environ["PYTHAINLP_DATA"] = "./pythainlp-data"
100100

101101
from pythainlp.tokenize import word_tokenize
102102

@@ -134,7 +134,7 @@ def process_thai_text(text):
134134
import os
135135

136136
# Configure data directory
137-
os.environ["PYTHAINLP_DATA_DIR"] = "./pythainlp-data"
137+
os.environ["PYTHAINLP_DATA"] = "./pythainlp-data"
138138

139139
# Import required modules
140140
from pythainlp.tag import pos_tag
@@ -197,7 +197,7 @@ def safe_tokenize(text):
197197

198198
try:
199199
# Set environment variables
200-
os.environ["PYTHAINLP_DATA_DIR"] = "./pythainlp-data"
200+
os.environ["PYTHAINLP_DATA"] = "./pythainlp-data"
201201

202202
# Import modules
203203
from pythainlp.tokenize import word_tokenize

0 commit comments

Comments
 (0)