]> gitweb.factorcode.org Git - factor.git/blob - basis/suffix-arrays/suffix-arrays-docs.factor
Switch to https urls
[factor.git] / basis / suffix-arrays / suffix-arrays-docs.factor
1 ! Copyright (C) 2008 Marc Fauconneau.
2 ! See https://factorcode.org/license.txt for BSD license.
3 USING: arrays help.markup help.syntax io.streams.string
4 sequences strings math suffix-arrays.private ;
5 IN: suffix-arrays
6
7 HELP: >suffix-array
8 { $values
9     { "seq" sequence }
10     { "suffix-array" array } }
11 { $description "Creates a suffix array from the input sequence. Suffix arrays are arrays of slices." } ;
12
13 HELP: SA{
14 { $description "Creates a new literal suffix array at parse-time." } ;
15
16 HELP: suffixes
17 { $values
18     { "string" string }
19     { "suffixes-seq" "a sequence of slices" } }
20 { $description "Returns a sequence of tail slices of the input string." } ;
21
22 HELP: query
23 { $values
24     { "begin" sequence } { "suffix-array" "a suffix-array" }
25     { "matches" array } }
26 { $description "Returns a sequence of sequences from the suffix-array that contain the input sequence. An empty array is returned when there are no matches." } ;
27
28 ARTICLE: "suffix-arrays" "Suffix arrays"
29 "The " { $vocab-link "suffix-arrays" } " vocabulary implements the suffix array data structure for efficient lookup of subsequences. This suffix array implementation is a sorted array of suffixes. Querying it for matches uses binary search for efficiency." $nl
30
31 "Creating new suffix arrays:"
32 { $subsections >suffix-array }
33 "Literal suffix arrays:"
34 { $subsections POSTPONE: SA{ }
35 "Querying suffix arrays:"
36 { $subsections query } ;
37
38 ABOUT: "suffix-arrays"