// Path: src/main/java/unsw/curation/api/domain/ExtractNumberSimilarity.java
// public class ExtractNumberSimilarity {
// 
// 	private String vector1;
// 	private String vector2;
// 	private double score;
// 	
// 	public ExtractNumberSimilarity(){}
// 	
// 	public ExtractNumberSimilarity(String vector1,String vector2,double score)
// 	{
// 		this.vector1=vector1;
// 		this.vector2=vector2;
// 		this.score=score;
// 	}
// 	
// 	public void setVector1(String vector1)
// 	{
// 		this.vector1=vector1;
// 	}
// 	public String getVector1()
// 	{
// 		return this.vector1;
// 	}
// 	
// 	public void setVecor2(String vector2)
// 	{
// 		this.vector2=vector2;
// 	}
// 	public String getVector2()
// 	{
// 		return this.vector2;
// 	}
// 	public void setScore(double score)
// 	{
// 		this.score=score;
// 	}
// 	public double getScore()
// 	{
// 		return this.score;
// 	}
// }
// 
// Path: src/main/java/unsw/curation/api/domain/abstraction/INumberCosineSimilarity.java
// public interface INumberCosineSimilarity {
// 
// 	double Cosine_Vector_Vector(double [] number1,double [] number2);
// 	List<ExtractNumberSimilarity> Cosine_Vector_VectorS(String filePath) throws IOException;
// 	List<ExtractNumberSimilarity> Cosine_Vector_VectorS(double [] vector,String filePath) throws IOException;
// 	
// }


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import unsw.curation.api.domain.ExtractNumberSimilarity;
import unsw.curation.api.domain.abstraction.INumberCosineSimilarity;

package unsw.curation.api.extractsimilarity;






public class ExtractNumberCosineSimilarityImpl implements INumberCosineSimilarity
{
	@Override
	public double Cosine_Vector_Vector(double [] vector1, double [] vector2)
    {
        double dotProduct=0.0;
        double vector1Len=0.0;
        double vector2Len=0.0;
        for(int i=0;i<vector1.length;i++)
        {
           dotProduct+=vector1[i]*vector2[i];
           vector1Len+=Math.pow(vector1[i],2);
           vector2Len+=Math.pow(vector2[i],2);       
        }
        return 1-(dotProduct/ (Math.sqrt(vector1Len)* Math.sqrt(vector2Len)));
    }
    @Override
    //dar meghdar bazgashti dobareh check kon

// Path: src/main/java/unsw/curation/api/domain/ExtractNumberSimilarity.java
// public class ExtractNumberSimilarity {
// 
// 	private String vector1;
// 	private String vector2;
// 	private double score;
// 	
// 	public ExtractNumberSimilarity(){}
// 	
// 	public ExtractNumberSimilarity(String vector1,String vector2,double score)
// 	{
// 		this.vector1=vector1;
// 		this.vector2=vector2;
// 		this.score=score;
// 	}
// 	
// 	public void setVector1(String vector1)
// 	{
// 		this.vector1=vector1;
// 	}
// 	public String getVector1()
// 	{
// 		return this.vector1;
// 	}
// 	
// 	public void setVecor2(String vector2)
// 	{
// 		this.vector2=vector2;
// 	}
// 	public String getVector2()
// 	{
// 		return this.vector2;
// 	}
// 	public void setScore(double score)
// 	{
// 		this.score=score;
// 	}
// 	public double getScore()
// 	{
// 		return this.score;
// 	}
// }
// 
// Path: src/main/java/unsw/curation/api/domain/abstraction/INumberCosineSimilarity.java
// public interface INumberCosineSimilarity {
// 
// 	double Cosine_Vector_Vector(double [] number1,double [] number2);
// 	List<ExtractNumberSimilarity> Cosine_Vector_VectorS(String filePath) throws IOException;
// 	List<ExtractNumberSimilarity> Cosine_Vector_VectorS(double [] vector,String filePath) throws IOException;
// 	
// }


// Path: src/main/java/unsw/curation/api/extractsimilarity/ExtractNumberCosineSimilarityImpl.java
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import unsw.curation.api.domain.ExtractNumberSimilarity;
import unsw.curation.api.domain.abstraction.INumberCosineSimilarity;

package unsw.curation.api.extractsimilarity;






public class ExtractNumberCosineSimilarityImpl implements INumberCosineSimilarity
{
	@Override
	public double Cosine_Vector_Vector(double [] vector1, double [] vector2)
    {
        double dotProduct=0.0;
        double vector1Len=0.0;
        double vector2Len=0.0;
        for(int i=0;i<vector1.length;i++)
        {
           dotProduct+=vector1[i]*vector2[i];
           vector1Len+=Math.pow(vector1[i],2);
           vector2Len+=Math.pow(vector2[i],2);       
        }
        return 1-(dotProduct/ (Math.sqrt(vector1Len)* Math.sqrt(vector2Len)));
    }
    @Override
    //dar meghdar bazgashti dobareh check kon

    public List<ExtractNumberSimilarity> Cosine_Vector_VectorS(double [] vector1, String fileName) throws IOException
