select_ngrams: Subset n-grams from node names

Description Usage Arguments Value Examples

View source: R/term_selection.R

Description

Selects only nodes from a graph whose node names are at least n-grams, where n is the minimum number of words in the node name. The default n-gram is a 2+-gram, which captures potential keyword terms that are at least two words long. The reason for this is that unigrams (terms with only one word) are detected more frequently, but are also generally less relevant to finding keyword terms.

Usage

1
select_ngrams(graph, n = 2, imp_method = "strength")

Arguments

graph

an igraph object

n

a minimum number of words in an n-gram

imp_method

a character specifying the importance measurement to be used; takes arguments of "strength", "eigencentrality", "alpha", "betweenness", "hub" or "power"

Value

a data frame of node names, strengths, and rank

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
dfm <- create_dfm(
  elements = c(
    "Cross-scale occupancy dynamics of a postfire specialist
    in response to variation across a fire regime",
    "Variation in home-range size of Black-backed Woodpeckers",
    "Black-backed woodpecker occupancy in burned and beetle-killed forests"
  ),
  features = c("occupancy", "variation", "black-backed woodpecker", "burn")
)

my_network <- create_network(
  search_dfm = as.matrix(dfm),
  min_studies = 1,
  min_occ = 1
)

select_ngrams(my_network, imp_method = "strength")
select_unigrams(my_network, imp_method = "strength")

elizagrames/litsearchr documentation built on April 14, 2021, 3:42 p.m.