File tree 1 file changed +7
-4
lines changed
airbyte_cdk/sources/file_based/file_types
1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 43
43
unstructured_partition_docx = None
44
44
unstructured_partition_pptx = None
45
45
46
+ AIRBYTE_NLTK_DATA_DIR = "/airbyte/nltk_data"
47
+ TMP_NLTK_DATA_DIR = "/tmp/nltk_data"
46
48
47
- def get_ntlk_temp_folder () -> str :
49
+
50
+ def get_nltk_temp_folder () -> str :
48
51
"""
49
52
For non-root connectors /tmp is not currently writable, but we should allow it in the future.
50
53
It's safe to use /airbyte for now. Fallback to /tmp for local development.
51
54
"""
52
55
try :
53
- nltk_data_dir = "/airbyte/nltk_data"
56
+ nltk_data_dir = AIRBYTE_NLTK_DATA_DIR
54
57
os .makedirs (nltk_data_dir , exist_ok = True )
55
58
except OSError :
56
- nltk_data_dir = "/tmp/nltk_data"
59
+ nltk_data_dir = TMP_NLTK_DATA_DIR
57
60
os .makedirs (nltk_data_dir , exist_ok = True )
58
61
return nltk_data_dir
59
62
60
63
61
64
try :
62
- nltk_data_dir = get_ntlk_temp_folder ()
65
+ nltk_data_dir = get_nltk_temp_folder ()
63
66
nltk .data .path .append (nltk_data_dir )
64
67
nltk .data .find ("tokenizers/punkt.zip" )
65
68
nltk .data .find ("tokenizers/punkt_tab.zip" )
You can’t perform that action at this time.
0 commit comments