Autocomplete

Autocomplete[{"string1","string2",},"string"]

gives a list of the stringi that can complete string.

Autocomplete["s1"w1,"s2"w2,,"string"]

puts the completions in order of decreasing weights wi.

Autocomplete[{assoc1,assoc2,},"string"]

uses completions specified by the associations associ.

Autocomplete[comps,"string",n]

gives the first at most n completions.

Autocomplete[comps]

gives an AutocompletionFunction[] that can be applied to a string.

Details

  • In the form Autocomplete[{assoc1,}], possible elements in the associ include:
  • "Result"the result to return
    "String"the complete string
    "Weight"weight used to sort completions

Examples

Basic Examples  (2)

Create an AutocompletionFunction from a list of words:

Apply the function to a string:

Limit the number of results:

Perform the above operations in a single step:

Words can be assigned weights:

When only "String" and "Weight" are used, it is possible to use a more compact form:

If the key "Result" is present, the resulting string will be modified accordingly:

Fields do not always have to be specified:

Wolfram Research (2015), Autocomplete, Wolfram Language function, https://reference.wolfram.com/language/ref/Autocomplete.html.

Text

Wolfram Research (2015), Autocomplete, Wolfram Language function, https://reference.wolfram.com/language/ref/Autocomplete.html.

CMS

Wolfram Language. 2015. "Autocomplete." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/Autocomplete.html.

APA

Wolfram Language. (2015). Autocomplete. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Autocomplete.html

BibTeX

@misc{reference.wolfram_2024_autocomplete, author="Wolfram Research", title="{Autocomplete}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/Autocomplete.html}", note=[Accessed: 21-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_autocomplete, organization={Wolfram Research}, title={Autocomplete}, year={2015}, url={https://reference.wolfram.com/language/ref/Autocomplete.html}, note=[Accessed: 21-November-2024 ]}