UNPKG

romanize-string

Version:

A fully typed, general-purpose utility for unidirectional string transliteration (non-Latin script => Latin script).

23 lines (22 loc) 871 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ensurePythonWithThaiLib = void 0; const child_process_1 = require("child_process"); const ensurePythonWithThaiLib = () => { try { // Check if Python 3 is installed (0, child_process_1.execSync)("python3 --version", { stdio: "ignore" }); } catch { throw new Error("Python 3 is not installed. Thai transliteration requires Python 3 and the 'pythainlp' library."); } try { // Check if pythainlp is installed (0, child_process_1.execSync)('python3 -c "import pythainlp"', { stdio: "ignore" }); } catch { throw new Error("The 'pythainlp' library is not installed. Please run 'pip3 install pythainlp' to enable Thai transliteration."); } return; }; exports.ensurePythonWithThaiLib = ensurePythonWithThaiLib;