/** Check whether there is a new number in later mention */ public static boolean entityNumberInLaterMention(Mention mention, Mention ant) { Set<String> antecedentWords = Generics.newHashSet(); for (CoreLabel w : ant.originalSpan){ antecedentWords.add(w.get(CoreAnnotations.TextAnnotation.class)); } for (CoreLabel w : mention.originalSpan) { String word = w.get(CoreAnnotations.TextAnnotation.class); // Note: this is locale specific for English and ascii numerals if (NumberMatchingRegex.isDouble(word)) { if (!antecedentWords.contains(word)) return true; } else { if (NUMBERS.contains(word.toLowerCase()) && !antecedentWords.contains(word)) return true; } } return false; }
/** Check whether there is a new number in later mention */ public static boolean entityNumberInLaterMention(Mention mention, Mention ant) { Set<String> antecedentWords = Generics.newHashSet(); for (CoreLabel w : ant.originalSpan){ antecedentWords.add(w.get(CoreAnnotations.TextAnnotation.class)); } for (CoreLabel w : mention.originalSpan) { String word = w.get(CoreAnnotations.TextAnnotation.class); // Note: this is locale specific for English and ascii numerals if (NumberMatchingRegex.isDouble(word)) { if (!antecedentWords.contains(word)) return true; } else { if (NUMBERS.contains(word.toLowerCase()) && !antecedentWords.contains(word)) return true; } } return false; }
/** Check whether there is a new number in later mention */ public static boolean entityNumberInLaterMention(Mention mention, Mention ant) { Set<String> antecedentWords = Generics.newHashSet(); for (CoreLabel w : ant.originalSpan){ antecedentWords.add(w.get(CoreAnnotations.TextAnnotation.class)); } for (CoreLabel w : mention.originalSpan) { String word = w.get(CoreAnnotations.TextAnnotation.class); // Note: this is locale specific for English and ascii numerals if (NumberMatchingRegex.isDouble(word)) { if (!antecedentWords.contains(word)) return true; } else { if (NUMBERS.contains(word.toLowerCase()) && !antecedentWords.contains(word)) return true; } } return false; }
/** Check whether there is a new number in later mention */ public static boolean entityNumberInLaterMention(Mention mention, Mention ant) { Set<String> antecedentWords = Generics.newHashSet(); for (CoreLabel w : ant.originalSpan){ antecedentWords.add(w.get(CoreAnnotations.TextAnnotation.class)); } for (CoreLabel w : mention.originalSpan) { String word = w.get(CoreAnnotations.TextAnnotation.class); // Note: this is locale specific for English and ascii numerals if (NumberMatchingRegex.isDouble(word)) { if (!antecedentWords.contains(word)) return true; } else { if (NUMBERS.contains(word.toLowerCase()) && !antecedentWords.contains(word)) return true; } } return false; }
/** Check whether there is a new number in later mention */ public static boolean entityNumberInLaterMention(Mention mention, Mention ant) { Set<String> antecedentWords = Generics.newHashSet(); for (CoreLabel w : ant.originalSpan){ antecedentWords.add(w.get(CoreAnnotations.TextAnnotation.class)); } for (CoreLabel w : mention.originalSpan) { String word = w.get(CoreAnnotations.TextAnnotation.class); // Note: this is locale specific for English and ascii numerals if (NumberMatchingRegex.isDouble(word)) { if (!antecedentWords.contains(word)) return true; } else { if (NUMBERS.contains(word.toLowerCase()) && !antecedentWords.contains(word)) return true; } } return false; }