Skip to contents

from a POS dataframe (using `spacyr::spacy_parse()` or `parsePOS(only_entities = FALSE)` ) get the pairs of co-occurrences.

Usage

get_cooc(pos_df, pos_cat = c("NOUN", "ENTITY", "PROPN"), nodes = "lemma")

Arguments

pos_df

a POS dataframe

pos_cat

the POS categories to be extracted. (Default: NOUN, PROPN and ENTITY).

nodes

the name of the text column to be used as nodes. options: "token" and "lemma" Default: "lemma".

Examples

x <- txt_wiki |> filter_by_query("Police")
x <- x |> parsePOS(only_entities = FALSE)
get_cooc(x)
#> Error in graph_from_cooccurrence(pos2): All nodes are solitary. No graph pairs detected.