bridging: Functions related to bridging and frames.

lastBridgeUnitR Documentation

Functions related to bridging and frames.

Description

See also countCompetitors, trackPrevContext.

Usage

lastBridgeUnit(
  frameMatrix,
  unitSeq = NULL,
  chain = NULL,
  tokenOrderFirst = NULL,
  tokenOrderLast = NULL,
  inclRelations = NULL
)

unitsToLastBridge(
  frameMatrix,
  unitSeq = NULL,
  chain = NULL,
  tokenOrderLast = NULL,
  tokenOrderFirst = NULL,
  inclRelations = NULL
)

lastBridgeToken(
  frameMatrix,
  firstOrLast = "last",
  tokenOrderFirst = NULL,
  tokenOrderLast = NULL,
  chain = NULL,
  inclRelations = NULL
)

tokensToLastBridge(
  frameMatrix,
  firstOrLast = "last",
  tokenOrderFirst = NULL,
  tokenOrderLast = NULL,
  chain = NULL,
  zeroProtocol = "literal",
  zeroCond = NULL,
  unitSeq = NULL,
  unitDF = NULL,
  inclRelations = NULL
)

Arguments

unitSeq

The vector of units where the mentions appeared.

chain

The chain that each mention belongs to.

zeroProtocol

If 'literal', I will take the seq values of the zeroes at face value. (If you set zeros as non-words and use docWordSeqFirst or discourseWordSeLast as your tokenOrder, this will lead to meaningless values.) If 'unitFinal', I will treat zeroes as if they were the final word of the unit. If 'unitFirst', I will treat zeroes as if they were the first word of the unit.

zeroCond

A condition for determining whether a token is zero. For most people, this should be (word column) == "<0>".

tokenOrder

The vector of sequence values values where the mentions appeared. Common choices are docTokenSeqFirst, docTokenSeqLast, wordTokenSeqFirst and wordTokenseqLast (the last two are available after running addIsWordField on a rezrObj. By default it's docTokenSeqLast.

Examples

sbc007 = undupeLayers(sbc007, "trail", "name")
sbc007 = addUnitSeq(sbc007, "track")
sbc007 = addFrameMatrix(sbc007)
#(After exporting the frame matrix and editing it)
inpath = system.file("extdata", "rez007_frame_edited.csv", package = "rezonateR")
newFrame = rez_read_csv(inpath, origDF = frameMatrix(sbc007))
frameMatrix(sbc007) = updateFrameMatrixFromDF(frameMatrix(sbc007), newFrame)
sbc007$trackDF$default = sbc007$trackDF$default %>%
  rez_mutate(bridgeDistUnit = unitsToLastBridge(frameMatrix(sbc007)),
             bridgeDistToken = tokensToLastBridge(frameMatrix(sbc007),
                                                  inclRelations = "individual-group"))

johnwdubois/rezonateR documentation built on Nov. 19, 2024, 11:17 p.m.