• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ljacqu / wordeval / 14547689595

19 Apr 2025 09:07AM UTC coverage: 50.591% (-0.8%) from 51.4%
14547689595

push

github

ljacqu
Improve fr dictionary sanitizer

240 of 572 branches covered (41.96%)

10 of 39 new or added lines in 5 files covered. (25.64%)

2 existing lines in 1 file now uncovered.

685 of 1354 relevant lines covered (50.59%)

2.98 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/ch/jalu/wordeval/runners/DictionaryProcessor.java
1
package ch.jalu.wordeval.runners;
2

3
import ch.jalu.wordeval.DataUtils;
4
import ch.jalu.wordeval.dictionary.Dictionary;
5
import ch.jalu.wordeval.dictionary.Word;
6
import ch.jalu.wordeval.dictionary.WordFactory;
7
import ch.jalu.wordeval.dictionary.sanitizer.Sanitizer;
8
import ch.jalu.wordeval.language.Language;
9
import org.apache.commons.lang3.StringUtils;
10

11
import java.util.ArrayList;
12
import java.util.List;
13

14
/**
15
 * Processes a dictionary.
16
 */
17
public final class DictionaryProcessor {
18

19
  private DictionaryProcessor() {
20
  }
21

22
  public static List<Word> readAllWords(Dictionary dictionary) {
23
    final Sanitizer sanitizer = dictionary.buildSanitizer();
×
24
    final Language language = dictionary.getLanguage();
×
25
    final WordFactory wordFactory = new WordFactory(language);
×
26

27
    return DataUtils.readAllLines(dictionary.getFile())
×
NEW
28
        .stream()
×
NEW
29
        .map(sanitizer::isolateWord)
×
NEW
30
        .filter(StringUtils::isNotEmpty)
×
NEW
31
        .map(wordFactory::createWordObject)
×
NEW
32
        .toList();
×
33
  }
34

35
  public static WordEntries getSkippedLines(Dictionary dictionary) {
NEW
36
    final Sanitizer sanitizer = dictionary.buildSanitizer();
×
NEW
37
    List<String> skippedLines = new ArrayList<>();
×
NEW
38
    List<String> includedLines = new ArrayList<>();
×
39

NEW
40
    DataUtils.readAllLines(dictionary.getFile()).forEach(line -> {
×
NEW
41
      String isolatedWord = sanitizer.isolateWord(line);
×
NEW
42
      if (StringUtils.isEmpty(isolatedWord)) {
×
NEW
43
        skippedLines.add(line);
×
44
      } else {
NEW
45
        includedLines.add(isolatedWord + " -> " + line);
×
46
      }
NEW
47
    });
×
48

NEW
49
    return new WordEntries(skippedLines, includedLines);
×
50
  }
51

NEW
52
  public record WordEntries(List<String> skippedLines, List<String> includedLines) {
×
53
  }
54
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc