kindred.CandidateBuilder

class kindred.CandidateBuilder(entityCount=2, acceptedEntityTypes=None)[source]

Generates set of all possible relations in corpus.

Variables:
  • entityCount – Number of entities in each relation (default=2)
  • acceptedEntityTypes – Tuples of entities that candidate relations must match. Each entity should be the same length as entityCount. None will match all candidate relations.

Methods

__init__(entityCount=2, acceptedEntityTypes=None)[source]

Constructor

Parameters:
  • entityCount (int) – Number of entities in each relation (default=2)
  • acceptedEntityTypes (list of tuples) – Tuples of entities that candidate relations must match. Each entity should be the same length as entityCount. None will match all candidate relations.
build(corpus)[source]

Creates the set of all possible relations that exist within the given corpus. Each relation will be contained within a single sentence.

Parameters:corpus (kindred.Corpus) – Corpus of text with which to build relation candidates
Returns:List of candidate relations matching entityCount and acceptedEntityTypes
Return type:List of kindred.Relation