/** * equivalent to incrementCount(l,o,1.0). */ public void incrementCount(List<K> l, K o) { incrementCount(l, o, 1.0); }
gc.incrementCount(Arrays.asList(new String[]{"a", "j", "x"}), 3.0); gc.incrementCount(Arrays.asList(new String[]{"a", "l", "x"}), 3.0); gc.incrementCount(Arrays.asList(new String[]{"b", "k", "y"}), 3.0); gc.incrementCount(Arrays.asList(new String[]{"b", "k", "z"}), 3.0); gc1.incrementCount(Arrays.asList(new String[]{"j", "x"})); gc1.incrementCount2D("j", "z"); GeneralizedCounter<String> gc2 = gc1.conditionalize(Arrays.asList(new String[]{"j"}));
/** * Equivalent to incrementCount(l, 1.0). */ public void incrementCount(List<K> l) { incrementCount(l, 1.0); }
public GeneralizedCounter<K> reverseKeys() { GeneralizedCounter<K> result = new GeneralizedCounter<>(); Set<Map.Entry<List<K>,Double>> entries = entrySet(); for (Map.Entry<List<K>,Double> entry: entries) { List<K> list = entry.getKey(); double count = entry.getValue(); Collections.reverse(list); result.incrementCount(list, count); } return result; }
public GeneralizedCounter<E> probs(int position, int window) { GeneralizedCounter<E> gc = new GeneralizedCounter<>(window); int[] labels = new int[window]; // cdm july 2005: below array initialization isn't necessary: JLS (3rd ed.) // 4.12.5 // Arrays.fill(labels, 0); OUTER: while (true) { List<E> labelsList = intArrayToListE(labels); gc.incrementCount(labelsList, prob(position, labels)); for (int i = 0; i < labels.length; i++) { labels[i]++; if (labels[i] < numClasses) { break; } if (i == labels.length - 1) { break OUTER; } labels[i] = 0; } } return gc; }
public GeneralizedCounter<E> logProbs(int position, int window) { GeneralizedCounter<E> gc = new GeneralizedCounter<>(window); int[] labels = new int[window]; // cdm july 2005: below array initialization isn't necessary: JLS (3rd ed.) // 4.12.5 // Arrays.fill(labels, 0); OUTER: while (true) { List<E> labelsList = intArrayToListE(labels); gc.incrementCount(labelsList, logProb(position, labels)); for (int i = 0; i < labels.length; i++) { labels[i]++; if (labels[i] < numClasses) { break; } if (i == labels.length - 1) { break OUTER; } labels[i] = 0; } } return gc; }
sym = Symbol.END_WORD; POSspecificCharNGrams[0].incrementCount(context, sym); // POS-specific 1-gram if (unknownCharClass != null) { POSspecificCharNGrams[0].incrementCount(context, unknownCharClass); // for unknown ch model if (i - j < 0) { context.add(Symbol.BEGIN_WORD); POSspecificCharNGrams[j].incrementCount(context, sym); if (unknownCharClass != null) { POSspecificCharNGrams[j].incrementCount(context, unknownCharClass); // for unknown ch model context.add(prev); POSspecificCharNGrams[j].incrementCount(context, sym); if (unknownCharClass != null) { POSspecificCharNGrams[j].incrementCount(context, unknownCharClass); // for unknown ch model
/** * equivalent to incrementCount(l,o,1.0). */ public void incrementCount(List<K> l, K o) { incrementCount(l, o, 1.0); }
/** * Equivalent to incrementCount(l, 1.0). */ public void incrementCount(List<K> l) { incrementCount(l, 1.0); }
/** * Equivalent to incrementCount(l, 1.0). */ public void incrementCount(List<K> l) { incrementCount(l, 1.0); }
/** * Equivalent to incrementCount(l, 1.0). */ public void incrementCount(List<K> l) { incrementCount(l, 1.0); }
/** * equivalent to incrementCount(l,o,1.0). */ public void incrementCount(List<K> l, K o) { incrementCount(l, o, 1.0); }
/** * equivalent to incrementCount(l,o,1.0). */ public void incrementCount(List<K> l, K o) { incrementCount(l, o, 1.0); }
/** * equivalent to incrementCount(l,o,1.0). */ public void incrementCount(List<K> l, K o) { incrementCount(l, o, 1.0); }
/** * Equivalent to incrementCount(l, 1.0). */ public void incrementCount(List<K> l) { incrementCount(l, 1.0); }
public GeneralizedCounter<K> reverseKeys() { GeneralizedCounter<K> result = new GeneralizedCounter<>(); Set<Map.Entry<List<K>,Double>> entries = entrySet(); for (Map.Entry<List<K>,Double> entry: entries) { List<K> list = entry.getKey(); double count = entry.getValue(); Collections.reverse(list); result.incrementCount(list, count); } return result; }
public GeneralizedCounter<K> reverseKeys() { GeneralizedCounter<K> result = new GeneralizedCounter<>(); Set<Map.Entry<List<K>,Double>> entries = entrySet(); for (Map.Entry<List<K>,Double> entry: entries) { List<K> list = entry.getKey(); double count = entry.getValue(); Collections.reverse(list); result.incrementCount(list, count); } return result; }
public GeneralizedCounter<K> reverseKeys() { GeneralizedCounter<K> result = new GeneralizedCounter<K>(); Set<Map.Entry<List<K>,Double>> entries = entrySet(); for (Map.Entry<List<K>,Double> entry: entries) { List<K> list = entry.getKey(); double count = entry.getValue(); Collections.reverse(list); result.incrementCount(list, count); } return result; }
public GeneralizedCounter<K> reverseKeys() { GeneralizedCounter<K> result = new GeneralizedCounter<K>(); Set<Map.Entry<List<K>,Double>> entries = entrySet(); for (Map.Entry<List<K>,Double> entry: entries) { List<K> list = entry.getKey(); double count = entry.getValue(); Collections.reverse(list); result.incrementCount(list, count); } return result; }
public GeneralizedCounter probs(int position, int window) { GeneralizedCounter gc = new GeneralizedCounter(window); int[] labels = new int[window]; // cdm july 2005: below array initialization isn't necessary: JLS (3rd ed.) 4.12.5 // Arrays.fill(labels, 0); OUTER: while (true) { List labelsList = Arrays.asList(intArrayToObjectArray(labels)); gc.incrementCount(labelsList, prob(position, labels)); for (int i = 0; i < labels.length; i++) { labels[i]++; if (labels[i] < numClasses) { break; } if (i == labels.length - 1) { break OUTER; } labels[i] = 0; } } return gc; }