kgdata.wikidata.datasets.entity_pagerank#

Functions

entity_pagerank([lang])

Generate a weighted graph of Wikidata's entities.

get_edges(ent)

kv_tab_deser(o)

tab_deser(o)

tab_ser(a)

update_edge_ids_source(joined_result)

update_edge_ids_target(joined_result)

Classes

Edge(source, target, weight)

class Edge(source: KeyType, target: KeyType, weight: int)[source]#

Bases: Generic[KeyType]

Parameters:
  • source (KeyType) –

  • target (KeyType) –

  • weight (int) –

source: KeyType#
target: KeyType#
weight: int#
serialize()[source]#
static deserialize_str(o: str)[source]#
Parameters:

o (str) –

static deserialize_int(o: str)[source]#
Parameters:

o (str) –

entity_pagerank(lang: str = 'en') Dataset[Tuple[str, float]][source]#

Generate a weighted graph of Wikidata’s entities. The graph can be used to calculate page rank to determine entity popularity

Parameters:

lang (str) –

Return type:

Dataset[Tuple[str, float]]

get_edges(ent: WDEntity) List[Edge][source]#
Parameters:

ent (WDEntity) –

Return type:

List[Edge]

update_edge_ids_source(joined_result: Tuple[str, Tuple[Iterable[Edge], Optional[str]]])[source]#
Parameters:

joined_result (Tuple[str, Tuple[Iterable[Edge], Optional[str]]]) –

update_edge_ids_target(joined_result: Tuple[str, Tuple[Iterable[Edge], Optional[str]]])[source]#
Parameters:

joined_result (Tuple[str, Tuple[Iterable[Edge], Optional[str]]]) –

tab_ser(a: Sequence)[source]#
Parameters:

a (Sequence) –

tab_deser(o: str)[source]#
Parameters:

o (str) –

kv_tab_deser(o: str)#
Parameters:

o (str) –