R: Greedily match against a tree

greedy_match {triebeard} | R Documentation

## Greedily match against a tree

### Description

`greedy_match` accepts a trie and a character vector and returns the values associated with any key that is "greedily" (read: fuzzily) matched against one of the character vector entries.

### Usage

    greedy_match(trie, to_match)

### Arguments

`trie` | a trie object, created with `trie`
`to_match` | a character vector containing the strings to check against the trie's keys.

### Value

a list, the length of `to_match`, with each entry containing any trie values where the `to_match` element greedily matches the associated key. In the case that nothing was found, the entry will contain `NA`.

### See Also

`longest_match` and `prefix_match` for longest and prefix matching, respectively.

### Examples

    trie <- trie(keys = c("afford", "affair", "available", "binary", "bind", "blind"),
                       values = c("afford", "affair", "available", "binary", "bind", "blind"))
    greedy_match(trie, c("avoid", "bring", "attack"))

[Package triebeard version 0.3.0 Index]