Class BabelNet

    • Field Detail

      • indexManager

        protected static it.uniroma1.lcl.babelnet.BabelNetIndexManager indexManager
        Lucene index manager
    • Constructor Detail

      • BabelNet

        protected BabelNet()
        BabelNet default constructor
    • Method Detail

      • getInstance

        public static BabelNet getInstance()
        Returns the singleton instance of the BabelNet class
        Returns:
        the instance of BabelNet
      • getSenses

        @Deprecated
        public List<BabelSense> getSenses​(String word,
                                          it.uniroma1.lcl.jlt.util.Language language,
                                          boolean normalized)
        Returns the senses for the word with the given constraints.
        Parameters:
        word - the word whose senses are to be retrieved.
        language - the language of the input word.
        normalized - enables normalized search
        Returns:
        the senses of the word.
      • getSenses

        @Deprecated
        public List<BabelSense> getSenses​(String word,
                                          it.uniroma1.lcl.jlt.util.Language searchLanguage,
                                          Collection<it.uniroma1.lcl.jlt.util.Language> targetLanguages)
        Returns the senses for the word with the given constraints.
        Parameters:
        word - the word whose senses are to be retrieved.
        searchLanguage - the language of the input word.
        targetLanguages - the languages in which the data are to be retrieved.
        Returns:
        the senses of the word.
      • getSenses

        @Deprecated
        public List<BabelSense> getSenses​(String word,
                                          it.uniroma1.lcl.jlt.util.Language searchLanguage,
                                          Collection<it.uniroma1.lcl.jlt.util.Language> targetLanguages,
                                          boolean normalized)
        Returns the senses for the word with the given constraints.
        Parameters:
        word - the word whose senses are to be retrieved.
        searchLanguage - the language of the input word.
        targetLanguages - the languages in which the data are to be retrieved.
        normalized - enables normalized search
        Returns:
        the senses of the word.
      • getSenses

        @Deprecated
        public List<BabelSense> getSenses​(String word,
                                          it.uniroma1.lcl.jlt.util.Language searchLanguage,
                                          it.uniroma1.lcl.jlt.util.POS pos,
                                          Collection<it.uniroma1.lcl.jlt.util.Language> targetLanguages)
        Returns the senses for the word with the given constraints.
        Parameters:
        word - the word whose senses are to be retrieved.
        searchLanguage - the language of the input word.
        pos - the PoS of the word.
        targetLanguages - the languages in which the data are to be retrieved.
        Returns:
        the senses of the word.
      • getSenses

        @Deprecated
        public List<BabelSense> getSenses​(String word,
                                          it.uniroma1.lcl.jlt.util.Language searchLanguage,
                                          it.uniroma1.lcl.jlt.util.POS pos,
                                          Collection<it.uniroma1.lcl.jlt.util.Language> targetLanguages,
                                          boolean normalized)
        Returns the senses for the word with the given constraints.
        Parameters:
        word - the word whose senses are to be retrieved.
        searchLanguage - the language of the input word.
        pos - the PoS of the word.
        targetLanguages - the languages in which the data are to be retrieved.
        normalized - enables normalized search
        Returns:
        the senses of the word.
      • getSenses

        @Deprecated
        public List<BabelSense> getSenses​(String word,
                                          it.uniroma1.lcl.jlt.util.Language language,
                                          it.uniroma1.lcl.jlt.util.POS pos,
                                          BabelSenseSource... allowedSources)
        Returns the senses for the word with the given constraints.
        Parameters:
        word - the word whose senses are to be retrieved.
        language - the language of the input word.
        pos - the PoS of the word.
        allowedSources - the BabelSenseSources that can be used to look up the possible senses of the input word.
        Returns:
        the senses of the word.
      • getSenses

        @Deprecated
        public List<BabelSense> getSenses​(String word,
                                          it.uniroma1.lcl.jlt.util.Language language,
                                          it.uniroma1.lcl.jlt.util.POS pos,
                                          boolean normalized,
                                          BabelSenseSource... allowedSources)
        Returns the senses for the word with the given constraints.
        Parameters:
        word - the word whose senses are to be retrieved.
        language - the language of the input word.
        pos - the PoS of the word.
        normalized - enables normalized search
        allowedSources - the BabelSenseSources that can be used to look up the possible senses of the input word.
        Returns:
        the senses of the word.
      • getSenses

        @Deprecated
        public List<BabelSense> getSenses​(String word,
                                          it.uniroma1.lcl.jlt.util.Language language,
                                          it.uniroma1.lcl.jlt.util.POS pos,
                                          Collection<it.uniroma1.lcl.jlt.util.Language> targetLangs,
                                          BabelSenseSource... allowedSources)
        Returns the senses for the word with the given constraints.
        Parameters:
        word - the word whose senses are to be retrieved.
        language - the language of the input word.
        pos - the PoS of the word.
        targetLangs - the languages in which the data are to be retrieved.
        allowedSources - the BabelSenseSources that can be used to look up the possible senses of the input word.
        Returns:
        the senses of the word.
      • getSenses

        @Deprecated
        public List<BabelSense> getSenses​(String word,
                                          it.uniroma1.lcl.jlt.util.Language sourceLanguage,
                                          it.uniroma1.lcl.jlt.util.POS pos,
                                          Collection<it.uniroma1.lcl.jlt.util.Language> targetLanguages,
                                          boolean normalized,
                                          BabelSenseSource... allowedSources)
        Returns the senses for the word with the given constraints.
        Parameters:
        word - the word whose senses are to be retrieved.
        sourceLanguage - the language of the input word.
        pos - the PoS of the word.
        targetLanguages - the languages in which the data are to be retrieved.
        normalized - enables normalized search
        allowedSources - the BabelSenseSources that can be used to look up the possible senses of the input word.
        Returns:
        the senses of the word.
      • getSenses

        @Deprecated
        public List<BabelSense> getSenses​(String word)
        Deprecated.
        Returns the senses of synsets containing the word in any language.
        Parameters:
        word - the word whose senses are to be retrieved.
        Returns:
        the senses of the word.
      • getSenses

        @Deprecated
        public List<BabelSense> getSenses​(String word,
                                          it.uniroma1.lcl.jlt.util.Language language)
        Returns the senses of synsets containing the word in the given language.
        Parameters:
        word - the word whose senses are to be retrieved.
        language - the language of the input word.
        Returns:
        the senses of the word.
      • getSenses

        @Deprecated
        public List<BabelSense> getSenses​(String word,
                                          it.uniroma1.lcl.jlt.util.Language language,
                                          it.uniroma1.lcl.jlt.util.POS pos)
        Returns the senses of synsets containing the word with the given constraints.
        Parameters:
        word - the word whose senses are to be retrieved.
        language - the language of the input word.
        pos - the PoS of the word.
        Returns:
        the senses of the word.
      • getSynsets

        public List<BabelSynset> getSynsets​(String word,
                                            Collection<it.uniroma1.lcl.jlt.util.Language> searchLangs,
                                            it.uniroma1.lcl.jlt.util.POS pos)
        Description copied from interface: LKB
        Given a word and a collection of languages, returns the synsets for the word available in the given sense sources.
        Specified by:
        getSynsets in interface LKB<BabelSynset,​BabelSense,​BabelSynsetRelation,​BabelPointer,​BabelGloss,​BabelExample,​BabelNetQuery>
        Parameters:
        word - the word whose synsets are to be retrieved.
        searchLangs - a collection of languages that can be used to look up the input word.
        pos - the PoS of the word.
        Returns:
        the synsets of the word.
      • getSynset

        public BabelSynset getSynset​(ResourceID resourceID)
        Description copied from interface: LKB
        Given a ResourceID, returns the synset identified by the ResourceID in input.

        Note: It is possible that this method gives a warning if the ResourceID returns more than one synset. In that case the best (see InternalBabelSynsetComparator) sense will be returned.

        Specified by:
        getSynset in interface LKB<BabelSynset,​BabelSense,​BabelSynsetRelation,​BabelPointer,​BabelGloss,​BabelExample,​BabelNetQuery>
        Parameters:
        resourceID - the resource identifier
        Returns:
        the synset identified by the ResourceID

        Some examples that can be used follow, assuming:

        BabelNet bn = BabelNet.getInstance();

        Retrieving BabelSynset from a Wikipedia page title:

            BabelSynset synset = bn.getSynset(new WikipediaID("BabelNet", Language.EN, BabelPOS.NOUN));

        Retrieving BabelSynset from a Wikiquote page title:

            BabelSynset synset =  bn.getSynset(new WikiquoteID("Home", Language.EN, BabelPOS.NOUN));

        Retrieving BabelSynset from a WordNet id:

          BabelSynset synset = bn.getSynset(new WordNetSynsetID("wn:03544360n"));

        Retrieving BabelSynset from a Wikidata page id:

          BabelSynset synset = bn.getSynset(new WikidataID("Q4837690"));

        Retrieving BabelSynset from a OmegaWiki page id:

          BabelSynset synset = bn.getSynset(new OmegaWikiID("1499705"));
      • getSynsets

        @Deprecated
        public List<BabelSynset> getSynsets​(String word,
                                            it.uniroma1.lcl.jlt.util.Language language,
                                            boolean normalized)
        Given a word in a certain language, returns the synsets for the word.
        Parameters:
        word - the word whose synsets are to be retrieved.
        language - the language of the input word.
        normalized - enables normalized search
        Returns:
        the synsets of the word.
      • getSynsets

        @Deprecated
        public List<BabelSynset> getSynsets​(String word,
                                            it.uniroma1.lcl.jlt.util.Language language,
                                            Collection<it.uniroma1.lcl.jlt.util.Language> targetLangs)
        Given a word in a certain language, returns the synsets for the word.
        Parameters:
        word - the word whose synsets are to be retrieved.
        language - the language of the input word.
        targetLangs - the languages in which the data are to be retrieved.
        Returns:
        the synsets of the word.
      • getSynsets

        @Deprecated
        public List<BabelSynset> getSynsets​(String word,
                                            it.uniroma1.lcl.jlt.util.Language language,
                                            Collection<it.uniroma1.lcl.jlt.util.Language> targetLangs,
                                            boolean normalized)
        Given a word in a certain language, returns the synsets for the word.
        Parameters:
        word - the word whose synsets are to be retrieved.
        language - the language of the input word.
        targetLangs - the languages in which the data are to be retrieved.
        normalized - enables normalized search
        Returns:
        the synsets of the word.
      • getSynsets

        @Deprecated
        public List<BabelSynset> getSynsets​(String word,
                                            Collection<it.uniroma1.lcl.jlt.util.Language> langs,
                                            boolean normalized)
        Given a word and a collection of languages, returns the synsets for the word available in the given sense sources.
        Parameters:
        word - the word whose synsets are to be retrieved.
        langs - a collection of languages that can be used to look up the input word.
        normalized - enables normalized search
        Returns:
        the synsets of the word.
      • getSynsets

        @Deprecated
        public List<BabelSynset> getSynsets​(String word,
                                            Collection<it.uniroma1.lcl.jlt.util.Language> langs,
                                            Collection<it.uniroma1.lcl.jlt.util.Language> targetLangs)
        Given a word and a collection of languages, returns the synsets for the word available in the given sense sources.
        Parameters:
        word - the word whose synsets are to be retrieved.
        langs - a collection of languages that can be used to look up the input word.
        targetLangs - the languages in which the data are to be retrieved.
        Returns:
        the synsets of the word.
      • getSynsets

        @Deprecated
        public List<BabelSynset> getSynsets​(String word,
                                            Collection<it.uniroma1.lcl.jlt.util.Language> langs,
                                            Collection<it.uniroma1.lcl.jlt.util.Language> targetLangs,
                                            boolean normalized)
        Given a word and a collection of languages, returns the synsets for the word available in the given sense sources.
        Parameters:
        word - the word whose synsets are to be retrieved.
        langs - a collection of languages that can be used to look up the input word.
        targetLangs - the languages in which the data are to be retrieved.
        normalized - enables normalized search
        Returns:
        the synsets of the word.
      • getSynsets

        @Deprecated
        public List<BabelSynset> getSynsets​(String word,
                                            it.uniroma1.lcl.jlt.util.Language language,
                                            it.uniroma1.lcl.jlt.util.POS pos,
                                            boolean normalized)
        Given a word in a certain language, returns the synsets for the word.
        Parameters:
        word - the word whose synsets are to be retrieved.
        language - the language of the input word.
        pos - the PoS of the word.
        normalized - enables normalized search
        Returns:
        the synsets of the word.
      • getSynsets

        @Deprecated
        public List<BabelSynset> getSynsets​(String word,
                                            it.uniroma1.lcl.jlt.util.Language language,
                                            it.uniroma1.lcl.jlt.util.POS pos,
                                            Collection<it.uniroma1.lcl.jlt.util.Language> targetLangs)
        Given a word in a certain language, returns the synsets for the word.
        Parameters:
        word - the word whose synsets are to be retrieved.
        language - the language of the input word.
        pos - the PoS of the word.
        targetLangs - the languages in which the data are to be retrieved.
        Returns:
        the synsets of the word.
      • getSynsets

        public List<BabelSynset> getSynsets​(String word,
                                            it.uniroma1.lcl.jlt.util.Language language,
                                            it.uniroma1.lcl.jlt.util.POS pos,
                                            Collection<it.uniroma1.lcl.jlt.util.Language> targetLangs,
                                            boolean normalized)
        Given a word in a certain language, returns the synsets for the word.
        Parameters:
        word - the word whose synsets are to be retrieved.
        language - the language of the input word.
        pos - the PoS of the word.
        targetLangs - the languages in which the data are to be retrieved.
        normalized - enables normalized search
        Returns:
        the synsets of the word.
      • getSynsets

        @Deprecated
        public List<BabelSynset> getSynsets​(String word,
                                            Collection<it.uniroma1.lcl.jlt.util.Language> langs,
                                            it.uniroma1.lcl.jlt.util.POS pos,
                                            boolean normalized)
        Given a word and a collection of languages, returns the synsets for the word available in the given sense sources.
        Parameters:
        word - the word whose synsets are to be retrieved.
        langs - a collection of languages that can be used to look up the input word.
        pos - the PoS of the word.
        normalized - enables normalized search
        Returns:
        the synsets of the word.
      • getSynsets

        @Deprecated
        public List<BabelSynset> getSynsets​(String word,
                                            Collection<it.uniroma1.lcl.jlt.util.Language> langs,
                                            it.uniroma1.lcl.jlt.util.POS pos,
                                            Collection<it.uniroma1.lcl.jlt.util.Language> targetLangs)
        Given a word and a collection of languages, returns the synsets for the word available in the given sense sources.
        Parameters:
        word - the word whose synsets are to be retrieved.
        langs - a collection of languages that can be used to look up the input word.
        pos - the PoS of the word.
        targetLangs - the languages in which the data are to be retrieved.
        Returns:
        the synsets of the word.
      • getSynsets

        @Deprecated
        public List<BabelSynset> getSynsets​(String word,
                                            Collection<it.uniroma1.lcl.jlt.util.Language> langs,
                                            it.uniroma1.lcl.jlt.util.POS pos,
                                            Collection<it.uniroma1.lcl.jlt.util.Language> targetLangs,
                                            boolean normalized)
        Given a word and a collection of languages, returns the synsets for the word available in the given sense sources.
        Parameters:
        word - the word whose synsets are to be retrieved.
        langs - a collection of languages that can be used to look up the input word.
        pos - the PoS of the word.
        targetLangs - the languages in which the data are to be retrieved.
        normalized - enables normalized search
        Returns:
        the synsets of the word.
      • getSynsets

        @Deprecated
        public List<BabelSynset> getSynsets​(String word,
                                            it.uniroma1.lcl.jlt.util.Language language,
                                            it.uniroma1.lcl.jlt.util.POS pos,
                                            BabelSenseSource... allowedSources)
        Given a word in a certain language, returns the synsets for the word available in the given sense sources.
        Parameters:
        word - the word whose synsets are to be retrieved.
        language - the language of the input word.
        pos - the PoS of the word.
        allowedSources - the BabelSenseSources that can be used to look up the possible senses of the input word.
        Returns:
        the synsets of the word.
      • getSynsets

        @Deprecated
        public List<BabelSynset> getSynsets​(String word,
                                            it.uniroma1.lcl.jlt.util.Language language,
                                            it.uniroma1.lcl.jlt.util.POS pos,
                                            boolean normalized,
                                            BabelSenseSource... allowedSources)
        Given a word in a certain language, returns the synsets for the word available in the given sense sources.
        Parameters:
        word - the word whose synsets are to be retrieved.
        language - the language of the input word.
        pos - the PoS of the word.
        normalized - enables normalized search
        allowedSources - the BabelSenseSources that can be used to look up the possible senses of the input word.
        Returns:
        the synsets of the word.
      • getSynsets

        @Deprecated
        public List<BabelSynset> getSynsets​(String word,
                                            it.uniroma1.lcl.jlt.util.Language language,
                                            it.uniroma1.lcl.jlt.util.POS pos,
                                            Collection<it.uniroma1.lcl.jlt.util.Language> targetLangs,
                                            BabelSenseSource... allowedSources)
        Given a word in a certain language, returns the synsets for the word available in the given sense sources.
        Parameters:
        word - the word whose synsets are to be retrieved.
        language - the language of the input word.
        pos - the PoS of the word.
        targetLangs - the languages in which the data are to be retrieved.
        allowedSources - the BabelSenseSources that can be used to look up the possible senses of the input word.
        Returns:
        the synsets of the word.
      • getSynsets

        @Deprecated
        public List<BabelSynset> getSynsets​(String word,
                                            it.uniroma1.lcl.jlt.util.Language language,
                                            it.uniroma1.lcl.jlt.util.POS pos,
                                            Collection<it.uniroma1.lcl.jlt.util.Language> targetLangs,
                                            boolean normalized,
                                            BabelSenseSource... allowedSources)
        Given a word in a certain language, returns the synsets for the word available in the given sense sources.
        Parameters:
        word - the word whose synsets are to be retrieved.
        language - the language of the input word.
        pos - the PoS of the word.
        targetLangs - the languages in which the data are to be retrieved.
        normalized - enables normalized search
        allowedSources - sources used to search
        Returns:
        the synsets of the word.
      • getSynsets

        @Deprecated
        public List<BabelSynset> getSynsets​(String word,
                                            Collection<it.uniroma1.lcl.jlt.util.Language> langs,
                                            it.uniroma1.lcl.jlt.util.POS pos,
                                            BabelSenseSource... allowedSources)
        Given a word and a collection of languages, returns the synsets for the word available in the given sense sources.
        Parameters:
        word - the word whose synsets are to be retrieved.
        langs - a collection of languages that can be used to look up the input word.
        pos - the PoS of the word.
        allowedSources - the BabelSenseSources that can be used to look up the possible senses of the input word.
        Returns:
        the synsets of the word.
      • getSynsets

        @Deprecated
        public List<BabelSynset> getSynsets​(String word,
                                            Collection<it.uniroma1.lcl.jlt.util.Language> langs,
                                            it.uniroma1.lcl.jlt.util.POS pos,
                                            boolean normalized,
                                            BabelSenseSource... allowedSources)
        Given a word and a collection of languages, returns the synsets for the word available in the given sense sources.
        Parameters:
        word - the word whose synsets are to be retrieved.
        langs - a collection of languages that can be used to look up the input word.
        pos - the PoS of the word.
        normalized - enables normalized search
        allowedSources - the BabelSenseSources that can be used to look up the possible senses of the input word.
        Returns:
        the synsets of the word.
      • getSynsets

        @Deprecated
        public List<BabelSynset> getSynsets​(String word,
                                            Collection<it.uniroma1.lcl.jlt.util.Language> langs,
                                            it.uniroma1.lcl.jlt.util.POS pos,
                                            Collection<it.uniroma1.lcl.jlt.util.Language> targetLangs,
                                            BabelSenseSource... allowedSources)
        Given a word and a collection of languages, returns the synsets for the word available in the given sense sources.
        Parameters:
        word - the word whose synsets are to be retrieved.
        langs - a collection of languages that can be used to look up the input word.
        pos - the PoS of the word.
        targetLangs - the languages in which the data are to be retrieved.
        allowedSources - the BabelSenseSources that can be used to look up the possible senses of the input word.
        Returns:
        the synsets of the word.
      • getSynsets

        @Deprecated
        public List<BabelSynset> getSynsets​(String word,
                                            Collection<it.uniroma1.lcl.jlt.util.Language> langs,
                                            it.uniroma1.lcl.jlt.util.POS pos,
                                            Collection<it.uniroma1.lcl.jlt.util.Language> targetLangs,
                                            boolean normalized,
                                            BabelSenseSource... allowedSources)
        Given a word and a collection of languages, returns the synsets for the word available in the given sense sources.
        Parameters:
        word - the word whose synsets are to be retrieved.
        langs - a collection of languages that can be used to look up the input word.
        pos - the PoS of the word.
        targetLangs - the languages in which the data are to be retrieved.
        normalized - enables normalized search
        allowedSources - the BabelSenseSources that can be used to look up the possible senses of the input word.
        Returns:
        the synsets of the word.
      • lexiconStream

        public Stream<it.uniroma1.lcl.jlt.ling.Word> lexiconStream()
        Returns the full stream of BabelSynsets
        Returns:
        the stream of BabelSynsets
      • senseStream

        public Stream<BabelSense> senseStream​(it.uniroma1.lcl.jlt.util.Language language)
        Returns the full stream of BabelSenses in a given Language
        Parameters:
        language - the language of the senses
        Returns:
        the stream of BabelSenses
      • senseStream

        public Stream<BabelSense> senseStream​(it.uniroma1.lcl.jlt.util.Language language,
                                              BabelSenseSource source)
        Returns the full stream of BabelSenses with the given constraints
        Parameters:
        language - the language of the senses
        source - the source of the senses
        Returns:
        the stream of BabelSenses
      • getIndexManager

        protected it.uniroma1.lcl.babelnet.BabelNetIndexManager getIndexManager()
        Returns the BabelNetIndexManager
        Returns:
        the BabelNetIndexManager