7 sequences - Sequence manipulation procedures
Copyright 2005, 2006, 2007, 2008, 2009, 2010 by Damir Ćavar, Petar Garžina, Larisa Grčić, Tanja Gulan, Damir Kero, Robert Paleka, Franjo Pehar, Pavle Valerjev
(require nltk/sequences) |
The nltk/sequences module provides procedures for the generation and manipulation of sequences, that is lists, vectors or strings.
7.1 Sequences Emumeration procedures
Returns a list of an integer progression delimited by the n parameter, starting from 0 (the default value) or otherwise the optional parameter from. The increment of the progression defaults to 1, and can be specified with the optional step parameter.
This procedure is a simplified version of the iota procedure in the SRFI library.
Returns a vector of an integer progression delimited by the n parameter, starting from 0 (the default value) or otherwise the optional parameter from. The increment of the progression defaults to 1, and can be specified with the optional step parameter.
This procedure corresponds to the procedure enum-list, except with respect to the returned data type.
7.2 Sequences Permutation procedures
Returns a list of all possible permutations of elements in the seq parameter. If the variable seq is a string, the resulting list of permutations contains lists of elements of the type character. If the variable seq refers to a list or vector of elements, a list of all permutations of these elements is returned.
The number of returned permutations is exactly n!, where n is the number of elements in seq, or the length of the string that seq might refer to. Depending on the number of tokens or characters, this procedure can potentially claim a significant portion of memory for runtime and results, and is thus to be handled with care.
Returns a vector of all possible permutations of elements in the seq parameter. If the variable seq is a string, the resulting vector of permutations contains vectors of elements of the type character. If the variable seq refers to a list or vector of elements, a vector of all permutations of these elements is returned.
See sequence->permutations-list for further details.