Naive prefix searching implementations.
collections
typing0
SubsequenceScan0
Subsequence search implementation based on scanning the possible sizes and checking the candidate subsequence's presence in a set.
This naive implementation is O(N) (hash checks and subsequence) worst case for first match, so it is inappropriate for large sets.
However, when used as part of a tree where the sequence is kept small, it may be a reasonable implmentation selection.
SubsequenceScanProperties
- sequences
The set of sequences that will be scanned by matches.
SubsequenceScan__init__0
__init__(self, sequences, offset, order)
Create a SubsequenceScan from the given set of sequences.
SubsequenceScan__init__Parameters
sequencestyping.Sequence[typing.Hashable]
A sequence of sequences to scan. Usually, a list of str instances. This is transformed into a set of sequences.
SubsequenceScanadd0
add(self, *values)
Add new values to the set of sequences.
| WARNING | |
Implementation reconstructs the sizes sequence every call. |
SubsequenceScandiscard0
discard(self, *values)
Remove values from the set of sequences.
| WARNING | |
Implementation reconstructs the sizes sequence every call. |
SubsequenceScanmatches0
matches(self, key)
Identify all strings in the set that match the given key based on the configured offset.
SubsequenceScanget166%
get(self, key)
SubsequenceScan__contains__0
__contains__(self, key)
SubsequenceScan__getitem__0
__getitem__(self, key)
Get the first match in the set of strings.
SubsequenceScanvalues0
values(self)
SubsequenceScankeys10%
keys(self)