Skip to content

Commit

Permalink
Update topic_assistant2.py
Browse files Browse the repository at this point in the history
  • Loading branch information
yovisto committed Oct 4, 2022
1 parent 43659f7 commit 3ed4f28
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/topic_assistant2.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def __init__(self):
#find top level node
for s, p, o in g.triples((None, RDF.type, SKOS.ConceptScheme)):
#print (s, p, o)
tree.create_node("WLO", s, data={'w':0, 'uri': s})
tree.create_node("WLO", s, data={'w':0, 'uri': str(s)})
for s2, p2, o2 in g.triples((s, SKOS.hasTopConcept, None)):
#print (s2, p2, o2)
tree.create_node(o2, o2, parent=s, data={'w':0, 'uri': str(o2)})
Expand All @@ -83,7 +83,7 @@ def __init__(self):
for node in tree.all_nodes():
for s, p, o in g.triples(( URIRef(node.identifier) , SKOS.prefLabel, None)):
node.tag=o
node.data['label']=o
node.data['label']=str(o)


# collect the "index terms" from keywords, preflabels, and discipline labels
Expand Down Expand Up @@ -117,6 +117,14 @@ def __init__(self):
except:
keywords[s]=[n]

# collect descriptions
#for s, p, o in g.triples((None, SKOS.definition, None)):
# try:
# keywords[s].append(self.normalize(str(o)))
# except:
# keywords[s]=[self.normalize(str(o))]


self.keywords = keywords
self.tree = tree
self.model = SentenceTransformer('all-mpnet-base-v2')
Expand Down

0 comments on commit 3ed4f28

Please sign in to comment.