MCPcopy
hub / github.com/HIT-SCIR/ltp / get_graph_entities

Method get_graph_entities

python/interface/ltp/nerual.py:450–460  ·  view source on GitHub ↗
(rarcs, rels, labels)

Source from the content-addressed store, hash-verified

448
449 @staticmethod
450 def get_graph_entities(rarcs, rels, labels):
451 sequence_num = rels.shape[0]
452 arcs = torch.nonzero(rarcs, as_tuple=False).cpu().detach().numpy().tolist()
453 rels = rels.cpu().detach().numpy()
454
455 res = [[] for _ in range(sequence_num)]
456 for idx, arc_s, arc_e in arcs:
457 label = labels[rels[idx, arc_s, arc_e]]
458 res[idx].append((arc_s, arc_e, label))
459
460 return res
461
462 @classmethod
463 def _from_pretrained(

Callers 1

_sdp_postMethod · 0.95

Calls 1

cpuMethod · 0.80

Tested by

no test coverage detected