Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update documents and CI #5

Merged
merged 4 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Cargo Build & Test

on:
push:
pull_request:

env:
CARGO_TERM_COLOR: always

jobs:
build_and_test:
name: Rust project - latest
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- stable
- beta
- nightly
steps:
- uses: actions/checkout@v3
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- run: cargo build --verbose
- run: cargo test --verbose
54 changes: 2 additions & 52 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,59 +1,9 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.1.0](https://github.com/ModelTC/general-sam/releases/tag/v0.1.0) - 2023-10-13

### Fixed
- fix interface
- fix stub

### Other
- add release-plz.yml
- add dependabot.yml
- update readme
- add licenses info in readme
- add documentation url to Cargo.toml
- update readme
- update tests and readme usage
- update cargo settings
- add readme to pybind
- add python tests
- add order related interfaces
- add state copy interface
- rename interface
- update readme
- add readme, update examples
- update tests and docstring
- add get_trans for SAM, update python stub
- add token healing
- utf8 or unicode
- update pyo3
- export other class in the extension
- update __init__.py
- add construct_trie_from_strings
- update stub
- add get_suffix_parent_id
- add trie_utils
- minor fix
- update interfaces
- cooler traveling
- update interfaces
- a little more idiomatic
- add pybind
- remove pyo3
- add interfaces
- move out tests, add sort utils
- add insert to trie
- minor update for sam
- better naming for IterAsChain
- use Clone rather than Copy
- heal my back
- more type gymnastics, which breaks my back
- type gymnastics
- init
- add licenses
### Added
- Initial repository.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
A general suffix automaton implementation in Rust.

Python bindings and some utilities are also available.
Please check out [`pybind`](./pybind/).
Please check out [`general-sam-py`](https://github.com/ModelTC/general-sam-py).

| [![the suffix automaton of abcbc][sam-of-abcbc]][sam-oi-wiki] |
| :----------------------------------------------------------------------------: |
Expand Down
5 changes: 5 additions & 0 deletions src/trie_alike.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ pub enum TravelEvent<NodeType, KeyType> {
Pop(NodeType),
}

/// This trait provides the essential interfaces required by `GeneralSAM`
/// to construct a suffix automaton from structures that form a prefix tree.
pub trait TrieNodeAlike {
type InnerType;
type NextStateIter: Iterator<Item = (Self::InnerType, Self)>;
Expand Down Expand Up @@ -56,6 +58,9 @@ pub trait TrieNodeAlike {
}
}

// This struct implements `TrieNodeAlike` for any iterator.
//
// It can be used to construct a suffix automaton directly from a sequence.
pub struct IterAsChain<Iter: Iterator> {
iter: Iter,
val: Option<Iter::Item>,
Expand Down