Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Data shapes

The functions pass plain Python lists and dicts. This page lists the keys of each shape, so that you can read the results in your own code or in pandas.

A sentence

One item of harvest(...)["sentences"].

KeyMeaning
doc_idthe file name without .pdf
pagethe page number
sent_ida unique id, for example d000p0012s003
sectionthe last heading before the sentence
rawthe sentence as the sentence splitter gave it
cleanthe sentence that causenet() reads
flag"", "front_matter", "fragment" or "long"
doi, titlethe paper, or ""

A dropped row

One item of harvest(...)["dropped"]: doc_id, page, section, drop_reason and text.

A relation

One item of the list that causenet() returns.

KeyMeaning
rel_ida unique id, for example d000p0012s003r01
sent_id, doc_id, pagefrom the sentence
cause, effectthe two spans, in lowercase
sentencethe clean sentence
doi, titlethe paper, or ""

Groups

The result of clusterer() and pairwise_grouping(), keyed by the span:

{"loneliness": {"group": 4, "central": "address loneliness"},
 "levels of loneliness": {"group": 4, "central": "address loneliness"}}

A noise span of clusterer() has the group -1.

Names

The result of label_groups(), keyed by the group id (or by the span, for a noise span):

{4: {"central": "address loneliness", "size": 6,
     "members": ["loneliness", "levels of loneliness", ...],
     "keywords": [("loneliness", 0.91), ...],
     "name": "loneliness levels address"}}

standardize_groups() and standardize_constructs() give each group or span a list of thesaurus matches, best first. See their reference pages.

The causal map

causal_map() returns a dict with six keys:

KeyWhat it holds
nodes{node_id: node}
edgesthe list of shown edges
hiddenthe list of hidden edges, each with its drop_reason
relations{rel_id: relation}, the relations behind the edges
papersone row per paper: doc_id, doi, title
settingsmin_papers, min_sentences, min_share

A node:

KeyMeaning
node_id, labelthe id and the name of the node
membersthe spans in the node
as_cause, as_effectthe sentences of the shown edges that start at the node, and that end at it
n_sentencesas_cause plus as_effect
n_papersthe papers of the shown edges that touch the node
rolecause only, effect only or cause and effect; "" when no shown edge touches the node
shownTrue when a shown edge touches the node

The counts use the shown edges only. A filter that hides an edge also lowers the counts of its nodes.

An edge: edge_id, source, target, n_papers, n_sentences, n_relations, rel_ids, doc_ids, direction, reciprocal, self_loop and drop_reason. See The causal map for their meaning.