Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I use sematch? #34

Open
fiego opened this issue Jul 29, 2021 · 0 comments
Open

How do I use sematch? #34

fiego opened this issue Jul 29, 2021 · 0 comments

Comments

@fiego
Copy link

fiego commented Jul 29, 2021

Q1: I need to calculate the similarity of other concepts. How do I use it? How do I generate this file(dbpedia_type_ic.txt')?
'''
#%% Computing semantic similarity of DBpedia concepts. from sematch.semantic.graph import DBpediaDataTransform, Taxonomy from sematch.semantic.similarity import ConceptSimilarity concept = ConceptSimilarity(Taxonomy(DBpediaDataTransform()),'models/dbpedia_type_ic.txt') concept.name2concept('actor') print(concept.similarity('http://dbpedia.org/ontology/Actor','http://dbpedia.org/ontology/Film', 'wpath'))

Q2: Run the following code, there is this error, how to solve?
ConnectionResetError: [Errno 104] Connection reset by peer
#%% Computing semantic similarity of DBpedia entities. from sematch.semantic.similarity import EntitySimilarity sim = EntitySimilarity() sim.similarity('http://dbpedia.org/resource/Madrid','http://dbpedia.org/resource/Barcelona') #0.409923677282 sim.similarity('http://dbpedia.org/resource/Apple_Inc.','http://dbpedia.org/resource/Steve_Jobs')#0.0904545454545 sim.relatedness('http://dbpedia.org/resource/Madrid','http://dbpedia.org/resource/Barcelona')#0.457984139871 sim.relatedness('http://dbpedia.org/resource/Apple_Inc.','http://dbpedia.org/resource/Steve_Jobs')#0.465991132787

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant