// Path: src/main/java/unsw/curation/api/domain/ExtractTextSimilarity.java
// public class ExtractTextSimilarity {
// 
// 	private String word;
//     public void setWord(String word)
//     {
//         this.word=word;
//     }
//     public String getWord()
//     {
//         return this.word;
//     }
//     private String candidate;
//     public void setCandidate(String candidate)
//     {
//         this.candidate=candidate;
//     }
//     public String getCandidate()
//     {
//         return this.candidate;
//     }
//     private double similarity;
//     public void setSimilarity(double similarity)
//     {
//         this.similarity=similarity;
//     }
//     public double getSimilarity()
//     {
//         return this.similarity;
//     }
//     public ExtractTextSimilarity(){}
//     public ExtractTextSimilarity (String Word, String Candidate, double Similarity)
//     {
//         this.word=Word;
//         this.candidate=Candidate;
//         this.similarity=Similarity;
//     }
// }
// 
// Path: src/main/java/unsw/curation/api/domain/abstraction/ITextJaccardSimilarity.java
// public interface ITextJaccardSimilarity {
// 
// 	double Jaccard_Word_Word(String word1, String word2);
// 	List<ExtractTextSimilarity> Jaccard_Word_Document(String word, String filePath) throws IOException;
// 	double Jaccard_Document_Document(String file1,String file2) throws IOException;
// 	//List<ExtractTextSimilarity> Jaccard_Document_DocumentS(File filePath, String directoryPath) throws IOException;
// 	
// }


import java.io.BufferedReader;
import java.io.File;
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.HashSet;
import java.util.List;
import java.util.stream.Collectors;
import unsw.curation.api.domain.ExtractTextSimilarity;
import unsw.curation.api.domain.abstraction.ITextJaccardSimilarity;

package unsw.curation.api.extractsimilarity;





public class ExtractTextJaccardSimilarityImpl implements ITextJaccardSimilarity
{
	@Override
	public double Jaccard_Word_Word(String word1, String word2)
    {
        String [] arrWord1=word1.toLowerCase().split("");
        String [] arrWord2=word2.toLowerCase().split("");
        HashSet<String> lstUnion=new HashSet<>();
        lstUnion.addAll(Arrays.asList(arrWord1));
        lstUnion.addAll(Arrays.asList(arrWord2));
        HashSet<String> lstIntersect=new HashSet<>();
        lstIntersect.addAll(Arrays.asList(arrWord1));
        lstIntersect.retainAll(Arrays.asList(arrWord2));
        double lstUnoinSize=(double)lstUnion.size();
        double lstIntersectSize=(double)lstIntersect.size();
        double JaccardSimilarity=lstIntersectSize/lstUnoinSize;
        return JaccardSimilarity;
    }
	@Override

// Path: src/main/java/unsw/curation/api/domain/ExtractTextSimilarity.java
// public class ExtractTextSimilarity {
// 
// 	private String word;
//     public void setWord(String word)
//     {
//         this.word=word;
//     }
//     public String getWord()
//     {
//         return this.word;
//     }
//     private String candidate;
//     public void setCandidate(String candidate)
//     {
//         this.candidate=candidate;
//     }
//     public String getCandidate()
//     {
//         return this.candidate;
//     }
//     private double similarity;
//     public void setSimilarity(double similarity)
//     {
//         this.similarity=similarity;
//     }
//     public double getSimilarity()
//     {
//         return this.similarity;
//     }
//     public ExtractTextSimilarity(){}
//     public ExtractTextSimilarity (String Word, String Candidate, double Similarity)
//     {
//         this.word=Word;
//         this.candidate=Candidate;
//         this.similarity=Similarity;
//     }
// }
// 
// Path: src/main/java/unsw/curation/api/domain/abstraction/ITextJaccardSimilarity.java
// public interface ITextJaccardSimilarity {
// 
// 	double Jaccard_Word_Word(String word1, String word2);
// 	List<ExtractTextSimilarity> Jaccard_Word_Document(String word, String filePath) throws IOException;
// 	double Jaccard_Document_Document(String file1,String file2) throws IOException;
// 	//List<ExtractTextSimilarity> Jaccard_Document_DocumentS(File filePath, String directoryPath) throws IOException;
// 	
// }


// Path: src/main/java/unsw/curation/api/extractsimilarity/ExtractTextJaccardSimilarityImpl.java
import java.io.BufferedReader;
import java.io.File;
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.HashSet;
import java.util.List;
import java.util.stream.Collectors;
import unsw.curation.api.domain.ExtractTextSimilarity;
import unsw.curation.api.domain.abstraction.ITextJaccardSimilarity;

package unsw.curation.api.extractsimilarity;





public class ExtractTextJaccardSimilarityImpl implements ITextJaccardSimilarity
{
	@Override
	public double Jaccard_Word_Word(String word1, String word2)
    {
        String [] arrWord1=word1.toLowerCase().split("");
        String [] arrWord2=word2.toLowerCase().split("");
        HashSet<String> lstUnion=new HashSet<>();
        lstUnion.addAll(Arrays.asList(arrWord1));
        lstUnion.addAll(Arrays.asList(arrWord2));
        HashSet<String> lstIntersect=new HashSet<>();
        lstIntersect.addAll(Arrays.asList(arrWord1));
        lstIntersect.retainAll(Arrays.asList(arrWord2));
        double lstUnoinSize=(double)lstUnion.size();
        double lstIntersectSize=(double)lstIntersect.size();
        double JaccardSimilarity=lstIntersectSize/lstUnoinSize;
        return JaccardSimilarity;
    }
	@Override

    public List<ExtractTextSimilarity> Jaccard_Word_Document(String word, String filePath) throws IOException
