Skip to main content
hydraseq
--------
Simple data structure to remember sequences

Data structure composed of a trie embedded in dictiories for easy lookup. Keep track of sequences given and then return the next expected in a sequence if already seen.

## Installation
`pip install hydraseq`

## Example usage
Insert a sentence, and the query to see what the next word is if you submit part of the sentence. This basically rewinds the sentence up to that point and looks up what the next word would be.
```python
from hydraseq import Hydraseq

hdr = Hydraseq('main')

hdr.insert("The quick brown fox jumped over the lazy dog")

print(hdr.look_ahead("The quick brown").get_next_values())
> ['fox']
```

If you now insert a similar sentence, say use `wolf` instead of `fox`, the look ahead will return both.
```python

hdr.insert("The quick brown wolf jumped over the lazy dog")

print(hdr.look_ahead("The quick brown").get_next_values())

> ['fox', 'wolf']
```

## Stepping through word by word
The look_ahead rewinds from the start and stops at the last word, this is not too efficient. You can do a reset, rewinding the start and setp through word by word recovering which words are next.

```python
word = ["The"]
hdr.reset()
while word:
print(word)
word = hdr.hit(word[0]).get_next_values()

print(".")
>
>['The']
>['quick']
>['brown']
>['fox', 'wolf']
>['jumped']
>['over']
>['the']
>['lazy']
>['dog']
>.
```

## Checking state, without actually inserting new words.
Every time you use `insert` the sequence is remembered. If you just want to check what is next but make sure the insert doesn't cause new words to get remembered use the `is_learning=False` flag for both `insert` and `hit`


Release files for hydraseq 0.0.16

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hydraseq 0.0.16
File Size Uploaded
hydraseq-0.0.16.tar.gz 7.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hydraseq 0.0.16
File Interpreter ABI Platform
hydraseq-0.0.16-py3-none-any.whl Python 3 none any Details

Total release size: 17.6 kB

Release files / hydraseq-0.0.16.tar.gz

Download URL hydraseq-0.0.16.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
04fe3c3865552e4f593fed2f1e5b7ec760066e5d9fe2803957dd94f61192dbd9
BLAKE2b-256 checksum
How to use checksums
9966b4ce3b388928c1637b6a2806ffcd3227a3722b1e42be43bf6941d1283b17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/28.8.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.4.3

Release files / hydraseq-0.0.16-py3-none-any.whl

Download URL hydraseq-0.0.16-py3-none-any.whl
Size 10.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8e4c4c7bc91782024dc00102e769758b844250e2926d9954762738e936fa588a
BLAKE2b-256 checksum
How to use checksums
cd51389fd9dd168de9eadf31cb31580f0955752e62b96ae8f939a806592f9f3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/28.8.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.4.3

Release history Release notifications | RSS feed

0.0.30

2 release files

0.0.29

2 release files

0.0.28

2 release files

0.0.27

2 release files

0.0.26

2 release files

0.0.25

2 release files

0.0.24

2 release files

0.0.23

2 release files

0.0.22

2 release files

0.0.20

2 release files

0.0.19

2 release files

0.0.18

2 release files

0.0.17

2 release files

This release

0.0.16 This release

2 release files

0.0.15

2 release files

0.0.14

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.4

3 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page