gransk.plugins.analysis

Compute useful things from stuff.

gransk.plugins.analysis.entity_network

class gransk.plugins.analysis.entity_network.Subscriber(pipeline)

Bases: gransk.core.abstract_subscriber.Subscriber

Class computing network surrounding an entity.

Add subscriber to pipeline.

Parameters:pipeline (gransk.core.pipeline.Pipeline) – Pipeline managing subscribers and events.
consume(doc, payload)

Ignored.

get_for(entity_id, hops=1)

Get network around the given entity ID.

Parameters:
  • entity_id (str) – Entity to get network for.
  • hops (int) – Maximum distance of included nodes from the given entity.
Returns:

dict

setup(config)

Loads services for related entities and documents.

Parameters:config (dict) – Configuration object.

gransk.plugins.analysis.related_documents

class gransk.plugins.analysis.related_documents.Subscriber(pipeline)

Bases: gransk.plugins.analysis.abstract_related.Subscriber

Class for finding related documents based on the entities they have in common.

Add subscriber to pipeline.

Parameters:pipeline (gransk.core.pipeline.Pipeline) – Pipeline managing subscribers and events.
consume(doc, _)

Add all entities to the reference set.

Parameters:doc (gransk.core.document.Document) – Document object.

gransk.plugins.analysis.related_entities

class gransk.plugins.analysis.related_entities.Subscriber(pipeline)

Bases: gransk.plugins.analysis.abstract_related.Subscriber

Class for finding related entities based on the documents they have in common.

Add subscriber to pipeline.

Parameters:pipeline (gransk.core.pipeline.Pipeline) – Pipeline managing subscribers and events.
consume(doc, _)

Add document to each entity’s reference set.

Parameters:doc (gransk.core.document.Document) – Document object.