aregexec(utils)
aregexec()所属R语言包:utils
Approximate String Match Positions
近似字符串匹配的位置
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Determine positions of approximate string matches.
确定近似字符串匹配的位置。
用法----------Usage----------
aregexec(pattern, text, max.distance = 0.1, costs = NULL,
ignore.case = FALSE, fixed = FALSE, useBytes = FALSE)
参数----------Arguments----------
参数:pattern
a non-empty character string or a character string containing a regular expression (for fixed = FALSE) to be matched. Coerced by as.character to a string if possible.
一个非空字符串或一个字符串,包含要匹配一个正则表达式(fixed = FALSE)。强制由as.character如果可能的字符串。
参数:text
character vector where matches are sought. Coerced by as.character to a character vector if possible.
特征向量寻求匹配。 as.character裹挟如果可能的特征向量。
参数:max.distance
maximum distance allowed for a match. See agrep.
允许的最大距离为比赛。看到agrep。
参数:costs
cost of transformations. See agrep.
转换成本。看到agrep。
参数:ignore.case
a logical. If TRUE, case is ignored for computing the distances.
一个逻辑。如果TRUE,计算距离的情况下被忽略。
参数:fixed
If TRUE, the pattern is matched literally (as is). Otherwise (default), it is matched as a regular expression.
如果TRUE,模式匹配字面上()。否则(默认),它作为一个正则表达式匹配。
参数:useBytes
a logical. If TRUE comparisons are byte-by-byte rather than character-by-character.
一个逻辑。如果TRUE比较字节逐字节而不是字符字符。
Details
详情----------Details----------
aregexec provides a different interface to approximate string matching than agrep (along the lines of the interfaces to exact string matching provided by regexec and grep).
aregexec提供不同的接口,以近似字符串匹配比agrep(沿线接口的确切字符串匹配regexec和grep的)。
Note that by default, agrep performs literal matches, whereas aregexec performs regular expression matches.
请注意,默认情况下,agrep执行字面的匹配,而aregexec执行正则表达式匹配。
See agrep and adist for more information about approximate string matching and distances.
看到agrep和adist近似字符串匹配和距离的更多信息。
Comparisons are byte-by-byte if pattern or any element of text is marked as "bytes".
如果pattern或text的任何元素被标记为"bytes"比较字节逐字节。
值----------Value----------
A list of the same length as text, each element of which is either -1 if there is no match, or a sequence of integers with the starting positions of the match and all substrings corresponding to parenthesized subexpressions of pattern, with attribute "match.length" an integer vector giving the lengths of the matches (or -1 for no match).
列表的长度相同text,其中每个元素是要么-1如果有不匹配,或在比赛的开始位置和所有子对应括号的子表达式的一个整数序列pattern,属性与"match.length"整数向量,使比赛的长度(或-1不匹配)。
参见----------See Also----------
regmatches for extracting the matched substrings.
regmatches提取匹配的子字符串。
举例----------Examples----------
## Cf. the examples for agrep.[#CF。 agrep的例子。]
x <- c("1 lazy", "1", "1 LAZY")
aregexec("laysy", x, max.distance = 2)
aregexec("(lay)(sy)", x, max.distance = 2)
aregexec("(lay)(sy)", x, max.distance = 2, ignore.case = TRUE)
m <- aregexec("(lay)(sy)", x, max.distance = 2)
regmatches(x, m)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|