问题描述
我将使用Mallet SimpleTagger进行序列标记.但是,我在设置类路径时遇到问题.正如我在这里看到的:类路径
I am going to use Mallet SimpleTagger for sequence tagging. However, I have problem with setting the classpath. As I have seen here: classpath
我必须能够使用java -cp设置类路径.我按照此处的说明进行操作(我确定我已经正确安装了Ant和Mallet).但是,我收到此消息:
I must be able to use java -cp to set the classpath.I followed the instructions here (I am sure that I have installed Ant and Mallet correctly). However, I receive this message:
Error: could not find or load main class cc.mallet.fst.SimpleTagger
这是我使用的真实代码:
Here is the real code that I use:
C:\mallet> java -cp "C:\mallet\class:C:\mallet\lib\mallet-deps.jar" cc.mallet.fst.SimpleTagger --model-file G:\test1-model G:\test2-feats.txt
同时,当我运行以下命令:echo %CLASSPATH%
时,它返回%CLASSPATH%.
Meanwhile, when I run this command: echo %CLASSPATH%
, it returns %CLASSPATH%.
如果有人能帮助我,我会很感激.
I would be thankful if anybody can help me.
推荐答案
幸运的是,由于有了@ user2339071的注释和建议的链接,我可以解决此问题:
Fortunately, thanks to comments and suggested link of @user2339071, I could solve the problem:
如果使用Windows操作系统,则必须将:"替换为;".因此,这段代码对我有用:
If you are using Windows OS, you must replace ":" with ";".So, this code worked for me:
C:\mallet> java -cp "C:\mallet\class;C:\mallet\lib\mallet-deps.jar" cc.mallet.fst.SimpleTagger --model-file G:\test1-model G:\test2-feats.txt
实际上,用此代码完成的工作是将两个不同的路径确定为类路径,一个是包含槌的.class文件(C:\ mallet \ class)的文件夹,另一个是包含所有必需的jar文件的文件夹(C:\ mallet \ lib \ mallet-deps.jar),则需要用;"分隔.
Actually, what is done with this code is that two different paths are determined as the classpath, one is the folder which includes .class files of mallet (C:\mallet\class) and the other one includes all required jar files (C:\mallet\lib\mallet-deps.jar) and you need to separate them with ";".
仅此而已!
这篇关于木槌SimpleTagger类路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!