用java为nutch编写代码

发布于 2024-10-31 09:59:15 字数 1621 浏览 3 评论 0原文

你好: 我正在用java为nutch(开源搜索引擎)编写代码,以删除索引器中阿拉伯语单词的移动。 我不知道其中有什么错误。 这是代码:

package com.mycompany.nutch.indexing;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
import org.apache.log4j.Logger;
import org.apache.nutch.crawl.CrawlDatum;
import org.apache.nutch.crawl.Inlinks;
import org.apache.nutch.indexer.IndexingException;
import org.apache.nutch.indexer.IndexingFilter;
import org.apache.nutch.indexer.NutchDocument;
import org.apache.nutch.parse.getData().parse.getData();


public class InvalidUrlIndexFilter implements IndexingFilter {

  private static final Logger LOGGER = 
    Logger.getLogger(InvalidUrlIndexFilter.class);

  private Configuration conf;

  public void addIndexBackendOptions(Configuration conf) {
    // NOOP
    return;
  }

  public NutchDocument filter(NutchDocument doc, Parse parse, Text url,
      CrawlDatum datum, Inlinks inlinks) throws IndexingException {
    if (url == null) {
      return null;
    }



    char[] parse.getData() = input.trim().toCharArray();
        for(int p=0;p<parse.getData().length;p++)
          if(!(parse.getData()[p]=='َ'||parse.getData()[p]=='ً'||parse.getData()[p]=='ُ'||parse.getData()[p]=='ِ'||parse.getData()[p]=='ٍ'||parse.getData()[p]=='ٌ' ||parse.getData()[p]=='ّ'||parse.getData()[p]=='ْ' ||parse.getData()[p]=='"' ))
            new String.append(parse.getData()[p]);

    return doc;
  }

  public Configuration getConf() {
    return conf;
  }

  public void setConf(Configuration conf) {
    this.conf = conf;
  }
}

我认为错误在于使用 parse.getdata() 但我不知道应该使用什么来代替它?

hello:
I'm writing code in java for nutch(open source search engine) to remove the movments from arabic words in the indexer.
I don't know what is the error in it.
Tthis is the code:

package com.mycompany.nutch.indexing;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
import org.apache.log4j.Logger;
import org.apache.nutch.crawl.CrawlDatum;
import org.apache.nutch.crawl.Inlinks;
import org.apache.nutch.indexer.IndexingException;
import org.apache.nutch.indexer.IndexingFilter;
import org.apache.nutch.indexer.NutchDocument;
import org.apache.nutch.parse.getData().parse.getData();


public class InvalidUrlIndexFilter implements IndexingFilter {

  private static final Logger LOGGER = 
    Logger.getLogger(InvalidUrlIndexFilter.class);

  private Configuration conf;

  public void addIndexBackendOptions(Configuration conf) {
    // NOOP
    return;
  }

  public NutchDocument filter(NutchDocument doc, Parse parse, Text url,
      CrawlDatum datum, Inlinks inlinks) throws IndexingException {
    if (url == null) {
      return null;
    }



    char[] parse.getData() = input.trim().toCharArray();
        for(int p=0;p<parse.getData().length;p++)
          if(!(parse.getData()[p]=='َ'||parse.getData()[p]=='ً'||parse.getData()[p]=='ُ'||parse.getData()[p]=='ِ'||parse.getData()[p]=='ٍ'||parse.getData()[p]=='ٌ' ||parse.getData()[p]=='ّ'||parse.getData()[p]=='ْ' ||parse.getData()[p]=='"' ))
            new String.append(parse.getData()[p]);

    return doc;
  }

  public Configuration getConf() {
    return conf;
  }

  public void setConf(Configuration conf) {
    this.conf = conf;
  }
}

I think that the error is in using parse.getdata() but I don't know what I should use instead of it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

看海 2024-11-07 09:59:15

该行

char[] parse.getData() = input.trim().toCharArray();

会给您一个编译错误,因为左侧不是变量。请将此行和以下行中的 parse.getData() 替换为唯一的变量名称(例如 parsedData)。

其次导入

import org.apache.nutch.parse.getData().parse.getData();

也会失败。看起来很像文本替换问题。

The line

char[] parse.getData() = input.trim().toCharArray();

will give you a compile error because the left hand side is not a variable. Please replace parse.getData() by a unique variable name (e.g. parsedData) in this line and the following lines.

Second the import of

import org.apache.nutch.parse.getData().parse.getData();

will also fail. Looks a lot like a text replace issue.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文