<commit_before>/**
   Copyright (c) 2013, 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.infer;

import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;

import pitt.search.semanticvectors.FlagConfig;
import pitt.search.semanticvectors.ObjectVector;
import pitt.search.semanticvectors.VectorStoreRAM;
import pitt.search.semanticvectors.hashing.Bobcat;
import pitt.search.semanticvectors.vectors.ComplexVector;
import pitt.search.semanticvectors.vectors.ComplexVector.Mode;
import pitt.search.semanticvectors.vectors.Vector;
import pitt.search.semanticvectors.vectors.VectorFactory;

public class NumberRepresentation
{
    ArrayList<ObjectVector> _numbers = new ArrayList<ObjectVector>();
    Hashtable<String,VectorStoreRAM> _pregenerated = new Hashtable<String, VectorStoreRAM>();
   FlagConfig flagConfig = null;
   int _iDimension = 1000;
   String startString, endString;
   java.util.Random random;
   Vector vL, vR;
   
    /**
     * @param args
     */
    public static void main(String[] args)
    {
    	  
    	FlagConfig flagConfig;
    	
        try {
          flagConfig = FlagConfig.getFlagConfig(args);
          args = flagConfig.remainingArgs;
        } catch (IllegalArgumentException e) {
          System.err.println(e.getMessage());
          throw e;
        }
    	
NumberRepresentation NR = new NumberRepresentation(flagConfig);
VectorStoreRAM VSR = NR.getNumberVectors(1,6);
Enumeration<ObjectVector> VEN = VSR.getAllVectors();
while (VEN.hasMoreElements())
	System.out.println(VEN.nextElement().getObject());

    }
    
    /**
     * @param iStart
     * @param iEnd
     */
    public NumberRepresentation(FlagConfig flagConfig) {

      this.flagConfig = flagConfig;
      if (flagConfig.vectortype().equals("complex"))
        ComplexVector.setDominantMode(Mode.CARTESIAN);
      this._iDimension = flagConfig.dimension();
      
         random = new java.util.Random();
          
          // generate a vector for the lowest number and one for the highest and make sure they have no overlap
          startString = "*START*";
          random.setSeed(Bobcat.asLong(startString));
          vL = VectorFactory.generateRandomVector(flagConfig.vectortype(), _iDimension, flagConfig.seedlength(), random );
          
          endString = "*END*";
          random.setSeed(Bobcat.asLong(endString));
          vR = VectorFactory.generateRandomVector(flagConfig.vectortype(), _iDimension, flagConfig.seedlength(), random );
          

          
          while ( Math.abs(vL.measureOverlap( vR )) > 0.01d )<commit_msg>Running the main class now outputs an nxn matrix of similarities.<commit_after>/**
   Copyright (c) 2013, 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.infer;

import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;

import pitt.search.semanticvectors.FlagConfig;
import pitt.search.semanticvectors.ObjectVector;
import pitt.search.semanticvectors.VectorStoreRAM;
import pitt.search.semanticvectors.hashing.Bobcat;
import pitt.search.semanticvectors.vectors.ComplexVector;
import pitt.search.semanticvectors.vectors.ComplexVector.Mode;
import pitt.search.semanticvectors.vectors.Vector;
import pitt.search.semanticvectors.vectors.VectorFactory;

public class NumberRepresentation
{
    ArrayList<ObjectVector> _numbers = new ArrayList<ObjectVector>();
    Hashtable<String,VectorStoreRAM> _pregenerated = new Hashtable<String, VectorStoreRAM>();
   FlagConfig flagConfig = null;
   int _iDimension = 1000;
   String startString, endString;
   java.util.Random random;
   Vector vL, vR;
   
    /**
     * @param args
     */
    public static void main(String[] args)
    {
    	  
    	FlagConfig flagConfig;
    	
        try {
          flagConfig = FlagConfig.getFlagConfig(args);
          args = flagConfig.remainingArgs;
        } catch (IllegalArgumentException e) {
          System.err.println(e.getMessage());
          throw e;
        }
    	
NumberRepresentation NR = new NumberRepresentation(flagConfig);
VectorStoreRAM VSR = NR.getNumberVectors(1,4);
System.out.print("\t");
for (int q=1; q <= VSR.getNumVectors(); q++)
System.out.print(q+"\t");
System.out.println();	

for (int q=1; q <= VSR.getNumVectors(); q++)
{Enumeration<ObjectVector> VEN = VSR.getAllVectors();
	System.out.print(q);

	while (VEN.hasMoreElements())
{	
	ObjectVector OV = VEN.nextElement();

	
	System.out.print("\t");
	System.out.printf("%.2f",VSR.getVector(VSR.getNumVectors() +1 - q).measureOverlap(OV.getVector()));
}
	System.out.println();
	
    }
    }
    /**
     * @param iStart
     * @param iEnd
     */
    public NumberRepresentation(FlagConfig flagConfig) {

      this.flagConfig = flagConfig;
      if (flagConfig.vectortype().equals("complex"))
        ComplexVector.setDominantMode(Mode.CARTESIAN);
      this._iDimension = flagConfig.dimension();
      
         random = new java.util.Random();
          
          // generate a vector for the lowest number and one for the highest and make sure they have no overlap
          startString = "*START*";
          random.setSeed(Bobcat.asLong(startString));
          vL = VectorFactory.generateRandomVector(flagConfig.vectortype(), _iDimension, flagConfig.seedlength(), random );
          vL.normalize();
          
          endString = "*END*";
          random.setSeed(Bobcat.asLong(endString));
          vR = VectorFactory.generateRandomVector(flagConfig.vectortype(), _iDimension, flagConfig.seedlength(), random );
          vR.normalize();

          
          while ( Math.abs(vL.measureOverlap( vR )) > 0.01d )
{'fraction_non_alphanumeric': 0.08248015644771656, 'fraction_numerical': 0.0034510525710341653, 'mean_word_length': 3.5163636363636366, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '5106613', 'n_tokens_mistral': 2521, 'n_tokens_neox': 2348, 'n_words': 761}