Retrieve context for a Term or an Expression context

get_context(object, ...)

# S4 method for Collection
get_context(object)

# S4 method for Expression
get_context(object)

# S4 method for Term
get_context(object)

Arguments

object

Either: a single Term or Expression class object OR a Collection containing Term or Expression class objects

Value

list containing different contexts

See also

This page for more information about contexts and expressions

This page for more information about contexts and terms

Examples

# NOT RUN {
###### FOR TERMS

# Fingerprint a term
trm_fp <- do_fingerprint_term("finance")

# Get contexts
trm_fp_cont <- get_context(trm_fp)

###### FOR EXPRESSIONS

# Get data
data("company_descriptions")

# Put text in a list to be fingerprinted as expression
txt <- lapply(company_descriptions, function(x) list("text" = x$desc))
# Must be an unnamed list
txt <- unname(txt)

# Fingerprint as expression
txt_fp <- do_fingerprint_expression(txt)

# Get contexts
txt_fp_cont <- get_context(txt_fp[[1]])

###### FOR COLLECTIONS

# Get data
data("company_descriptions")

# Put text in a list
txt <- lapply(company_descriptions, function(x) list("text" = x$desc))
# Must be an unnamed list
txt <- unname(txt)

# Fingerprint as expression
txt_fp <- do_fingerprint_expression(txt)

# Get contexts
# This takes quite a while
txt_fp_cont <- get_context(txt_fp, type = "Expression")

# }