Class BabelNetKnowledgeSource
java.lang.Object
de.uni_mannheim.informatik.dws.melt.matching_jena_matchers.external.SemanticWordRelationDictionary
de.uni_mannheim.informatik.dws.melt.matching_jena_matchers.external.babelnet.BabelNetKnowledgeSource
- All Implemented Interfaces:
ExternalResource
,ExternalResourceWithHypernymCapability
,ExternalResourceWithSynonymCapability
,HypernymCapability
,SynonymCapability
A dictionary that will use BabelNet offline indices.
-
Field Summary
Modifier and TypeFieldDescriptionprivate static it.uniroma1.lcl.babelnet.BabelNet
private ConcurrentMap<String,
HashSet<String>> Buffer for hypernyms.private BabelNetLinker
Local linker.private static final org.slf4j.Logger
private PersistenceService
Local persistence service.private ConcurrentMap<String,
HashSet<String>> Buffer for synonyms. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closing open resources.private void
commit
(PersistenceService.PreconfiguredPersistences persistence) getHypernyms
(String linkedConcept) Retrieves a set of hypernyms independently of the word sense.Returns the linker instance for this particular resource.getName()
Obtain the name of the resource.getSynonymsLexical
(String linkedConcept) The synonyms will be only looked up in the English BabelNet.private void
Initializes local databaseboolean
isInDictionary
(String word) The word will be only looked up in the English BabelNet.Normalizes string for this particular dictionary.Methods inherited from class de.uni_mannheim.informatik.dws.melt.matching_jena_matchers.external.SemanticWordRelationDictionary
isHypernym, isHypernym, isHypernymous, isStrongFormSynonymous, isSynonymous, isSynonymousOrHypernymous
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
babelNet
private static it.uniroma1.lcl.babelnet.BabelNet babelNet -
synonymBuffer
Buffer for synonyms. -
hypernymyBuffer
Buffer for hypernyms. -
persistenceService
Local persistence service. -
linker
Local linker.
-
-
Constructor Details
-
BabelNetKnowledgeSource
public BabelNetKnowledgeSource()Constructor. Make sure that the indices are available offline and that the project is configured correctly.
-
-
Method Details
-
initializeBuffers
private void initializeBuffers()Initializes local database -
isInDictionary
The word will be only looked up in the English BabelNet.- Parameters:
word
- The word to be looked for.- Returns:
- true if word found, else false.
-
getSynonymsLexical
The synonyms will be only looked up in the English BabelNet.- Specified by:
getSynonymsLexical
in interfaceSynonymCapability
- Specified by:
getSynonymsLexical
in classSemanticWordRelationDictionary
- Parameters:
linkedConcept
- The word for which synonyms shall be retrieved.- Returns:
- Set with Synonyms.
-
getHypernyms
Description copied from class:SemanticWordRelationDictionary
Retrieves a set of hypernyms independently of the word sense. The assumed language is English.- Specified by:
getHypernyms
in classSemanticWordRelationDictionary
- Parameters:
linkedConcept
- The linked concept for which hypernyms shall be retrieved.- Returns:
- A set of linked concepts.
-
close
public void close()Description copied from class:SemanticWordRelationDictionary
Closing open resources.- Specified by:
close
in classSemanticWordRelationDictionary
-
commit
-
normalize
Normalizes string for this particular dictionary.- Parameters:
stringToBeNormalized
- String that shall be normalized.- Returns:
- Normalized String.
-
getLinker
Description copied from interface:ExternalResource
Returns the linker instance for this particular resource.- Specified by:
getLinker
in interfaceExternalResource
- Specified by:
getLinker
in classSemanticWordRelationDictionary
- Returns:
- The specific linker used to link words to concepts.
-
getName
Description copied from interface:ExternalResource
Obtain the name of the resource.- Specified by:
getName
in interfaceExternalResource
- Specified by:
getName
in classSemanticWordRelationDictionary
- Returns:
- Name of the resource.
-