concord: Produce a concordance.

Description Usage Arguments Value See Also Examples

Description

Produces a concordance of a regular expression and returns a data frame.

Usage

1
2
concord(text, pattern, ignore_case = TRUE, locations = FALSE,
  extra_context = 0, shorten = 0)

Arguments

text

The text to search in, as either a character vector or a list of character vectors.

pattern

The Perl-compartible regular expression to search for.

ignore_case

If ignore_case = TRUE (the default), a case-insensitive search is performed.

locations

If locations = TRUE, the element indexes with matches are returned.

extra_context

If positive, specifies the number of additional lines around the lines with matches to return. Useful if not enough context is given in the lines with matches.

shorten

If positive, truncates the preceding and following contexts to the number of characters specified. Useful if too much context is given in the lines with matches, for example, in texts with (very) long paragraphs.

Value

A data frame.

See Also

Stefan Th. Gries' function exact.matches().

Examples

1
2
3
4
5
6
7
8
concord("hello", "e")
concord("some sentence here", "sentence")
concord("some sentence here", "s[eo]")

text <- c("first sentence here", "short paragraph here", "third line here")
concord(text, "e[nr]", locations = TRUE)
concord("some sentence here", "e(?=r)")
concord("some sentence here", "e(?!n)")

ekbrown/corpling documentation built on May 16, 2019, 2:24 a.m.