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

ljacqu / wordeval / 14558242496

20 Apr 2025 09:39AM UTC coverage: 53.745%. First build
14558242496

push

github

ljacqu
Change WordEvalMain to SpringBootApp, convert dict & lang data to constants

286 of 596 branches covered (47.99%)

124 of 134 new or added lines in 4 files covered. (92.54%)

739 of 1375 relevant lines covered (53.75%)

3.04 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.EvaluatorProcessor;
10
import ch.jalu.wordeval.language.Language;
11
import ch.jalu.wordeval.util.TimeLogger;
12
import com.google.common.collect.ImmutableMap;
13
import lombok.extern.slf4j.Slf4j;
14
import org.springframework.beans.factory.annotation.Autowired;
15
import org.springframework.boot.CommandLineRunner;
16
import org.springframework.boot.SpringApplication;
17
import org.springframework.boot.autoconfigure.SpringBootApplication;
18

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

23
/**
24
 * Entry point of the <i>wordeval</i> application: generates JSON export of the evaluator results.
25
 */
26
@Slf4j
×
27
@SpringBootApplication
NEW
28
public class WordEvalMain implements CommandLineRunner {
×
29

30
  @Autowired
31
  private AppData appData;
32

33
  /**
34
   * Entry point method.
35
   *
36
   * @param args .
37
   */
38
  public static void main(String[] args) {
NEW
39
    SpringApplication.run(WordEvalMain.class, args);
×
NEW
40
  }
×
41

42
  @Override
43
  public void run(String... args) {
44
    List<String> codes = List.of("eu", "en-us", "fr");
×
45

46
    for (String code : codes) {
×
NEW
47
      exportLanguage(code);
×
48
    }
×
49
  }
×
50

51
  /**
52
   * Exports the evaluator results for a dictionary into the /export folder.
53
   *
54
   * @param code the code of the dictionary to evaluate
55
   */
56
  public void exportLanguage(String code) {
57
    log.info("");
×
58
    log.info("Exporting language '{}'", code);
×
59
    TimeLogger timeLogger = new TimeLogger(log);
×
60

61
    Dictionary dictionary = appData.getDictionary(code);
×
62
    Language language = dictionary.getLanguage();
×
63
    timeLogger.lap("Looked up dictionary");
×
64

65
    EvaluatorInitializer initializer = new EvaluatorInitializer(language);
×
66
    timeLogger.lap("Instantiated evaluators. Total: " + initializer.getEvaluatorsCount());
×
67

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

71
    EvaluatorProcessor evaluatorProcessor = new EvaluatorProcessor(initializer);
×
72
    evaluatorProcessor.processAllWords(allWords);
×
73
    timeLogger.lap("Ran all words through all evaluators");
×
74

75
    Map<String, String> metaInfo = ImmutableMap.of(
×
76
        "dictionary", code,
77
        "language", language.getName(),
×
78
        "gen_date", String.valueOf(System.currentTimeMillis() / 1000L),
×
79
        "words", String.valueOf(allWords.size()));
×
80
    timeLogger.lap("processed dictionary");
×
81

82
    ExportService exportService = new ExportService();
×
83
    exportService.export(language, evaluatorProcessor.streamThroughAllEvaluators());
×
84
    timeLogger.lap("finished export");
×
85
    timeLogger.logWithOverallTime("Finished language '" + code + "'");
×
86
  }
×
87
}
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