使用“SequenceFilesFromDirectory”的问题在我的代码中
我正在尝试编写一个示例程序,它可以调用“SequenceFilesFromDirectory”的主要方法,该方法旨在将一组文件转换为序列文件格式。
public class TestSequenceFileConverter {
public static void main(String args[]){
String inputDir = "inputDir";
String outputDir = "outoutDir";
SequenceFilesFromDirectory.main(new String[] {"--input",
inputDir.toString(), "--output", outputDir.toString(), "--chunkSize",
"64", "--charset",Charsets.UTF_8.name()});
}
}
但是 Eclipse 告诉我我所做的事情是错误的,并出现以下错误消息
该行有多个标记 - 标记“main”上的语法错误,= 在此之后预期 代币 - 标记语法错误、构造错误 - SequenceFilesFromDirectory 无法解析
我想我没有正确使用此方法,但我不知道如何修复它?多谢。
以下是 SequenceFilesFromDirectory 的定义方式。 SequenceFilesFromDirectory 的 API 链接是 http://search -lucene.com/jd/mahout/utils/org/apache/mahout/text/SequenceFilesFromDirectory.html
I am trying to write a sample program that can call use the main method of "SequenceFilesFromDirectory", which aims to convert a set of files into sequence file format.
public class TestSequenceFileConverter {
public static void main(String args[]){
String inputDir = "inputDir";
String outputDir = "outoutDir";
SequenceFilesFromDirectory.main(new String[] {"--input",
inputDir.toString(), "--output", outputDir.toString(), "--chunkSize",
"64", "--charset",Charsets.UTF_8.name()});
}
}
But the Eclipse tells me that what I did was wrong with the following error message
Multiple markers at this line
- Syntax error on token "main", = expected after this
token
- Syntax error on token(s), misplaced construct(s)
- SequenceFilesFromDirectory cannot be resolved
I think I did not use this method correctly, but I don't know how to fix it? Thanks a lot.
The following is how the SequenceFilesFromDirectory defines. The API link for SequenceFilesFromDirectory is http://search-lucene.com/jd/mahout/utils/org/apache/mahout/text/SequenceFilesFromDirectory.html
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我的猜测是您缺少文件第一部分中的导入行:
My guess is that you're missing an import line from the first section of your file:
我认为您使用 SequenceFilesFromDirectory 的目的是将 doc 文件转换为序列文件。如果是这样,最好在创建SequenceFilesFromDirectory的对象之后调用run()/runSequential()/runMapReduce()方法,因为SequenceFilesFromDirectory.main()内部会调用haddop ToolRunner.run()方法进行处理。
而 SequenceFilesFromDirectory 的 run 方法执行实际处理。
I think your purpose for using SequenceFilesFromDirectory is to convert doc files to sequence files. If so, better to call the run()/runSequential()/runMapReduce() methods ater creating an object of SequenceFilesFromDirectory, because SequenceFilesFromDirectory.main() internally calls haddop ToolRunner.run() method for processing.
Whereas the run methods of SequenceFilesFromDirectory do the actual processings.