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

ljacqu / wordeval / 14561507106

20 Apr 2025 04:52PM UTC coverage: 55.233% (-0.08%) from 55.313%
14561507106

push

github

ljacqu
Convert all main methods to self-contained Spring beans

291 of 596 branches covered (48.83%)

0 of 9 new or added lines in 4 files covered. (0.0%)

760 of 1376 relevant lines covered (55.23%)

3.15 hits per line

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

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

3
import ch.jalu.wordeval.appdata.AppData;
4
import ch.jalu.wordeval.config.SpringContainedRunner;
5
import ch.jalu.wordeval.dictionary.Dictionary;
6
import ch.jalu.wordeval.dictionary.DictionaryProcessor;
7
import ch.jalu.wordeval.dictionary.Word;
8
import ch.jalu.wordeval.evaluators.export.ExportService;
9
import ch.jalu.wordeval.evaluators.processing.EvaluatorCollection;
10
import ch.jalu.wordeval.evaluators.processing.EvaluatorInitializer;
11
import ch.jalu.wordeval.evaluators.processing.EvaluatorProcessor;
12
import ch.jalu.wordeval.language.Language;
13
import ch.jalu.wordeval.util.TimeLogger;
14
import com.google.common.collect.ImmutableMap;
15
import lombok.extern.slf4j.Slf4j;
16
import org.springframework.beans.factory.annotation.Autowired;
17

18
import java.util.Collection;
19
import java.util.List;
20
import java.util.Map;
21

22
/**
23
 * Entry point of the <i>wordeval</i> application: generates JSON export of the evaluator results.
24
 */
25
@Slf4j
×
NEW
26
public class WordEvalMain extends SpringContainedRunner {
×
27

28
  @Autowired
29
  private AppData appData;
30

31
  @Autowired
32
  private EvaluatorInitializer evaluatorInitializer;
33

34
  @Autowired
35
  private EvaluatorProcessor evaluatorProcessor;
36

37
  @Autowired
38
  private ExportService exportService;
39

40
  /**
41
   * Entry point method.
42
   *
43
   * @param args .
44
   */
45
  public static void main(String[] args) {
NEW
46
    runApplication(WordEvalMain.class, args);
×
47
  }
×
48

49
  @Override
50
  public void run(String... args) {
51
    List<String> codes = List.of("eu", "en-us", "fr");
×
52

53
    for (String code : codes) {
×
54
      exportLanguage(code);
×
55
    }
×
56
  }
×
57

58
  /**
59
   * Exports the evaluator results for a dictionary into the /export folder.
60
   *
61
   * @param code the code of the dictionary to evaluate
62
   */
63
  public void exportLanguage(String code) {
64
    log.info("");
×
65
    log.info("Exporting language '{}'", code);
×
66
    TimeLogger timeLogger = new TimeLogger(log);
×
67

68
    Dictionary dictionary = appData.getDictionary(code);
×
69
    Language language = dictionary.getLanguage();
×
70
    timeLogger.lap("Looked up dictionary");
×
71

72
    EvaluatorCollection evaluators = evaluatorInitializer.createAllEvaluators(language);
×
73
    timeLogger.lap("Instantiated evaluators. Total: " + evaluators.size());
×
74

75
    Collection<Word> allWords = DictionaryProcessor.readAllWords(dictionary);
×
76
    timeLogger.lap("Loaded all words: total " + allWords.size() + " words");
×
77

78
    evaluatorProcessor.processAllWords(evaluators, allWords);
×
79
    timeLogger.lap("Ran all words through all evaluators");
×
80

81
    Map<String, String> metaInfo = ImmutableMap.of(
×
82
        "dictionary", code,
83
        "language", language.getName(),
×
84
        "gen_date", String.valueOf(System.currentTimeMillis() / 1000L),
×
85
        "words", String.valueOf(allWords.size()));
×
86
    timeLogger.lap("processed dictionary");
×
87

88
    exportService.export(language, evaluators.streamThroughAllEvaluators());
×
89
    timeLogger.lap("finished export");
×
90
    timeLogger.logWithOverallTime("Finished language '" + code + "'");
×
91
  }
×
92
}
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

© 2026 Coveralls, Inc