<commit_before>package upparse.cli;

import java.io.*;
import java.util.*;

import upparse.corpus.*;
import upparse.corpus.TagEncoder.*;
import upparse.eval.*;
import upparse.model.*;
import upparse.util.Util;

/**
 * Main class manages command-line interface to UPP
 * @author <EMAIL> (<NAME>)
 */
public class Main {

  private static enum ChunkingStrategy {
    TWOSTAGE, SOFT, UNIFORM, RANDOM, SUPERVISED_CLUMP, SUPERVISED_NPS;
  }

  private static final String CCLPARSER_EVAL_ACTION = "cclp-eval";
  private static final String CHUNK_ACTION = "chunk";
  private static final String DUMP_TEXT_ACTION = "dump-text";
  private static final Object DUMP_CLUMPS_ACTION = "dump-clumps";
  private static final Object DUMP_NPS_ACTION = "dump-nps";

  private final Alpha alpha = new Alpha();
  private OutputManager outputManager = OutputManager.nullOutputManager();
  private final EvalManager evalManager = new EvalManager(alpha);
  private String factor = "2,1,1";
  private int iter = -1;
  private double emdelta = .001;
  private String[] args = new String[0];
  private TagEncoder encoder = TagEncoder.getBIOEncoder(EncoderType.BIO,
      KeepStop.STOP, alpha);
  private String[] trainCorpusString = null;
  private CorpusType trainFileType = CorpusType.WSJ;
  private int trainSents = -1;
  private StopSegmentCorpus trainStopSegmentCorpus;
  private double smooth = 0.1;
  private SequenceModelType chunkerType = SequenceModelType.PRLG;
  private ChunkingStrategy chunkingStrategy = ChunkingStrategy.TWOSTAGE;
  private int filterTrain = -1;
  private final String action;
  private String cclparserOutput;
  private boolean doContinuousEval = false;
  private boolean noSeg = false;
  private boolean reverse = false;
  private ChunkedSegmentedCorpus trainChunkedSegmentedCorpus;
  private String outputString;
  private boolean outputPos = false;

  private Main(final String[] args) throws CommandLineError, IOException,
      EvalError, EncoderError, CorpusError {
    int i = 0;
    String arg;

    boolean outputAll = false;
    OutputType outputType = OutputType.CLUMP;
    String eval = "";
    String[] testCorpusString = new String[0];

    if (args.length < 1)
      throw new CommandLineError("Please specify an action");

    try {
      final List<String> otherArgs = new ArrayList<String>();
      encoder = TagEncoder.getBIOEncoder(EncoderType.BIO, KeepStop.STOP, alpha);
      int filterTest = -1;
      while (i < args.length) {
        arg = args[i++];

        if (arg.equals("-output")) {
          String output = args[i++];
          if (output.equals("-"))
            outputManager = OutputManager.stdoutOutputManager();
          else
            outputManager = OutputManager.fromDirname(args[i++]);
        }

        else if (arg.equals("-outputTo")) {
          outputString = args[i++];<commit_msg>bug in loading output directory<commit_after>package upparse.cli;

import java.io.*;
import java.util.*;

import upparse.corpus.*;
import upparse.corpus.TagEncoder.*;
import upparse.eval.*;
import upparse.model.*;
import upparse.util.Util;

/**
 * Main class manages command-line interface to UPP
 * @author <EMAIL> (<NAME>)
 */
public class Main {

  private static enum ChunkingStrategy {
    TWOSTAGE, SOFT, UNIFORM, RANDOM, SUPERVISED_CLUMP, SUPERVISED_NPS;
  }

  private static final String CCLPARSER_EVAL_ACTION = "cclp-eval";
  private static final String CHUNK_ACTION = "chunk";
  private static final String DUMP_TEXT_ACTION = "dump-text";
  private static final Object DUMP_CLUMPS_ACTION = "dump-clumps";
  private static final Object DUMP_NPS_ACTION = "dump-nps";

  private final Alpha alpha = new Alpha();
  private OutputManager outputManager = OutputManager.nullOutputManager();
  private final EvalManager evalManager = new EvalManager(alpha);
  private String factor = "2,1,1";
  private int iter = -1;
  private double emdelta = .001;
  private String[] args = new String[0];
  private TagEncoder encoder = TagEncoder.getBIOEncoder(EncoderType.BIO,
      KeepStop.STOP, alpha);
  private String[] trainCorpusString = null;
  private CorpusType trainFileType = CorpusType.WSJ;
  private int trainSents = -1;
  private StopSegmentCorpus trainStopSegmentCorpus;
  private double smooth = 0.1;
  private SequenceModelType chunkerType = SequenceModelType.PRLG;
  private ChunkingStrategy chunkingStrategy = ChunkingStrategy.TWOSTAGE;
  private int filterTrain = -1;
  private final String action;
  private String cclparserOutput;
  private boolean doContinuousEval = false;
  private boolean noSeg = false;
  private boolean reverse = false;
  private ChunkedSegmentedCorpus trainChunkedSegmentedCorpus;
  private String outputString;
  private boolean outputPos = false;

  private Main(final String[] args) throws CommandLineError, IOException,
      EvalError, EncoderError, CorpusError {
    int i = 0;
    String arg;

    boolean outputAll = false;
    OutputType outputType = OutputType.CLUMP;
    String eval = "";
    String[] testCorpusString = new String[0];

    if (args.length < 1)
      throw new CommandLineError("Please specify an action");

    try {
      final List<String> otherArgs = new ArrayList<String>();
      encoder = TagEncoder.getBIOEncoder(EncoderType.BIO, KeepStop.STOP, alpha);
      int filterTest = -1;
      while (i < args.length) {
        arg = args[i++];

        if (arg.equals("-output")) {
          String output = args[i++];
          if (output.equals("-"))
            outputManager = OutputManager.stdoutOutputManager();
          else
            outputManager = OutputManager.fromDirname(output);
        }

        else if (arg.equals("-outputTo")) {
          outputString = args[i++];
{'fraction_non_alphanumeric': 0.09664382358109296, 'fraction_numerical': 0.005622913371990863, 'mean_word_length': 3.77116512992456, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4980451', 'n_tokens_mistral': 1688, 'n_tokens_neox': 1627, 'n_words': 481}