Package com.google.common.collect

Examples of com.google.common.collect.Ordering$ByFunctionOrdering


            subjectVocabularyScore.put(tempToken , simScore);
        }*/
      }
     
      // Sort documents by relevance
      Ordering valueComparator = Ordering.natural().onResultOf(Functions.forMap(scoreMap)).compound(Ordering.natural());
      sortedRankList = ImmutableSortedMap.copyOf(scoreMap, valueComparator);
   
    }
    catch (Exception e)
    {
View Full Code Here


        if (candidates.size()==0)
            return new LinkedList<DBpediaResourceOccurrence>();

        List<DBpediaResourceOccurrence> all = getScores(sfOccurrence, candidates);

        Ordering descOrder = new Ordering<DBpediaResourceOccurrence>() {
            public int compare(DBpediaResourceOccurrence left, DBpediaResourceOccurrence right) {
                return Doubles.compare(right.similarityScore(), left.similarityScore());

            }
        };

        return descOrder.sortedCopy(all).subList(0, Math.min(k, all.size()));
    }
View Full Code Here

            int frequency = mReader.docFreq(term); // DF
            frequencyMap.put(term, frequency);
        }

        // sort the term map by frequency descending
        Ordering descOrder = new Ordering<Map.Entry<Term,Integer>>() {
            public int compare(Map.Entry<Term,Integer> left, Map.Entry<Term,Integer> right) {
                return Ints.compare(right.getValue(), left.getValue());
            }
        };
        List<Map.Entry<Term,Integer>> sorted = descOrder.sortedCopy(frequencyMap.entrySet());

        return sorted;
    }
View Full Code Here

            }

        } catch (IOException e) {
            e.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
        }
        Ordering descOrder = new Ordering<Map.Entry<String,Integer>>() {
            public int compare(Map.Entry<String,Integer> left, Map.Entry<String,Integer> right) {
                return Ints.compare(right.getValue(), left.getValue());
            }
        };
        List<Map.Entry<String,Integer>> sorted = descOrder.sortedCopy(termFreqMap.entrySet());

        return sorted;
    }
View Full Code Here

        }

        if (resultOccs.isEmpty())
            throw new SearchException("Could not find surface form "+sfOccurrence.surfaceForm());

        Ordering descOrder = new Ordering<DBpediaResourceOccurrence>() {
            public int compare(DBpediaResourceOccurrence left, DBpediaResourceOccurrence right) {
                return Doubles.compare(right.resource().support(), left.resource().support());

            }
        };

        return descOrder.sortedCopy(resultOccs).subList(0, Math.min(k, resultOccs.size()));
    }
View Full Code Here

TOP

Related Classes of com.google.common.collect.Ordering$ByFunctionOrdering

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.