get graph (co-occurrence of entities and/or grammar class)
Source:R/search_words_in_graph.R
get_cooc.Rdfrom 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")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.