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

ljacqu / wordeval / 14560448446

20 Apr 2025 02:30PM UTC coverage: 55.102% (+1.4%) from 53.745%
14560448446

push

github

ljacqu
Springify processing of evaluators

291 of 596 branches covered (48.83%)

51 of 63 new or added lines in 8 files covered. (80.95%)

57 existing lines in 6 files now uncovered.

756 of 1372 relevant lines covered (55.1%)

3.13 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.dictionary.Dictionary;
5
import ch.jalu.wordeval.dictionary.DictionaryProcessor;
6
import ch.jalu.wordeval.dictionary.Word;
7
import ch.jalu.wordeval.evaluators.export.ExportService;
8
import ch.jalu.wordeval.evaluators.processing.EvaluatorInitializer;
9
import ch.jalu.wordeval.evaluators.processing.EvaluatorCollection;
10
import ch.jalu.wordeval.evaluators.processing.EvaluatorProcessor;
11
import ch.jalu.wordeval.language.Language;
12
import ch.jalu.wordeval.util.TimeLogger;
13
import com.google.common.collect.ImmutableMap;
14
import lombok.extern.slf4j.Slf4j;
15
import org.springframework.beans.factory.annotation.Autowired;
16
import org.springframework.boot.CommandLineRunner;
17
import org.springframework.boot.SpringApplication;
18
import org.springframework.boot.autoconfigure.SpringBootApplication;
19
import org.springframework.context.annotation.Profile;
20

21
import java.util.Collection;
22
import java.util.List;
23
import java.util.Map;
24

25
/**
26
 * Entry point of the <i>wordeval</i> application: generates JSON export of the evaluator results.
27
 */
UNCOV
28
@Slf4j
×
29
@SpringBootApplication
30
@Profile("wordeval")
UNCOV
31
public class WordEvalMain implements CommandLineRunner {
×
32

33
  @Autowired
34
  private AppData appData;
35

36
  @Autowired
37
  private EvaluatorInitializer evaluatorInitializer;
38

39
  @Autowired
40
  private EvaluatorProcessor evaluatorProcessor;
41

42
  @Autowired
43
  private ExportService exportService;
44

45
  /**
46
   * Entry point method.
47
   *
48
   * @param args .
49
   */
50
  public static void main(String[] args) {
UNCOV
51
    SpringApplication app = new SpringApplication(WordEvalMain.class);
×
UNCOV
52
    app.setAdditionalProfiles("wordeval");
×
UNCOV
53
    app.run(args);
×
54
  }
×
55

56
  @Override
57
  public void run(String... args) {
58
    List<String> codes = List.of("eu", "en-us", "fr");
×
59

UNCOV
60
    for (String code : codes) {
×
UNCOV
61
      exportLanguage(code);
×
UNCOV
62
    }
×
UNCOV
63
  }
×
64

65
  /**
66
   * Exports the evaluator results for a dictionary into the /export folder.
67
   *
68
   * @param code the code of the dictionary to evaluate
69
   */
70
  public void exportLanguage(String code) {
71
    log.info("");
×
72
    log.info("Exporting language '{}'", code);
×
73
    TimeLogger timeLogger = new TimeLogger(log);
×
74

75
    Dictionary dictionary = appData.getDictionary(code);
×
76
    Language language = dictionary.getLanguage();
×
UNCOV
77
    timeLogger.lap("Looked up dictionary");
×
78

NEW
79
    EvaluatorCollection evaluators = evaluatorInitializer.createAllEvaluators(language);
×
NEW
80
    timeLogger.lap("Instantiated evaluators. Total: " + evaluators.size());
×
81

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

NEW
85
    evaluatorProcessor.processAllWords(evaluators, allWords);
×
UNCOV
86
    timeLogger.lap("Ran all words through all evaluators");
×
87

88
    Map<String, String> metaInfo = ImmutableMap.of(
×
89
        "dictionary", code,
UNCOV
90
        "language", language.getName(),
×
91
        "gen_date", String.valueOf(System.currentTimeMillis() / 1000L),
×
92
        "words", String.valueOf(allWords.size()));
×
93
    timeLogger.lap("processed dictionary");
×
94

NEW
95
    exportService.export(language, evaluators.streamThroughAllEvaluators());
×
UNCOV
96
    timeLogger.lap("finished export");
×
UNCOV
97
    timeLogger.logWithOverallTime("Finished language '" + code + "'");
×
UNCOV
98
  }
×
99
}
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