Examples of countSentence()


Examples of org.vietspider.common.text.TextCounter.countSentence()

    if(links.size() < 1) {
      return null;
    }

    TextCounter counter = new TextCounter();
    if(counter.countSentence(builder) > 3) return null;
    if(counter.countWords(builder) > 30) return null;
   
    return nodes;
  }
 
View Full Code Here

Examples of org.vietspider.common.text.TextCounter.countSentence()

    text = text.trim();
    char ch = text.charAt(0);
    if(Character.isLetter(ch) && Character.isLowerCase(ch)) return false;
   
    TextCounter counter = new TextCounter();
    if(counter.countSentence(text) > 1) return false;
   
    return true;
  }
 
}
View Full Code Here

Examples of org.vietspider.common.text.TextCounter.countSentence()

  public boolean isValidText(HTMLNode node, int size) {
    TextRenderer textRenderer = new TextRenderer(node, null);
    TextCounter counter = new TextCounter();
//    System.out.println(textRenderer.getTextValue());
//    System.out.println(counter.count(textRenderer.getTextValue()));
    if(counter.countSentence(textRenderer.getTextValue()) > size) return false;
    return true;
  }
 
}
View Full Code Here

Examples of org.vietspider.common.text.TextCounter.countSentence()

   
    while(index < end) {
      char c = text.charAt(index);
      if(c == '\\') {
        //tinh toan diem cho phan truoc
        int sentence = textCounter.countSentence(text, s, index);
        int word = textCounter.countWord(text, s, index);
//        if(sentence > 5) {
//          System.out.println("========================================");
//          System.out.println(text.substring(s, index));
//          System.out.println(" ===== > "+ sentence+  " : "
View Full Code Here

Examples of org.vietspider.common.text.TextCounter.countSentence()

      }
      index++;
    }
   
    if(s < index) {
      int sentence = textCounter.countSentence(text, s, index);
      int word = textCounter.countWord(text, s, index);
      score += new ScoreCalculator().calculate(pattern, sentence, word);
    }
   
//    System.out.println("================================================================");
View Full Code Here

Examples of org.vietspider.common.text.TextCounter.countSentence()

 
  private void processTextValue() {
    String [] elements = text.split("\n");
    TextCounter textCounter = new TextCounter();
    for(int i = 0; i < elements.length; i++) {
      int value  = textCounter.countSentence(elements[i]);
      if(value > 1) {
//        System.out.println(" : == =======================================");
//        System.out.println("papa a "+ elements[i]);
        paragraph++;
      }
View Full Code Here

Examples of org.vietspider.common.text.TextCounter.countSentence()

  private void processTextValue() {
    String [] elements = text.split("\n");
    TextCounter textCounter = new TextCounter();
    for(int i = 0; i < elements.length; i++) {
      int value  = textCounter.countSentence(elements[i]);
      if(value > 1) {
//        System.out.println(" : == =======================================");
//        System.out.println("papa a "+ elements[i]);
        paragraph++;
      }
View Full Code Here

Examples of org.vietspider.common.text.TextCounter.countSentence()

    for(int i = 0; i < nodes.length; i++) {
      if(isTextElement(nodes[i])) return;
      else if(isBlockElement(nodes[i])) {
        AnalyticsRenderer renderer = new AnalyticsRenderer(nodes[i], true);
        String text = renderer.getTextValue().toString();
        int sentence = textCounter.countSentence(text, 0, text.length());
        int word = textCounter.countWord(text, 0, text.length());

        int score = scoreCalculator.calculate(sentence, word);
        models.add(new AnalyticsModel(nodes[i], score));
        if(score > maxScore) maxScore = score;
View Full Code Here

Examples of org.vietspider.common.text.TextCounter.countSentence()

    if(renderer.getParagraph() < 1) return false;

    String [] elements = renderer.getTextValue().toString().split("\n");
    TextCounter textCounter = contentChecker.getTextCounter();
    for(String element : elements) {
      int counter = textCounter.countSentence(element);
      if(counter > max) return true;

      counter = textCounter.countWord(element, 0, element.length());
      if(counter >= 15) return true;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.