Class BabelNetUtils


  • public class BabelNetUtils
    extends Object
    A BabelNet utility class. Mainly for internal use.
    Author:
    navigli, vannella
    • Constructor Summary

      Constructors 
      Constructor Description
      BabelNetUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int compareByPOS​(it.uniroma1.lcl.jlt.util.POS pos1, it.uniroma1.lcl.jlt.util.POS pos2)
      Compares POSes
      static com.google.common.collect.Multimap<it.uniroma1.lcl.jlt.util.Language,​it.uniroma1.lcl.jlt.util.ScoredItem<String>> getTranslations​(it.uniroma1.lcl.jlt.util.Language language, String word)
      Gets translations of an input word.
      static com.google.common.collect.Multimap<it.uniroma1.lcl.jlt.util.Language,​it.uniroma1.lcl.jlt.util.ScoredItem<String>> getTranslations​(it.uniroma1.lcl.jlt.util.Language searchLang, String word, List<it.uniroma1.lcl.jlt.util.Language> targetLangs)
      Gets translations of an input word.
      static edu.mit.jwi.item.POS toWordNetPOS​(it.uniroma1.lcl.jlt.util.UniversalPOS pos)
      Returns the JWI WordNet part of speech where available
    • Constructor Detail

      • BabelNetUtils

        public BabelNetUtils()
    • Method Detail

      • getTranslations

        public static com.google.common.collect.Multimap<it.uniroma1.lcl.jlt.util.Language,​it.uniroma1.lcl.jlt.util.ScoredItem<String>> getTranslations​(it.uniroma1.lcl.jlt.util.Language language,
                                                                                                                                                              String word)
        Gets translations of an input word.
        Parameters:
        language - the language of the input word.
        word - the word whose senses are to be retrieved.
        Returns:
        the translations of the input words in different languages, each weighted by the number of times the input word was translated as such
      • getTranslations

        public static com.google.common.collect.Multimap<it.uniroma1.lcl.jlt.util.Language,​it.uniroma1.lcl.jlt.util.ScoredItem<String>> getTranslations​(it.uniroma1.lcl.jlt.util.Language searchLang,
                                                                                                                                                              String word,
                                                                                                                                                              List<it.uniroma1.lcl.jlt.util.Language> targetLangs)
        Gets translations of an input word.
        Parameters:
        searchLang - the language of the input word.
        word - the word whose senses are to be retrieved.
        targetLangs - the languages in which the data are to be retrieved.
        Returns:
        the translations of the input words in different languages, each weighted by the number of times the input word was translated as such
      • toWordNetPOS

        public static edu.mit.jwi.item.POS toWordNetPOS​(it.uniroma1.lcl.jlt.util.UniversalPOS pos)
        Returns the JWI WordNet part of speech where available
        Parameters:
        pos - the universal POS to convert
        Returns:
        JWI WordNet POS counterpart
      • compareByPOS

        public static int compareByPOS​(it.uniroma1.lcl.jlt.util.POS pos1,
                                       it.uniroma1.lcl.jlt.util.POS pos2)
        Compares POSes
        Parameters:
        pos1 - the first part of speech
        pos2 - the second part of speech
        Returns:
        -1 if pos1 should come first, +1 if pos2 should come first, 0 if they are equal