|
1 | 1 | #' Stringdist-based fuzzy text search |
2 | 2 | #' |
3 | 3 | #' \code{afind} slides a window of fixed width over a string \code{x} and |
4 | | -#' computes the distance between thecurrent window and the sought-after |
| 4 | +#' computes the distance between theeach window and the sought-after |
5 | 5 | #' \code{pattern}. The location, content, and distance corresponding to the |
6 | 6 | #' window with the best match is returned. |
7 | 7 | #' |
8 | 8 | #' |
9 | | -#' @param x \code{[character]} strings to search in |
10 | | -#' @param pattern \code{[character]} strings to find (not a regular expression). |
11 | | -#' @param window \code{[integer]} width of moving window |
12 | | -#' @param value \code{[logical]} toggle return matrix with matched strings. |
| 9 | +#' @param x strings to search in |
| 10 | +#' @param pattern strings to find (not a regular expression). For \code{grab}, |
| 11 | +#' \code{grabl}, and \code{extract} this must be a single string. |
| 12 | +#' @param window width of moving window. |
| 13 | +#' @param value toggle return matrix with matched strings. |
13 | 14 | #' @inheritParams amatch |
14 | 15 | #' |
15 | 16 | #' @details |
|
39 | 40 | #' |
40 | 41 | #' |
41 | 42 | #' @return |
42 | | -#' For \code{afind} A \code{list} of three matrices, each of with \code{length(x)} rows and \code{length(pattern)} |
43 | | -#' columns. In each matrix, element \eqn{(i,j)} corresponds to \code{x[i]} and \code{pattern[j]}. |
| 43 | +#' For \code{afind}: a \code{list} of three matrices, each with |
| 44 | +#' \code{length(x)} rows and \code{length(pattern)} columns. In each matrix, |
| 45 | +#' element \eqn{(i,j)} corresponds to \code{x[i]} and \code{pattern[j]}. The |
| 46 | +#' names and description of each matrix is as follows. |
44 | 47 | #' \itemize{ |
45 | 48 | #' \item{\code{location}. \code{[integer]}, location of the start of best matching window. |
46 | 49 | #' When \code{useBytes=FALSE}, this corresponds to the location of a \code{UTF} code point |
|
60 | 63 | #' , "I want to be a fisherman") |
61 | 64 | #' patterns = c("fish", "gone","to be") |
62 | 65 | #' |
63 | | -#' afind(texts, patterns, method="cosine", q=3) |
| 66 | +#' afind(texts, patterns, method="running_cosine", q=3) |
| 67 | +#' |
| 68 | +#' grabl(texts,"grew", maxDist=1) |
| 69 | +#' extract(texts, "harvested", maxDist=3) |
64 | 70 | #' |
65 | 71 | #' |
66 | 72 | #' @export |
|