lastMentionUnit | R Documentation |
See also countCompetitors.
lastMentionUnit(
unitSeq = NULL,
chain = NULL,
exclFrag = F,
combinedChunk = NULL,
nonFragmentMember = F
)
unitsToLastMention(
unitSeq = NULL,
chain = NULL,
exclFrag = F,
combinedChunk = NULL,
nonFragmentMember = F
)
lastMentionToken(
tokenOrder = NULL,
chain = NULL,
exclFrag = F,
combinedChunk = NULL,
nonFragmentMember = F
)
tokensToLastMention(
tokenOrder = NULL,
chain = NULL,
zeroProtocol = "literal",
zeroCond = NULL,
unitSeq = NULL,
unitTokenSeqName = NULL,
unitDF = NULL,
exclFrag = F,
combinedChunk = NULL,
nonFragmentMember = F
)
countPrevMentions(
windowSize,
unitSeq = NULL,
chain = NULL,
exclFrag = F,
combinedChunk = NULL,
nonFragmentMember = F
)
countPrevMentionsIf(
windowSize,
cond,
unitSeq = NULL,
chain = NULL,
exclFrag = F,
combinedChunk = NULL,
nonFragmentMember = F
)
countPrevMentionsMatch(
windowSize,
field,
unitSeq = NULL,
chain = NULL,
exclFrag = F,
combinedChunk = NULL,
nonFragmentMember = F
)
getPrevMentionField(
field,
tokenOrder = NULL,
chain = NULL,
exclFrag = F,
combinedChunk = NULL,
nonFragmentMember = F
)
nextMentionUnit(
unitSeq = NULL,
chain = NULL,
exclFrag = F,
combinedChunk = NULL,
nonFragmentMember = F
)
unitsToNextMention(
unitSeq = NULL,
chain = NULL,
exclFrag = F,
combinedChunk = NULL,
nonFragmentMember = F
)
nextMentionToken(
tokenOrder = NULL,
chain = NULL,
exclFrag = F,
combinedChunk = NULL,
nonFragmentMember = F
)
tokensToNextMention(
tokenOrder = NULL,
chain = NULL,
zeroProtocol = "literal",
zeroCond = NULL,
unitSeq = NULL,
unitTokenSeqName = NULL,
unitDF = NULL,
exclFrag = F,
combinedChunk = NULL,
nonFragmentMember = F
)
countNextMentions(
windowSize,
unitSeq = NULL,
chain = NULL,
exclFrag = F,
combinedChunk = NULL,
nonFragmentMember = F
)
countNextMentionsIf(
windowSize,
cond,
unitSeq = NULL,
chain = NULL,
exclFrag = F,
combinedChunk = NULL,
nonFragmentMember = F
)
countNextMentionsMatch(
windowSize,
field,
unitSeq = NULL,
chain = NULL,
exclFrag = F,
combinedChunk = NULL,
nonFragmentMember = F
)
getNextMentionField(
field,
tokenOrder = NULL,
chain = NULL,
exclFrag = F,
combinedChunk = NULL,
nonFragmentMember = F
)
countPrevBridges(
windowSize,
frameMatrix,
unitSeq = NULL,
chain = NULL,
inclRelations = NULL
)
unitSeq |
The vector of tokenOrder values where the mentions appeared. You can choose tokenOrderFirst, tokenOrderFirst, or maybe an average of the two. By default it's tokenOrderFirst. |
chain |
The chain that each mention belongs to. |
exclFrag |
Exclude 'fragments' (i.e. members of a combined chunk which do not serve as meaningful chunks in their own right) |
combinedChunk |
The |
nonFragmentMember |
Vector indicating whether each entry is a non-fragment member, i.e. a member of a combined chunk that also serves as a meaningful chunk in its own right. |
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. |
zeroProtocol |
If |
zeroCond |
A condition for determining whether a token is zero. For most people, this should be |
unitTokenSeqName |
The name of the corresponding tokenSeq column in the unit column. By default, |
windowSize |
The size of the window in which you will be counting. |
cond |
For if functions, the condition that the previous / next mention must satisfy. It cannot refer to the current mention. |
field |
The field whose value you want to match or extract. |
The default values do not work with case_when()
. I am still figuring out why. In the meantime, please specify unitSeq
, combinedchunk
etc. within case_when()
.
sbc007 = addUnitSeq(sbc007, "track")
#Get the number of units to the last mention
sbc007$trackDF$default = sbc007$trackDF$default %>%
rez_mutate(unitsToLastMention = unitsToLastMention(unitSeqLast))
#Get the number of words to the last mention
sbc007$trackDF$default = sbc007$trackDF$default %>%
rez_mutate(wordsToLastMention = tokensToLastMention(
docWordSeqLast, #What seq to use
zeroProtocol = "unitFinal", #How to treat zeroes
zeroCond = (text == "<0>"),
unitDF = sbc007$unitDF)) #Additional argument for unitFinal protocol
#Get the character length of the previous mention
sbc007$trackDF$default = sbc007$trackDF$default %>%
addFieldLocal(fieldName = "prevLength",
expression = nchar(getPrevMentionField(text)),
fieldaccess = "auto")
#Get the number of zero mentions and zero status-matching mentions in the last 20 units
sbc007$trackDF$default %>%
rez_mutate(isZero = text == "<0>") %>%
rez_mutate(noPrevZeroMentionsIn20 = countPrevMentionsIf(20, isZero),
noPrevZeroMentionsIn20 = countPrevMentionsMatch(20, isZero))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.