Java Code Examples for it.unimi.dsi.fastutil.objects.ObjectOpenHashSet#contains()

The following examples show how to use it.unimi.dsi.fastutil.objects.ObjectOpenHashSet#contains() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SubjDictionaryMinimization.java    From minie with GNU General Public License v3.0 6 votes vote down vote up
public static void minimizeSubject(AnnotatedPhrase subject, SemanticGraph sg, ObjectOpenHashSet<String> collocations){
    // Do the safe minimization first
    SubjSafeMinimization.minimizeSubject(subject, sg);
    
    // If the subject is frequent, don't minimize anything
    if (collocations.contains(CoreNLPUtils.listOfWordsToLemmaString(subject.getWordList()).toLowerCase())){
        return;
    }
    
    // Minimization object
    Minimization simp = new Minimization(subject, sg, collocations);
    
    // remWords: list of words to be removed (reusable variable)
    // matchWords: list of matched words from the regex (reusable variable)
    List<CoreMap> remWords = new ArrayList<>();
    List<CoreMap> matchWords = new ArrayList<>(); 
    
    // Safe minimization on the noun phrases and named entities within the subj. phrase
    simp.nounPhraseDictMinimization(remWords, matchWords);
    simp.removeVerbsBeforeNouns(remWords, matchWords);
    simp.namedEntityDictionaryMinimization(remWords, matchWords);
}
 
Example 2
Source File: RelDictionaryMinimization.java    From minie with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Minimize only the relations that are considered to have "non-frequent patterns"
 * @param rel: the relation phrase
 * @param sg: semantic graph of the sentence
 * @param freqRels: dictionary of multi-word expressions (frequent relations)
 */
public static void minimizeRelation(AnnotatedPhrase rel, SemanticGraph sg, ObjectOpenHashSet<String> collocations){
    // Do the safe minimization first
    RelSafeMinimization.minimizeRelation(rel, sg);
    
    // If the subject is frequent, don't minimize anything
    if (collocations.contains(CoreNLPUtils.listOfWordsToLemmaString(rel.getWordList()).toLowerCase())){
        return;
    }
    
    // Do the safe minimization first
    RelSafeMinimization.minimizeRelation(rel, sg);
    
    // remWords: list of words to be removed (reusable variable)
    // matchWords: list of matched words from the regex (reusable variable)
    List<CoreMap> remWords = new ArrayList<>();
    List<CoreMap> matchWords = new ArrayList<>(); 
    
    // Move to the dict. minimization of the noun phrases within the relation
    Minimization simp = new Minimization(rel, sg, collocations);
    simp.nounPhraseDictMinimization(remWords, matchWords);
    simp.namedEntityDictionaryMinimization(remWords, matchWords);
}
 
Example 3
Source File: ObjDictionaryMinimization.java    From minie with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Minimize only the objects that are considered to have "non-frequent patterns"
 * @param obj: the object phrase
 * @param sg: semantic graph of the sentence
 * @param freqObjs: dictionary of multi-word expressions (frequent objects)
 */
public static void minimizeObject(AnnotatedPhrase obj, SemanticGraph sg, ObjectOpenHashSet<String> collocations){
    // Do the safe minimization first
    ObjSafeMinimization.minimizeObject(obj, sg);
    
    // If the object is frequent, don't minimize anything
    if (collocations.contains(CoreNLPUtils.listOfWordsToLemmaString(obj.getWordList()).toLowerCase())){
        return;
    }
    
    // Minimization object
    Minimization simp = new Minimization(obj, sg, collocations);
    
    // remWords: list of words to be removed (reusable variable)
    // matchWords: list of matched words from the regex (reusable variable)
    List<CoreMap> remWords = new ArrayList<>();
    List<CoreMap> matchWords = new ArrayList<>(); 
    
    // Safe minimization on the noun phrases and named entities within the subj. phrase
    simp.nounPhraseDictMinimization(remWords, matchWords);
    simp.namedEntityDictionaryMinimization(remWords, matchWords);
}