package com.formulasearchengine.mathosphere.mlp.cli;


import com.beust.jcommander.Parameter;

import java.io.Serializable;

public class BaseConfig implements Serializable {
  private static final String DEFAULT_POS_MODEL =
      "edu/stanford/nlp/models/pos-tagger/english-left3words/english-left3words-distsim.tagger";
  @Parameter(names = {"-pos", "--posModel"}, description = "POS model to use")
  private String model = DEFAULT_POS_MODEL;

  @Parameter(names = {"-l", "--language"}, description = "Language of the input")
  private String language = "en";

  @Parameter(names = {"-a", "--alpha"})
  private double alpha = 1.0;

  @Parameter(names = {"-b", "--beta"})
  private double beta = 1.0;

  @Parameter(names = {"-g", "--gamma"})
  private double gamma = 0.1;

  @Parameter(names = {"-t", "--threshold"})
  private double threshold = 0.4;

  @Parameter(names = {"-w", "--wikiDataList"})
  private String wikiDataFile = null;

  @Parameter(names = {"--tex"})
  private boolean useTeXIdentifiers = false;

  @Parameter(names = {"--texvcinfo"})
  private String texvcinfoUrl = "http://api.formulasearchengine.com/v1/media/math/check/tex";
  public BaseConfig() {
  }

  public BaseConfig(String model, String language, double alpha, double beta, double gamma,
                    double threshold, boolean useTeXIdentifiers) {
    this.model = model;
    this.language = language;
    this.alpha = alpha;
    this.beta = beta;
    this.gamma = gamma;
    this.threshold = threshold;
    this.useTeXIdentifiers = useTeXIdentifiers;
  }

  public String getModel() {
    return model;
  }

  public double getAlpha() {
    return alpha;
  }

  public double getBeta() {
    return beta;
  }

  public double getGamma() {
    return gamma;
  }

  public double getThreshold() {
    return threshold;
  }

  public String getLanguage() {
    return language;
  }

  public boolean getUseTeXIdentifiers() {
    return useTeXIdentifiers;
  }

  public void setUseTeXIdentifiers(boolean useTeXIdentifiers) {
    this.useTeXIdentifiers = useTeXIdentifiers;
  }

  public String getWikiDataFile() {
    return wikiDataFile;
  }

  public BaseConfig setWikiDataFile(String wikiDataFile) {
    this.wikiDataFile = wikiDataFile;
    return this;
  }

  public String getTexvcinfoUrl() {
    return texvcinfoUrl;
  }

  public void setModel(String model) {
    this.model = model;
  }
}

@@ -103,28 +103,113 @@
 java.io.
-Serializable
+IOException;%0Aimport java.io.InputStream;%0Aimport java.io.Serializable;%0Aimport java.util.Properties
 ;%0A%0Apubli
@@ -1227,16 +1227,17 @@
 k/tex%22;%0A
+%0A
   public
@@ -1252,16 +1252,501 @@
 fig() %7B%0A
+    Properties prop = new Properties();%0A    String propFileName = %22mathosphere.properties%22;%0A%0A    InputStream inputStream = getClass().getClassLoader().getResourceAsStream(propFileName);%0A%0A    if (inputStream != null) %7B%0A      try %7B%0A        prop.load(inputStream);%0A        final String texvcinfo = prop.getProperty(%22texvcinfo%22);%0A        if (texvcinfo.length() %3E 0) %7B%0A          texvcinfoUrl = texvcinfo;%0A        %7D%0A      %7D catch (IOException e) %7B%0A        e.printStackTrace();%0A      %7D%0A    %7D%0A
   %7D%0A%0A  p

Allow for offline testing