completeWord: Autocompletion of strings

Description Usage Arguments Details Value Examples

View source: R/completeWord.R

Description

Returns a character vector with the completed words

Usage

1
completeWord(tree, string)

Arguments

tree

an existing ternary search tree to search words in.

string

a string of characters to be completed.

Details

Searches recursively through the tree until all words starting with the specified string have been found, and stores them in a character vector.

Value

A vector of class 'character'.

Examples

1
2
3
fruitTree <- newTree(c("apple", "orange","apricot","cherry"))
fruits.ap <- completeWord(fruitTree, "ap")
fruits.ap

TSTr documentation built on May 1, 2019, 9:16 p.m.