Java项目中Apache Tika的MosesTranslator构造器参数取值疑问
smtPath and scriptPath for Apache Tika's MosesTranslator Hey there! Let me clear up the confusion around those two constructor parameters—they don’t point to Java JAR files at all, which is probably where you got stuck. Here’s what each one actually needs:
smtPath: This should be the file system path to your Moses translation model directory, specifically the folder that contains themoses.iniconfiguration file. This file is the core of your Moses setup—it defines all the translation models, dictionaries, and settings needed to run translations. For example, if you’ve set up an English-to-French model in/home/yourname/moses-models/en-fr, that’s the path you’d pass here.scriptPath: This refers to the path of thescriptsdirectory included with your Moses installation. Moses relies on a set of helper scripts (for tokenization, preprocessing, postprocessing, etc.) that live in this folder. If you installed Moses to/opt/moses, this path will typically be/opt/moses/scripts.
Quick Check to Confirm
If you’re unsure where these paths are, navigate to your Moses installation and look for:
- A folder with a
moses.inifile → that’s yoursmtPath - A top-level
scriptsfolder filled with Perl/Python scripts → that’s yourscriptPath
Pro tip: Remember, MosesTranslator acts as a bridge between Tika and your local Moses toolchain—so these are paths to your local Moses files, not Tika or Java JARs.
内容的提问来源于stack exchange,提问作者noober

