summary refs log tree commit diff stats
path: root/generator/main.cpp
blob: c958421bb8c0ecef9c64e4d374b93bac3277750f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <exception>
#include <iostream>

#include "generator.h"

void printUsage() {
  std::cout << "usage: generator agid wordnet cmudict wordfreq output"
            << std::endl;
  std::cout << "agid     :: path to an AGID infl.txt file" << std::endl;
  std::cout << "wordnet  :: path to a WordNet prolog data directory"
            << std::endl;
  std::cout << "cmudict  :: path to a CMUDICT pronunciation file" << std::endl;
  std::cout << "wordfreq :: path to a word frequency CSV file" << std::endl;
  std::cout << "output   :: datafile output path" << std::endl;
}

int main(int argc, char** argv) {
  if (argc == 6) {
    try {
      generator app(argv[1], argv[2], argv[3], argv[4], argv[5]);

      try {
        app.run();
      } catch (const std::exception& e) {
        std::cout << e.what() << std::endl;
      }
    } catch (const std::exception& e) {
      std::cout << e.what() << std::endl;
      printUsage();
    }
  } else {
    std::cout << "lingo randomizer generator" << std::endl;
    printUsage();
  }
}