// Path: src/main/java/io/aif/language/token/comparator/ITokenComparator.java
// public interface ITokenComparator {
// 
//   public static ITokenComparator createComposite(final Map<ITokenComparator, Double> comparators) {
//     return new CompositeTokenComparator(comparators);
//   }
// 
//   public static ITokenComparator defaultComparator() {
//     return Type.CHARACTER_DENSITY_COMPARATOR.getInstance();
//   }
// 
//   public Double compare(String left, String right);
// 
//   public static enum Type {
//     SIMPLE_TOKEN_COMPARATOR(new SimpleTokenComparator()),
//     RECURSIVE_SUBSTRING_COMPARATOR(new RecursiveSubstringComparator()),
//     CHARACTER_DENSITY_COMPARATOR(new CharacterDensityTokenComparator()),
//     LEVENSHTEIN_COMPARATOR(new LevenshteinDistanceComparator());
// 
//     private final ITokenComparator instance;
// 
//     private Type(final ITokenComparator instance) {
//       this.instance = instance;
//     }
// 
//     public ITokenComparator getInstance() {
//       return instance;
//     }
//   }
// }


import java.util.Collection;
import io.aif.language.token.comparator.ITokenComparator;
package io.aif.language.word.comparator;



class OptimisedMeshComparator implements IGroupComparator {

  private static final double MAX_AVERAGE_LENGTH_DISTANCE = .5;

  private final IGroupComparator meshComparator;

// Path: src/main/java/io/aif/language/token/comparator/ITokenComparator.java
// public interface ITokenComparator {
// 
//   public static ITokenComparator createComposite(final Map<ITokenComparator, Double> comparators) {
//     return new CompositeTokenComparator(comparators);
//   }
// 
//   public static ITokenComparator defaultComparator() {
//     return Type.CHARACTER_DENSITY_COMPARATOR.getInstance();
//   }
// 
//   public Double compare(String left, String right);
// 
//   public static enum Type {
//     SIMPLE_TOKEN_COMPARATOR(new SimpleTokenComparator()),
//     RECURSIVE_SUBSTRING_COMPARATOR(new RecursiveSubstringComparator()),
//     CHARACTER_DENSITY_COMPARATOR(new CharacterDensityTokenComparator()),
//     LEVENSHTEIN_COMPARATOR(new LevenshteinDistanceComparator());
// 
//     private final ITokenComparator instance;
// 
//     private Type(final ITokenComparator instance) {
//       this.instance = instance;
//     }
// 
//     public ITokenComparator getInstance() {
//       return instance;
//     }
//   }
// }


// Path: src/main/java/io/aif/language/word/comparator/OptimisedMeshComparator.java
import java.util.Collection;
import io.aif.language.token.comparator.ITokenComparator;

package io.aif.language.word.comparator;



class OptimisedMeshComparator implements IGroupComparator {

  private static final double MAX_AVERAGE_LENGTH_DISTANCE = .5;

  private final IGroupComparator meshComparator;

  OptimisedMeshComparator(final ITokenComparator tokenComparator) {