File tree Expand file tree Collapse file tree
src/main/java/ai/elimu/web/content/word Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -51,15 +51,15 @@ public String handleRequest(Model model) {
5151 model .addAttribute ("maxUsageCount" , maxUsageCount );
5252
5353 // Extract letter frequency distribution from storybook paragraphs
54- List <String > wordsInParagraphs = new ArrayList <>();
54+ List <String > paragraphs = new ArrayList <>();
5555 for (StoryBookParagraph storyBookParagraph : storyBookParagraphDao .readAll ()) {
56- for ( String word : storyBookParagraph .getOriginalText (). split ( " " )) {
57- wordsInParagraphs .add (word );
56+ if ( StringUtils . isNotBlank ( storyBookParagraph .getOriginalText ())) {
57+ paragraphs .add (storyBookParagraph . getOriginalText () );
5858 }
5959 }
6060 if (StringUtils .isNotBlank (ConfigHelper .getProperty ("content.language" ))) {
6161 Language language = Language .valueOf (ConfigHelper .getProperty ("content.language" ));
62- Map <String , Integer > wordFrequencyMap = WordFrequencyHelper .getWordFrequency (wordsInParagraphs , language );
62+ Map <String , Integer > wordFrequencyMap = WordFrequencyHelper .getWordFrequency (paragraphs , language );
6363 model .addAttribute ("wordFrequencyMap" , wordFrequencyMap );
6464 }
6565
You can’t perform that action at this time.
0 commit comments