com.chenlb.mmseg4j.Word.getString()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(126)

本文整理了Java中com.chenlb.mmseg4j.Word.getString()方法的一些代码示例,展示了Word.getString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Word.getString()方法的具体详情如下:
包路径:com.chenlb.mmseg4j.Word
类名称:Word
方法名:getString

Word.getString介绍

暂无

代码示例

代码示例来源:origin: looly/hutool

@Override
public String getText() {
  return word.getString();
}

代码示例来源:origin: looly/hutool

@Override
public String getText() {
  return word.getString();
}

代码示例来源:origin: hugegraph/hugegraph

@Override
  public Set<String> segment(String text) {
    Set<String> result = InsertionOrderUtil.newSet();
    MMSeg mmSeg = new MMSeg(new StringReader(text), this.seg);
    try {
      Word word = null;
      while ((word = mmSeg.next()) != null) {
        result.add(word.getString());
      }
    } catch (Exception e) {
      throw new HugeException("MMSeg4j segment text '%s' failed",
                  e, text);
    }
    return result;
  }
}

代码示例来源:origin: cn.hutool/hutool-all

@Override
public String getText() {
  return word.getString();
}

代码示例来源:origin: medcl/elasticsearch-analysis-mmseg

public String toString() {
  return getString();
}
/**

代码示例来源:origin: com.chenlb.mmseg4j/mmseg4j-core

public String toString() {
  return getString();
}
/**

代码示例来源:origin: chenlb/mmseg4j-core

public String toString() {
  return getString();
}
/**

代码示例来源:origin: chenlb/mmseg4j-core

@Override
public String toString() {
  StringBuilder sb = new StringBuilder();
  for(Word word : words) {
    if(word != null) {
      sb.append(word.getString()).append('_');
    }
  }
  return sb.toString();
}

代码示例来源:origin: medcl/elasticsearch-analysis-mmseg

@Override
public String toString() {
  StringBuilder sb = new StringBuilder();
  for(Word word : words) {
    if(word != null) {
      sb.append(word.getString()).append('_');
    }
  }
  return sb.toString();
}

代码示例来源:origin: com.chenlb.mmseg4j/mmseg4j-core

@Override
public String toString() {
  StringBuilder sb = new StringBuilder();
  for(Word word : words) {
    if(word != null) {
      sb.append(word.getString()).append('_');
    }
  }
  return sb.toString();
}

代码示例来源:origin: chenlb/mmseg4j-core

public String segWords(Reader input, String wordSpilt) throws IOException {
  StringBuilder sb = new StringBuilder();
  Seg seg = getSeg();    //取得不同的分词具体算法
  MMSeg mmSeg = new MMSeg(input, seg);
  Word word = null;
  boolean first = true;
  while((word=mmSeg.next())!=null) {
    if(!first) {
      sb.append(wordSpilt);
    }
    String w = word.getString();
    sb.append(w);
    first = false;
    
  }
  return sb.toString();
}

代码示例来源:origin: com.chenlb.mmseg4j/mmseg4j-core

public String segWords(Reader input, String wordSpilt) throws IOException {
  StringBuilder sb = new StringBuilder();
  Seg seg = getSeg();    //取得不同的分词具体算法
  MMSeg mmSeg = new MMSeg(input, seg);
  Word word = null;
  boolean first = true;
  while((word=mmSeg.next())!=null) {
    if(!first) {
      sb.append(wordSpilt);
    }
    String w = word.getString();
    sb.append(w);
    first = false;
    
  }
  return sb.toString();
}

代码示例来源:origin: net.sf.jabb/jabb-core

public List<String> getWords(String document){
  List<String> words = new FastList<String>();
  
  Reader sr = new StringReader(document.toString());
  this.reset(sr);
  
  Word word = null;
  List<String> identifiedWords = chineseWordIdentifier.getIdentifiedWords();
  try {
    while(true) {
      word = this.next();
      if (word != null){	// MMSeg分出来的非中文词条
        words.add(word.getString());
      } else if (identifiedWords.size() > 0){	//自己分出来的中文词条
        words.addAll(identifiedWords);
        identifiedWords.clear();
      } else {	//没词了
        break;
      }
      
    }
  } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
  
  return words;
}

代码示例来源:origin: com.baidu.hugegraph/hugegraph-core

@Override
  public Set<String> segment(String text) {
    Set<String> result = InsertionOrderUtil.newSet();
    MMSeg mmSeg = new MMSeg(new StringReader(text), this.seg);
    try {
      Word word = null;
      while ((word = mmSeg.next()) != null) {
        result.add(word.getString());
      }
    } catch (Exception e) {
      throw new HugeException("MMSeg4j segment text '%s' failed",
                  e, text);
    }
    return result;
  }
}

代码示例来源:origin: net.sf.jabb/jabb-core

@Override
void analyzeWords(AnalyzedText aText) {
  FastList<String> list = new FastList<String>();
  FastSet<String> set = new FastSet<String>();
  com.chenlb.mmseg4j.Word word = null;
  Reader sr = new StringReader(aText.getText());
  synchronized(mmSeg){
    mmSeg.reset(sr);
    try{
      while((word=mmSeg.next())!=null) {
        String w = word.getString();
        list.add(w);
        set.add(w);
      }
    }catch(IOException e){
      throw new RuntimeException("IOException occurred", e);
    }
  }
  aText.setWords(list);
  aText.setUniqueWords(set);
}

相关文章