| search-class {act} | R Documentation |
Search object
Description
This object defines the properties of a search in act. It also contains the results of this search in a specific corpus, if the search has already been run. (Note that you can also create a search without running it immediately). A search object can be run on different corpora.
Some of the slots are defined by the user.
Other slots are [READ ONLY], which means that they can be accessed by the user but
should not be changed. They contain values that are filled when you execute functions
on the object.
Slots
nameCharacter string; name of the search. Will be used, for example, as name of the sub folder when creating media cuts
patternCharacter string; search pattern as a regular expression.
search.modeCharacter string; defines if the original contents of the annotations should be searched or if the full texts should be searched. Slot takes the following values:
content,fulltext(=default, includes both full text modes),fulltext.byTime,fulltext.byTier.search.normalizedlogical. if
TRUEthe normalized annotations will be used for searching.resultid.prefixCharacter string; search results will be numbered consecutively; This character string will be placed before the consecutive numbers.
resultid.startInteger; search results will be numbered consecutively; This is the start number of the identifiers.
filter.transcript.namesVector of character strings; names of transcripts to include in the search. If the value is
character()or""filter will be ignored.filter.transcript.includeRegExCharacter string; Regular expression that defines which transcripts should be INcluded in the search (matching the name of the transcript).
filter.transcript.excludeRegExCharacter string; Regular expression that defines which transcripts should be EXcluded in the search (matching the name of the transcript).
filter.tier.namesVector of character strings; names of tiers to include in the search. If the value is
character()or""filter will be ignored.filter.tier.includeRegExCharacter string; Regular expression that defines which tiers should be INcluded in the search (matching the name of the tier).
filter.tier.excludeRegExCharacter string; Regular expression that defines which tiers should be EXcluded in the search (matching the name of the tier).
filter.section.startsecDouble; Time value in seconds, limiting the search to a certain time span in each transcript, defining the start of the search window.
filter.section.endsecDouble; Time value in seconds, limiting the search to a certain time span in each transcript, defining the end of the search window.
concordance.makeLogical; If a concordance should be created when the search is run.
concordance.widthInteger; number of characters to include in the concordance.
cuts.span.beforesecDouble; Seconds how much the cuts (media and print transcripts) should start before the start of the search hit.
cuts.span.aftersecDouble; Seconds how much the cuts (media and print transcripts) should end after the end of the search hit.
cuts.column.srtCharacter string; name of destination column in the search results data frame where the srt substitles will be inserted; column will be created if not present in data frame; set to "" for no insertion.
cuts.column.printtranscriptCharacter string; name of destination column in the search results data frame where the print transcripts will be inserted; column will be created if not present in data frame; set to "" for no insertion.
cuts.printtranscriptsCharacter string;
[READ ONLY]All print transcripts for the search results (if generated previously)cuts.cutlist.macCharacter string;
[READ ONLY]'FFmpeg' cut list for use on a Mac, to cut the media files for the search results.cuts.cutlist.winCharacter string;
[READ ONLY]'FFmpeg' cut list for use on Windows, to cut the media files for the search results.resultsData.frame; Results of the search.1
results.nrInteger;
[READ ONLY]Number of search results.results.tiers.nrInteger;
[READ ONLY]Number of tiers over which the search results are distrubuted.results.transcripts.nrInteger;
[READ ONLY]Number of transcripts over which the search results are distrubuted.x.nameCharacter string;
[READ ONLY]name of the corpus object on which the search has been run.
Examples
library(act)
# Search for the 1. Person Singular Pronoun in Spanish.
mysearch <- act::search_new(examplecorpus, pattern= "yo")
mysearch
# Search in normalized content vs. original content
mysearch.norm <- act::search_new(examplecorpus, pattern="yo", searchNormalized=TRUE)
mysearch.org <- act::search_new(examplecorpus, pattern="yo", searchNormalized=FALSE)
mysearch.norm@results.nr
mysearch.org@results.nr
# The difference is because during normalization capital letters will be converted
# to small letters. One annotation in the example corpus contains a "yo" with a
# capital letter:
mysearch <- act::search_new(examplecorpus, pattern="yO", searchNormalized=FALSE)
mysearch@results$hit
# Search in full text vs. original content.
# Full text search will find matches across annotations.
# Let's define a regular expression with a certain span.
# Search for the word "no" 'no' followed by a "pero" 'but'
# in a distance ranging from 1 to 20 characters.
myRegEx <- "\\bno\\b.{1,20}pero"
mysearch <- act::search_new(examplecorpus, pattern=myRegEx, searchMode="fulltext")
mysearch
mysearch@results$hit