com.jalios.jcms.search
Class SuggestionManager

java.lang.Object
  extended by com.jalios.jcms.search.SuggestionManager

public class SuggestionManager
extends Object

MoreLikeThis with Tf/Idf computation


Constructor Summary
SuggestionManager()
           
 
Method Summary
static Collection<Category> getCategoriesLikeThis(String text, String lang)
          Retrieve Category similar to the specified text.
static SuggestionManager getInstance()
          Returns the singleton.
static SortedSet<Publication> getPublicationsLikeThis(String text, String lang)
          Retrieve Publication similar to the specified text.
protected static List<String> getSortedList(Map<String,? extends Comparable> map)
          Extracts all of the keys from the map, and returns them sorted in reverse order of the values.
static Collection<String> getTfIdfVector(String text, String lang)
          Convenient shortcut for getTfIdfVectorFromPublications
static Collection<String> getTfIdfVectorFromCategories(String text, String lang)
          Retrieve TF/IDF keyword from Categories index
static Collection<String> getTfIdfVectorFromDocuments(String text, String lang)
          Retrieve TF/IDF keyword from Documents index
static Collection<String> getTfIdfVectorFromPublications(String text, String lang)
          Retrieve TF/IDF keyword from Publications index
 String guessLanguage(String text, String deflang)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SuggestionManager

public SuggestionManager()
Method Detail

getInstance

public static SuggestionManager getInstance()
Returns the singleton. Caution: This method is not thread-safe.

Returns:
the singleton.
Since:
jcms-7

guessLanguage

public String guessLanguage(String text,
                            String deflang)

getTfIdfVector

public static Collection<String> getTfIdfVector(String text,
                                                String lang)
Convenient shortcut for getTfIdfVectorFromPublications

See Also:
getTfIdfVectorFromPublications(String,String)

getTfIdfVectorFromPublications

public static Collection<String> getTfIdfVectorFromPublications(String text,
                                                                String lang)
Retrieve TF/IDF keyword from Publications index

Parameters:
text - the text to match
lang - the text language
Returns:
Collection of matching keywords

getPublicationsLikeThis

public static SortedSet<Publication> getPublicationsLikeThis(String text,
                                                             String lang)
Retrieve Publication similar to the specified text.

Parameters:
text - some text
lang - the language of the specified text
Returns:
return a set of publication with similar text than the specified one, sorted by relevance

getTfIdfVectorFromDocuments

public static Collection<String> getTfIdfVectorFromDocuments(String text,
                                                             String lang)
Retrieve TF/IDF keyword from Documents index

Parameters:
text - the text to match
lang - the text language
Returns:
Collection of matching keywords

getTfIdfVectorFromCategories

public static Collection<String> getTfIdfVectorFromCategories(String text,
                                                              String lang)
Retrieve TF/IDF keyword from Categories index

Parameters:
text - the text to match
lang - the text language
Returns:
Collection of matching keywords

getCategoriesLikeThis

public static Collection<Category> getCategoriesLikeThis(String text,
                                                         String lang)
Retrieve Category similar to the specified text.

Parameters:
text - some text
lang - the language of the specified text
Returns:
return a set of category with similar text than the specified one, sorted by relevance

getSortedList

protected static List<String> getSortedList(Map<String,? extends Comparable> map)
Extracts all of the keys from the map, and returns them sorted in reverse order of the values.

Parameters:
map - The map.
Returns:
The sorted list.


Copyright © 2001-2010 Jalios SA. All Rights Reserved.