edu.stanford.nlp.ling.Word.toString()方法的使用及代码示例

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

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

Word.toString介绍

暂无

代码示例

代码示例来源:origin: stanfordnlp/CoreNLP

private static ArrayList<Word> postProcessSentence(ArrayList<Word> sent) {
 ArrayList<Word> newSent = new ArrayList<>();
 for(Word word : sent) {
  if(newSent.size() > 0) {
   String prevWord = newSent.get(newSent.size()-1).toString();
   String curWord = word.toString();
   String prevChar = prevWord.substring(prevWord.length()-1);
   String curChar = curWord.substring(0,1);
   if(!isChinese(prevChar) && !isChinese(curChar)) {
    Word mergedWord = new Word(prevWord+curWord);
    newSent.set(newSent.size()-1, mergedWord);
    //printlnErr("merged: "+mergedWord);
    //printlnErr("merged: "+mergedWord+" from: "+prevWord+" and: "+curWord);
    continue;
   }
  }
  newSent.add(word);
 }
 return new ArrayList<>(newSent);
}

代码示例来源:origin: stanfordnlp/CoreNLP

private void tokenizeDate(String inputDate) {
 tokens = new ArrayList<>();
 Pattern pat = Pattern.compile("[-]");
 if (inputDate == null) {
  System.out.println("Null input date");
 }
 Matcher m = pat.matcher(inputDate);
 String str = m.replaceAll(" - ");
 str = str.replaceAll(",", " ");
 PTBTokenizer<Word> tokenizer = PTBTokenizer.newPTBTokenizer(new BufferedReader(new StringReader(str)));
 while (tokenizer.hasNext()) {
  Word nextToken = tokenizer.next();
  tokens.add(nextToken.toString());
 }
 if(DEBUG) {
  System.out.println("tokens:" + tokens);
 }
}

代码示例来源:origin: stanfordnlp/CoreNLP

docStr.append(' ');
docStr.append(aDoc.toString());

代码示例来源:origin: edu.stanford.nlp/corenlp

private void tokenizeDate(String inputDate) {
 tokens = new ArrayList<String>();
 Pattern pat = Pattern.compile("[-]");
 if (inputDate == null) {
  System.out.println("Null input date");
 }
 Matcher m = pat.matcher(inputDate);
 String str = m.replaceAll(" - ");
 str = str.replaceAll(",", " ");
 PTBTokenizer<Word> tokenizer = PTBTokenizer.newPTBTokenizer(new BufferedReader(new StringReader(str)));
 while (tokenizer.hasNext()) {
  Word nextToken = tokenizer.next();
  tokens.add(nextToken.toString());
 }
 if(DEBUG) {
  System.out.println("tokens:" + tokens);
 }
}

代码示例来源:origin: com.guokr/stan-cn-com

private void tokenizeDate(String inputDate) {
 tokens = new ArrayList<String>();
 Pattern pat = Pattern.compile("[-]");
 if (inputDate == null) {
  System.out.println("Null input date");
 }
 Matcher m = pat.matcher(inputDate);
 String str = m.replaceAll(" - ");
 str = str.replaceAll(",", " ");
 PTBTokenizer<Word> tokenizer = PTBTokenizer.newPTBTokenizer(new BufferedReader(new StringReader(str)));
 while (tokenizer.hasNext()) {
  Word nextToken = tokenizer.next();
  tokens.add(nextToken.toString());
 }
 if(DEBUG) {
  System.out.println("tokens:" + tokens);
 }
}

代码示例来源:origin: edu.stanford.nlp/stanford-corenlp

private void tokenizeDate(String inputDate) {
 tokens = new ArrayList<>();
 Pattern pat = Pattern.compile("[-]");
 if (inputDate == null) {
  System.out.println("Null input date");
 }
 Matcher m = pat.matcher(inputDate);
 String str = m.replaceAll(" - ");
 str = str.replaceAll(",", " ");
 PTBTokenizer<Word> tokenizer = PTBTokenizer.newPTBTokenizer(new BufferedReader(new StringReader(str)));
 while (tokenizer.hasNext()) {
  Word nextToken = tokenizer.next();
  tokens.add(nextToken.toString());
 }
 if(DEBUG) {
  System.out.println("tokens:" + tokens);
 }
}

代码示例来源:origin: edu.stanford.nlp/stanford-parser

docStr.append(' ');
docStr.append(aDoc.toString());

相关文章