browse_hits: View hits in a browser

View source: R/print_text.r

browse_hitsR Documentation

View hits in a browser

Description

Creates a static HTML file to view the query hits in the tcorpus in full text mode.

Usage

browse_hits(
  tc,
  hits,
  token_col = "token",
  n = 500,
  select = c("first", "random"),
  header = "",
  subheader = NULL,
  meta_cols = NULL,
  seed = NA,
  view = T,
  filename = NULL
)

Arguments

tc

a tCorpus

hits

a featureHits object, as returned by search_features

token_col

The name of the column in tc$tokens that contain the token text

n

If doc_ids is NULL, Only n of the results are printed (to prevent accidentally making huge browsers).

select

If n is smaller than the number of documents in tc, select determines how the n documents are selected

header

Optionally, a title presented at the top of the browser

subheader

Optionally, overwrite the subheader. By default the subheader reports the number of documents

meta_cols

A character vector with names of columns in tc$meta, used to only show the selected columns

seed

If select is "random", seed can be used to set a random seed

view

If TRUE (default), view the browser in the Viewer window (turn off if this is not supported)

filename

Optionally, save the browser at a specified location

Value

The url for the file location is returned (invisibly)

Examples


tc = create_tcorpus(sotu_texts, doc_column='id')
hits = search_features(tc, c("Terrorism# terroris*", "War# war*"))
browse_hits(tc, hits)


corpustools documentation built on May 31, 2023, 8:45 p.m.