@Test public void matches(){ List<String> leftTokens = Arrays.asList("A", "B", "C"); List<String> rightTokens = Arrays.asList("a", "b", "c"); assertFalse(TextUtil.matches(leftTokens, rightTokens, true, 0)); assertTrue(TextUtil.matches(leftTokens, rightTokens, false, 0)); rightTokens = Arrays.asList("A", "X", "C"); assertFalse(TextUtil.matches(leftTokens, rightTokens, true, 0)); assertTrue(TextUtil.matches(leftTokens, rightTokens, true, 1)); rightTokens = Arrays.asList("A", "XX", "C"); assertFalse(TextUtil.matches(leftTokens, rightTokens, true, 1)); assertTrue(TextUtil.matches(leftTokens, rightTokens, true, 2)); rightTokens = Arrays.asList("a", "x", "c"); assertFalse(TextUtil.matches(leftTokens, rightTokens, true, 0)); assertFalse(TextUtil.matches(leftTokens, rightTokens, true, 2)); assertTrue(TextUtil.matches(leftTokens, rightTokens, true, 3)); assertFalse(TextUtil.matches(leftTokens, rightTokens, false, 0)); assertTrue(TextUtil.matches(leftTokens, rightTokens, false, 1)); rightTokens = Arrays.asList("a", "xx", "c"); assertFalse(TextUtil.matches(leftTokens, rightTokens, true, 3)); assertTrue(TextUtil.matches(leftTokens, rightTokens, true, 4)); assertFalse(TextUtil.matches(leftTokens, rightTokens, false, 1)); assertTrue(TextUtil.matches(leftTokens, rightTokens, false, 2)); }
static public boolean matches(TextIndex textIndex, List<String> leftTokens, List<String> rightTokens){ boolean caseSensitive = textIndex.isCaseSensitive(); int maxLevenshteinDistance = textIndex.getMaxLevenshteinDistance(); if(maxLevenshteinDistance < 0){ throw new InvalidAttributeException(textIndex, PMMLAttributes.TEXTINDEX_MAXLEVENSHTEINDISTANCE, maxLevenshteinDistance); } return matches(leftTokens, rightTokens, caseSensitive, maxLevenshteinDistance); }
TextUtil { static public boolean matches(TextIndex textIndex, List<String> leftTokens, List<String> rightTokens){ boolean caseSensitive = textIndex.isCaseSensitive(); int maxLevenshteinDistance = textIndex.getMaxLevenshteinDistance(); if(maxLevenshteinDistance < 0){ throw new InvalidAttributeException(textIndex, PMMLAttributes.TEXTINDEX_MAXLEVENSHTEINDISTANCE, maxLevenshteinDistance); } return matches(leftTokens, rightTokens, caseSensitive, maxLevenshteinDistance); } }
TextUtil { static public boolean matches(TextIndex textIndex, List<String> leftTokens, List<String> rightTokens){ boolean caseSensitive = textIndex.isCaseSensitive(); int maxLevenshteinDistance = textIndex.getMaxLevenshteinDistance(); if(maxLevenshteinDistance < 0){ throw new InvalidAttributeException(textIndex, PMMLAttributes.TEXTINDEX_MAXLEVENSHTEINDISTANCE, maxLevenshteinDistance); } return matches(leftTokens, rightTokens, caseSensitive, maxLevenshteinDistance); } private  TextUtil(); }
TextUtil { static public boolean matches(TextIndex textIndex, List<String> leftTokens, List<String> rightTokens){ boolean caseSensitive = textIndex.isCaseSensitive(); int maxLevenshteinDistance = textIndex.getMaxLevenshteinDistance(); if(maxLevenshteinDistance < 0){ throw new InvalidAttributeException(textIndex, PMMLAttributes.TEXTINDEX_MAXLEVENSHTEINDISTANCE, maxLevenshteinDistance); } return matches(leftTokens, rightTokens, caseSensitive, maxLevenshteinDistance); } private  TextUtil(); static String normalize(TextIndex textIndex, String string); static String normalize(TextIndex textIndex, TextIndexNormalization textIndexNormalization, String string); static List<String> tokenize(TextIndex textIndex, String text); static int termFrequency(TextIndex textIndex, List<String> textTokens, List<String> termTokens); static Map<List<String>, Integer> termFrequencyTable(TextIndex textIndex, List<String> textTokens, Set<List<String>> termTokenSet, int maxLength); static boolean matches(TextIndex textIndex, List<String> leftTokens, List<String> rightTokens); }
TextUtil { static public boolean matches(TextIndex textIndex, List<String> leftTokens, List<String> rightTokens){ boolean caseSensitive = textIndex.isCaseSensitive(); int maxLevenshteinDistance = textIndex.getMaxLevenshteinDistance(); if(maxLevenshteinDistance < 0){ throw new InvalidAttributeException(textIndex, PMMLAttributes.TEXTINDEX_MAXLEVENSHTEINDISTANCE, maxLevenshteinDistance); } return matches(leftTokens, rightTokens, caseSensitive, maxLevenshteinDistance); } private  TextUtil(); static String normalize(TextIndex textIndex, String string); static String normalize(TextIndex textIndex, TextIndexNormalization textIndexNormalization, String string); static List<String> tokenize(TextIndex textIndex, String text); static int termFrequency(TextIndex textIndex, List<String> textTokens, List<String> termTokens); static Map<List<String>, Integer> termFrequencyTable(TextIndex textIndex, List<String> textTokens, Set<List<String>> termTokenSet, int maxLength); static boolean matches(TextIndex textIndex, List<String> leftTokens, List<String> rightTokens);  }