search_sub {act}R Documentation

Add a sub search to a prior search

Description

This function starts from the results of a prior search and performs a sub search for a temporal co-occurence. In the sub search all results from the prior search will be checked. The sub search will check annotations in other tiers that temporally overlap with the original search result. Those annotation will be checked if they match a search pattern. If so, the search hit of the sub search will be added to a new column in the original search results data frame.

Usage

search_sub(
  x,
  s,
  pattern,
  searchMode = c("content", "fulltext", "fulltext.byTime", "fulltext.byTier"),
  searchNormalized = TRUE,
  filterTierIncludeRegEx = "",
  filterTierExcludeRegEx = "",
  destinationColumn = "subsearch",
  deleteLinesWithNoResults = FALSE,
  excludeHitsWithinSameTier = TRUE
)

Arguments

x

Corpus object.

s

Search object.

pattern

Character string; search pattern as regular expression

searchMode

Character string; takes the following values: content, fulltext (=default, includes both full text modes), fulltext.byTime, fulltext.byTier.

searchNormalized

Logical; if TRUE function will search in the normalized content, if FALSE function will search in the original content.

filterTierIncludeRegEx

Character string; limit search to tiers that match the regular expression

filterTierExcludeRegEx

Character string; limit search to tiers that match the regular expression

destinationColumn

Character string; name of column where results of sub search will be stored

deleteLinesWithNoResults

Logical; if TRUE search results will be deleted for which the sub search does not give any results

excludeHitsWithinSameTier

Logical; if TRUE the function will not add hits from the same tier as the original search result; if FALSE hits from the same tier as the original search result will be included.

Value

Search object.

See Also

search_new, search_run, search_makefilter

Examples

library(act)

# Lets search for instances where participants laugh together
# First search for annotations that contain laughter (in original content)
myRegEx <- "(\\brie\\b|\\briendo\\b)"
mysearch <- act::search_new(x=examplecorpus,
							pattern=myRegEx,
							searchNormalized = FALSE)
mysearch@results.nr

# Now perform sub search, also on laughs/laughing
test <- act::search_sub(x=examplecorpus,
						s=mysearch,
						pattern=myRegEx)

# Check the co-occurring search hits
test@results$subsearch

[Package act version 1.3.1 Index]