<commit_before>/**
   Copyright (c) 2009, the SemanticVectors AUTHORS.

   All rights reserved.

   Redistribution and use in source and binary forms, with or without
   modification, are permitted provided that the following conditions are
   met:

 * Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.

 * Redistributions in binary form must reproduce the above
   copyright notice, this list of conditions and the following
   disclaimer in the documentation and/or other materials provided
   with the distribution.

 * Neither the name of the University of Pittsburgh nor the names
   of its contributors may be used to endorse or promote products
   derived from this software without specific prior written
   permission.

   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 **/

package pitt.search.semanticvectors;

import java.lang.IllegalArgumentException;
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.logging.Logger;

/**
 * Class for representing and parsing global command line flags.
 *
 * All command line flags for the SemanticVectors package should be defined here.
 * This design is a violation of encapsulation, but since these are things that
 * the user can break, we believe that we'll create a much cleaner package if we
 * put this power into user's hands explicitly, but at least insist that all command
 * line flags are declared in one place - in the Flags class. Needless to say, the
 * Flags class only looks after the basic syntax of (name, value) command line flags.
 * All semantics (i.e., in this case, behaviour affected by the flags) is up to the
 * developer to implement.
 *
 * @author <NAME>
 */
public class Flags {
  private static final Logger logger = Logger.getLogger(Flags.class.getCanonicalName());

  // Add new command line flags here. By convention, please use lower case.
  //
  // DO NOT DUPLICATE NAMES HERE! YOU WILL OVERWRITE OTHER PEOPLE's FLAGS!
  public static int dimension = 200;
  public static final String dimensionDescription = "Dimension of semantic vector space";

  public static String vectortype = "real";
  public static final String vectortypeDescription = "Ground field for vectors: real, binary or complex.";
  public static final String[] vectortypeValues = {"binary", "real", "complex"};

  public static int seedlength = 10;
  public static final String seedlengthDescription =
    "Number of +1 and number of -1 entries in a sparse random vector";

  public static int binaryvectordecimalplaces = 2;
  public static final String binaryvectordecimalplacesDescription =
    "Number of decimal places to consider in weighted superpositions of binary vectors. Higher precision requires additional memory during training.";
  
  
  public static int minfrequency;
  public static int maxfrequency = Integer.MAX_VALUE;
  public static int maxnonalphabetchars;

  public static String indexRootDirectory = "";
  public static final String indexRootDirectoryDescription = "Allow for the specification of a directory to place the lucene index in. Requires a trailing slash";
  
  public static int numsearchresults = 20;
  public static double searchresultsminscore = -1.0;
  public static final String searchresultsminscoreDescription = "Search results with similarity scores below "
    + "this value will not be included in search results.";

  public static int numclusters = 5;

  public static int trainingcycles;
  public static int windowradius = 5;

  public static String searchtype = "sum";
  public static final String searchtypeDescription = "Method used for combining and searching vectors.";
  public static final String[] searchtypeValues =
    {"sum", "sparsesum", "subspace", "maxsim", "balanced_permutation", "permutation",
     "boundproduct", "boundproductsubspace", "analogy", "printquery"};

  public static boolean fieldweight = false;
  public static final String fieldweightDescription =
	  "Set to true if you want document vectors built from multiple fields to emphasize terms from shorter fields";
  
  public static String termweight = "none";
  public static final String termweightDescription = "Term weighting used when constructing document vectors.";
  public static final String[] termweightValues = {"logentropy","idf", "none"};

  public static boolean porterstemmer = false;
  public static final String porterstemmerDescription =
    "Set to true when using IndexFilePositions if you would like to stem terms";

  public static boolean usetermweightsinsearch = false;
  public static final String usetermweightsinsearchDescription =
    "Set to true only if you want to scale each comparison score by a term weight during search.";

  public static boolean stdev = false;
  public static final String stdevDescription =
    "Set to true when you would prefer results scored as SD above the mean across all search vectors";

  public static boolean expandsearchspace = false;
  public static final String expandsearchspaceDescription =
	  "Set to true to generated bound products from each pairwise element of the search space. "+
	  "Expands the size of the space to n-squared";
  
  public static String indexfileformat = "lucene";
  public static final String indexfileformatDescription =
    "Format used for serializing / deserializing vectors from disk";
  public static final String[] indexfileformatValues = {"lucene", "text"};

  public static String termvectorsfile = "termvectors";
  public static String docvectorsfile = "docvectors";
  public static String termtermvectorsfile = "termtermvectors";
  
  public static String queryvectorfile = "termvectors";
  public static String queryvectorfileDescription = "Principal vector store for finding query vectors.";

  public static String searchvectorfile = "";
  public static String searchvectorfileDescription =
      "Vector store for searching. Defaults to being the same as {@link #queryVecReader}. "
      + "May be different from queryvectorfile e.g., when using terms to search for documents.";
  
  public static String boundvectorfile = "";
  public static String boundvectorfileDescription =
      "Auxiliary vector store used when searching for boundproducts. Used only in some searchtypes.";

  public static boolean binarybindingwithpermute = false;
  
  public static final String elementalvectorfile = "elementalvectors";
  public static String elementalvectorfileDescription =
      "Random elemental vectors, sometimes written out, and used (e.g.) in conjunction with permuted vector file.";
  
  public static final String semanticvectorfile = "semanticvectors";
  public static String semanticvectorfileDescription = "Semantic vectors; used so far as a name in PSI.";

  public static final String predicatevectorfile = "predicatevectors";
  public static String predicatevectorfileDescription = "Vectors used to represent predicates in PSI.";
  
  public static String permutedvectorfile = "permtermvectors";
  public static String permutedvectorfileDescription =
      "Permuted term vectors, output by -positionalmethod permutation.";
  
  public static String directionalvectorfile ="drxntermvectors";
  public static String directionalvectorfileDescription =<commit_msg>Liberated elementalvectorfile, boundvectorfile and predicatevectorfile. These were previously designated as "Final". <commit_after>/**
   Copyright (c) 2009, the SemanticVectors AUTHORS.

   All rights reserved.

   Redistribution and use in source and binary forms, with or without
   modification, are permitted provided that the following conditions are
   met:

 * Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.

 * Redistributions in binary form must reproduce the above
   copyright notice, this list of conditions and the following
   disclaimer in the documentation and/or other materials provided
   with the distribution.

 * Neither the name of the University of Pittsburgh nor the names
   of its contributors may be used to endorse or promote products
   derived from this software without specific prior written
   permission.

   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 **/

package pitt.search.semanticvectors;

import java.lang.IllegalArgumentException;
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.logging.Logger;

/**
 * Class for representing and parsing global command line flags.
 *
 * All command line flags for the SemanticVectors package should be defined here.
 * This design is a violation of encapsulation, but since these are things that
 * the user can break, we believe that we'll create a much cleaner package if we
 * put this power into user's hands explicitly, but at least insist that all command
 * line flags are declared in one place - in the Flags class. Needless to say, the
 * Flags class only looks after the basic syntax of (name, value) command line flags.
 * All semantics (i.e., in this case, behaviour affected by the flags) is up to the
 * developer to implement.
 *
 * @author <NAME>
 */
public class Flags {
  private static final Logger logger = Logger.getLogger(Flags.class.getCanonicalName());

  // Add new command line flags here. By convention, please use lower case.
  //
  // DO NOT DUPLICATE NAMES HERE! YOU WILL OVERWRITE OTHER PEOPLE's FLAGS!
  public static int dimension = 200;
  public static final String dimensionDescription = "Dimension of semantic vector space";

  public static String vectortype = "real";
  public static final String vectortypeDescription = "Ground field for vectors: real, binary or complex.";
  public static final String[] vectortypeValues = {"binary", "real", "complex"};

  public static int seedlength = 10;
  public static final String seedlengthDescription =
    "Number of +1 and number of -1 entries in a sparse random vector";

  public static int binaryvectordecimalplaces = 2;
  public static final String binaryvectordecimalplacesDescription =
    "Number of decimal places to consider in weighted superpositions of binary vectors. Higher precision requires additional memory during training.";
  
  
  public static int minfrequency;
  public static int maxfrequency = Integer.MAX_VALUE;
  public static int maxnonalphabetchars;

  public static String indexRootDirectory = "";
  public static final String indexRootDirectoryDescription = "Allow for the specification of a directory to place the lucene index in. Requires a trailing slash";
  
  public static int numsearchresults = 20;
  public static double searchresultsminscore = -1.0;
  public static final String searchresultsminscoreDescription = "Search results with similarity scores below "
    + "this value will not be included in search results.";

  public static int numclusters = 5;

  public static int trainingcycles;
  public static int windowradius = 5;

  public static String searchtype = "sum";
  public static final String searchtypeDescription = "Method used for combining and searching vectors.";
  public static final String[] searchtypeValues =
    {"sum", "sparsesum", "subspace", "maxsim", "balanced_permutation", "permutation",
     "boundproduct", "boundproductsubspace", "analogy", "printquery"};

  public static boolean fieldweight = false;
  public static final String fieldweightDescription =
	  "Set to true if you want document vectors built from multiple fields to emphasize terms from shorter fields";
  
  public static String termweight = "none";
  public static final String termweightDescription = "Term weighting used when constructing document vectors.";
  public static final String[] termweightValues = {"logentropy","idf", "none"};

  public static boolean porterstemmer = false;
  public static final String porterstemmerDescription =
    "Set to true when using IndexFilePositions if you would like to stem terms";

  public static boolean usetermweightsinsearch = false;
  public static final String usetermweightsinsearchDescription =
    "Set to true only if you want to scale each comparison score by a term weight during search.";

  public static boolean stdev = false;
  public static final String stdevDescription =
    "Set to true when you would prefer results scored as SD above the mean across all search vectors";

  public static boolean expandsearchspace = false;
  public static final String expandsearchspaceDescription =
	  "Set to true to generated bound products from each pairwise element of the search space. "+
	  "Expands the size of the space to n-squared";
  
  public static String indexfileformat = "lucene";
  public static final String indexfileformatDescription =
    "Format used for serializing / deserializing vectors from disk";
  public static final String[] indexfileformatValues = {"lucene", "text"};

  public static String termvectorsfile = "termvectors";
  public static String docvectorsfile = "docvectors";
  public static String termtermvectorsfile = "termtermvectors";
  
  public static String queryvectorfile = "termvectors";
  public static String queryvectorfileDescription = "Principal vector store for finding query vectors.";

  public static String searchvectorfile = "";
  public static String searchvectorfileDescription =
      "Vector store for searching. Defaults to being the same as {@link #queryVecReader}. "
      + "May be different from queryvectorfile e.g., when using terms to search for documents.";
  
  public static String boundvectorfile = "";
  public static String boundvectorfileDescription =
      "Auxiliary vector store used when searching for boundproducts. Used only in some searchtypes.";

  public static boolean binarybindingwithpermute = false;
  
  public static String elementalvectorfile = "elementalvectors";
  public static String elementalvectorfileDescription =
      "Random elemental vectors, sometimes written out, and used (e.g.) in conjunction with permuted vector file.";
  
  public static String semanticvectorfile = "semanticvectors";
  public static String semanticvectorfileDescription = "Semantic vectors; used so far as a name in PSI.";

  public static String predicatevectorfile = "predicatevectors";
  public static String predicatevectorfileDescription = "Vectors used to represent predicates in PSI.";
  
  public static String permutedvectorfile = "permtermvectors";
  public static String permutedvectorfileDescription =
      "Permuted term vectors, output by -positionalmethod permutation.";
  
  public static String directionalvectorfile ="drxntermvectors";
  public static String directionalvectorfileDescription =
{'fraction_non_alphanumeric': 0.054858349900596425, 'fraction_numerical': 0.0022365805168986083, 'mean_word_length': 4.495732331853875, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1875806', 'n_tokens_mistral': 4014, 'n_tokens_neox': 3715, 'n_words': 1912}