Skip to content

Instantly share code, notes, and snippets.

{
"mentions": [
{
"name": "Robinson College",
"type": "string",
"start": "2898",
"end": "2914",
"context": "char=0,5253",
"uri": "https://en.wikipedia.org/wiki/The_New_York_Times"
},
# coding: utf-8
# In[163]:
import codecs
from collections import defaultdict
tweets = defaultdict()
with io.open('/Users/xi/Downloads/NEEL2016-training.tsv', encoding='utf-8') as tw:
NIL138
['Alan', 'Jasons', 'goonergang']
NIL143
['jfalconer', 'HopticalA', 'Alex']
NIL840
['BestProNews']
NIL18
@torch.no_grad()
def buildSubgraph(self, head_index: Tensor, rel_type: Tensor, tail_index: Tensor) -> Tensor:
k = self.neighbors_topk # Number of top tails to find
M = self.neighbors_size
# Initialize a dictionary to store unique objects the triples
unique_nodes = {(h.item(), r.item(), t.item()): set()
for h, r, t in zip(head_index, rel_type, tail_index)}
# local utility that uses the KGE to find the nearest nodes.