// 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/ITextLevenshtainSimilarity.java
// public interface ITextLevenshtainSimilarity 
// {
// 
// 	List<ExtractTextSimilarity> Leveneshtain_Word_Document(String word1, String filePath) throws IOException;
// 	int Leveneshtain_Word_Word(String word1, String word2);
// }


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

package unsw.curation.api.extractsimilarity;





public class ExtractTextLevenshtainImpl implements ITextLevenshtainSimilarity {

	public int Leveneshtain_Word_Word(String word1, String word2)
    {
      word1 = word1.toLowerCase();
      word2 = word2.toLowerCase();
      int[] costs = new int[word2.length() + 1];
      for (int j = 0; j < costs.length; j++)
          costs[j] = j;
      for (int i = 1; i <= word1.length(); i++)
      {
          costs[0] = i;
          int nw = i - 1;
          for (int j = 1; j <= word2.length(); j++)
          {
              int cj = Math.min(1 + Math.min(costs[j], costs[j - 1]),
                      word1.charAt(i - 1) == word2.charAt(j - 1) ? nw : nw + 1);
              nw = costs[j];
              costs[j] = cj;
          }
      }
      return costs[word2.length()];
    }

// 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/ITextLevenshtainSimilarity.java
// public interface ITextLevenshtainSimilarity 
// {
// 
// 	List<ExtractTextSimilarity> Leveneshtain_Word_Document(String word1, String filePath) throws IOException;
// 	int Leveneshtain_Word_Word(String word1, String word2);
// }


// Path: src/main/java/unsw/curation/api/extractsimilarity/ExtractTextLevenshtainImpl.java
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import unsw.curation.api.domain.ExtractTextSimilarity;
import unsw.curation.api.domain.abstraction.ITextLevenshtainSimilarity;

package unsw.curation.api.extractsimilarity;





public class ExtractTextLevenshtainImpl implements ITextLevenshtainSimilarity {

	public int Leveneshtain_Word_Word(String word1, String word2)
    {
      word1 = word1.toLowerCase();
      word2 = word2.toLowerCase();
      int[] costs = new int[word2.length() + 1];
      for (int j = 0; j < costs.length; j++)
          costs[j] = j;
      for (int i = 1; i <= word1.length(); i++)
      {
          costs[0] = i;
          int nw = i - 1;
          for (int j = 1; j <= word2.length(); j++)
          {
              int cj = Math.min(1 + Math.min(costs[j], costs[j - 1]),
                      word1.charAt(i - 1) == word2.charAt(j - 1) ? nw : nw + 1);
              nw = costs[j];
              costs[j] = cj;
          }
      }
      return costs[word2.length()];
    }

   public List<ExtractTextSimilarity> Leveneshtain_Word_Document(String word1, String filePath) throws IOException
