当前位置: 首页>>代码示例>>Java>>正文


Java ObjectOpenHashSet.addAll方法代码示例

本文整理汇总了Java中it.unimi.dsi.fastutil.objects.ObjectOpenHashSet.addAll方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectOpenHashSet.addAll方法的具体用法?Java ObjectOpenHashSet.addAll怎么用?Java ObjectOpenHashSet.addAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在it.unimi.dsi.fastutil.objects.ObjectOpenHashSet的用法示例。


在下文中一共展示了ObjectOpenHashSet.addAll方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getListsElementsCombinationSet

import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; //导入方法依赖的package包/类
/**
 * Given a list of lists, and a list of lists of integers, which is a combination of indices between the elements of 
 * "lists", get the set of all elements' combinations. For example, if we have a list of the list 'combinationsInd' which is
 * [1, 2], and the list of lists 'lists' is [[1, 2, 3], [4, 5], [6, 7, 8]], then this function will add the following lists 
 * to the result: [[4, 6], [4, 7], [4, 8], [5, 7], [5, 8]] 
 * @param combinationsInd: list of indices of the lists to be combined
 * @param lists: list of lists
 * @return
 */
public static <T> ObjectOpenHashSet<ObjectArrayList<T>> getListsElementsCombinationSet(
                        ObjectArrayList<IntArrayList> combinationsInd, ObjectArrayList<ObjectArrayList<T>> lists){
    ObjectOpenHashSet<ObjectArrayList<T>> combinationSets = new ObjectOpenHashSet<>();
    ObjectArrayList<ObjectArrayList<T>> tempLists = new ObjectArrayList<>();

    for (IntArrayList indList: combinationsInd){
        tempLists.clear();
        for (int index: indList){
            tempLists.add(lists.get(index));
        }
        combinationSets.addAll(getElementsCombinations(tempLists));
    }
    return combinationSets;
}
 
开发者ID:gkiril,项目名称:minie,代码行数:24,代码来源:FastUtil.java

示例2: detectQuantities

import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; //导入方法依赖的package包/类
/**
 * Detect the quantities in a phrase (given the sentence semantic graph).
 * @param sentSemGraph: the sentence semantic graph
 */
public void detectQuantities(SemanticGraph sentSemGraph, int i){
    // Quantity words and edges
    ObjectArrayList<IndexedWord> qWords = new ObjectArrayList<IndexedWord>();
    ObjectArrayList<SemanticGraphEdge> qEdges = new ObjectArrayList<SemanticGraphEdge>();
    
    // Tokens regex patterns
    String tokenRegexPattern;
    if (i == 1)
        tokenRegexPattern = REGEX.QUANTITY_SEQUENCE;
    else
        tokenRegexPattern = REGEX.QUANTITY_SEQUENCE_WITH_NO;
    
    TokenSequencePattern tPattern = TokenSequencePattern.compile(tokenRegexPattern);
    TokenSequenceMatcher tMatcher = tPattern.getMatcher(this.getWordCoreLabelList());
    
    // Some reusable variables
    List<CoreMap> matchCoreMaps;
    ObjectOpenHashSet<IndexedWord> wordsSet = new ObjectOpenHashSet<>();
    IndexedWord head;
    Set<SemanticGraphEdge> subtreeedges = new HashSet<>();
    int matchCounter = -1;
    
    // Annotate the matches and their subtrees
    while (tMatcher.find()){      
        matchCounter++;
        matchCoreMaps = tMatcher.groupNodes();
        
        // Get the head word of the phrase and see whether or not to add it to the quantities
        head = CoreNLPUtils.getRootFromCoreMapWordList(sentSemGraph, matchCoreMaps);
        if (head.ner().equals(NE_TYPE.DATE) || head.ner().equals(NE_TYPE.LOCATION) ||
                head.ner().equals(NE_TYPE.MISC) || head.ner().equals(NE_TYPE.ORGANIZATION) || 
                head.ner().equals(NE_TYPE.PERSON) || head.ner().equals(NE_TYPE.TIME))
            continue;
        
        // Add the sutree elements of the head word if the right relations are in force
        for (IndexedWord w: sentSemGraph.getChildren(head)){
            if ((sentSemGraph.reln(head, w) == EnglishGrammaticalRelations.QUANTIFIER_MODIFIER) ||
                (sentSemGraph.reln(head, w) == EnglishGrammaticalRelations.ADVERBIAL_MODIFIER)){
                wordsSet.add(w);
                subtreeedges = CoreNLPUtils.getSubTreeEdges(w, sentSemGraph, null);
            }
        }
        
        // Add the quantity words found and annotate them within the phrase
        wordsSet.addAll(CoreNLPUtils.getWordSetFromCoreMapList(matchCoreMaps));
        wordsSet.addAll(CoreNLPUtils.getSortedWordsFromListOfEdges(subtreeedges));
        wordsSet.retainAll(this.getWordList());
        qWords = CoreNLPUtils.getSortedWordsFromSetOfWords(wordsSet);
        if (qWords.isEmpty())
            continue;
        this.setQuantitiesFromWordList(qWords.clone(), qEdges, sentSemGraph, i, matchCounter);
        
        // Reset
        qWords.clear();
        wordsSet.clear();
    }
}
 
开发者ID:gkiril,项目名称:minie,代码行数:62,代码来源:AnnotatedPhrase.java

示例3: addAll

import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; //导入方法依赖的package包/类
public void addAll(FHashMapSet<K, V> map) {
    for (Entry<K, FHashSet<V>> entry : map.object2ObjectEntrySet()) {
        ObjectOpenHashSet<V> set = getSet(entry.getKey());
        set.addAll(entry.getValue());
    }
}
 
开发者ID:htools,项目名称:htools,代码行数:7,代码来源:FHashMapSet.java

示例4: addAll

import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; //导入方法依赖的package包/类
public void addAll(FHashMapIntSet<V> map) {
    for (Entry<ObjectOpenHashSet<V>> entry : map.int2ObjectEntrySet()) {
        ObjectOpenHashSet<V> set = getSet(entry.getIntKey());
        set.addAll(entry.getValue());
    }
}
 
开发者ID:htools,项目名称:htools,代码行数:7,代码来源:FHashMapIntSet.java


注:本文中的it.unimi.dsi.fastutil.objects.ObjectOpenHashSet.addAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。