Package org.olat.core.commons.services.text.impl

Examples of org.olat.core.commons.services.text.impl.TextServiceImpl.characterCount()


        List<Message> allMessages = fMgr.getMessagesByForumID(forumKey);
        for (Message message : allMessages) {
          try{
            String body = message.getBody();
            Locale locale = languageService.detectLocale(body);
            int characters = languageService.characterCount(body, locale);
            message.setNumOfCharacters(characters);
            int words = languageService.wordCount(body, locale);
            message.setNumOfWords(words);
            counter++;
           
View Full Code Here


 
  public void testCharacterCount() {
    TextService languageService = new TextServiceImpl();
    for(TestTextCase.Text text:TestTextCase.getCases()) {
      Locale locale = new Locale(text.getLanguage());
      int characters = languageService.characterCount(text.getText(), locale);
      assertTrue(characters == text.getCharacters());
    }
  }
}
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.