Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jamesturk/jellyfish
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.0.3
Choose a base ref
...
head repository: jamesturk/jellyfish
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.0.4
Choose a head ref
  • 10 commits
  • 5 files changed
  • 2 contributors

Commits on Mar 28, 2024

  1. Bump extractions/setup-just from 1 to 2 (#208)

    Bumps [extractions/setup-just](https://github.com/extractions/setup-just) from 1 to 2.
    - [Release notes](https://github.com/extractions/setup-just/releases)
    - [Commits](extractions/setup-just@v1...v2)
    
    ---
    updated-dependencies:
    - dependency-name: extractions/setup-just
      dependency-type: direct:production
      update-type: version-update:semver-major
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Mar 28, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    46af7e5 View commit details
  2. Bump actions/setup-python from 4 to 5 (#205)

    Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 5.
    - [Release notes](https://github.com/actions/setup-python/releases)
    - [Commits](actions/setup-python@v4...v5)
    
    ---
    updated-dependencies:
    - dependency-name: actions/setup-python
      dependency-type: direct:production
      update-type: version-update:semver-major
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Mar 28, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    8022d8d View commit details
  3. Bump actions/upload-artifact from 3 to 4 (#207)

    Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4.
    - [Release notes](https://github.com/actions/upload-artifact/releases)
    - [Commits](actions/upload-artifact@v3...v4)
    
    ---
    updated-dependencies:
    - dependency-name: actions/upload-artifact
      dependency-type: direct:production
      update-type: version-update:semver-major
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Mar 28, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    d89d30c View commit details
  4. Bump actions/download-artifact from 3 to 4 (#206)

    Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 3 to 4.
    - [Release notes](https://github.com/actions/download-artifact/releases)
    - [Commits](actions/download-artifact@v3...v4)
    
    ---
    updated-dependencies:
    - dependency-name: actions/download-artifact
      dependency-type: direct:production
      update-type: version-update:semver-major
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Mar 28, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    aed5a7b View commit details

Commits on May 28, 2024

  1. #209 musl builds

    jamesturk committed May 28, 2024
    Copy the full SHA
    4db8941 View commit details
  2. add new tests and fix for #210

    jamesturk committed May 28, 2024
    Copy the full SHA
    98eeb36 View commit details
  3. switch back to v3 for now

    jamesturk committed May 28, 2024
    Copy the full SHA
    eeb8a82 View commit details
  4. 1.0.4 metadata

    jamesturk committed May 28, 2024
    Copy the full SHA
    41a716c View commit details
  5. v3 everywhere?

    jamesturk committed May 28, 2024
    Copy the full SHA
    4a902f8 View commit details
  6. fix CI release

    jamesturk committed May 28, 2024
    Copy the full SHA
    c70f229 View commit details
Showing with 19 additions and 9 deletions.
  1. +5 −3 .github/workflows/CI.yml
  2. +1 −1 Cargo.toml
  3. +5 −0 docs/changelog.md
  4. +7 −4 src/match_rating.rs
  5. +1 −1 testdata
8 changes: 5 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Build wheels
@@ -35,7 +35,7 @@ jobs:
args: --release --out dist -i ${{ matrix.python-version }}
sccache: 'true'
- name: Install Just
uses: extractions/setup-just@v1
uses: extractions/setup-just@v2
- name: Run Cargo Tests
run: |
cargo test
@@ -89,8 +89,10 @@ jobs:
- target: i686-unknown-linux-musl
arch: x86
interpreter: 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9 pypy3.10
- target: aarch64-unknown-linux-musl
arch: aarch64
interpreter: 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9 pypy3.10
# all values: [x86_64, x86, aarch64, armhf, armv7, ppc64le, riscv64, s390x]
# { target: "aarch64-unknown-linux-musl", arch: "aarch64" },
# { target: "armv7-unknown-linux-musleabihf", image_tag: "armv7" },
# { target: "powerpc64le-unknown-linux-musl", image_tag: "ppc64le" },
steps:
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "jellyfish"
version = "1.0.3"
version = "1.0.4"
edition = "2021"
description = "Approximate and phonetic matching of strings."
authors = ["James Turk <dev@jamesturk.net>"]
5 changes: 5 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

1.0.4 - 28 May 2024
-----------------------
* `match_rating_codex` now returns consistent results for Unicode characters regardless of position (#210)
* adds prebuilt wheels for Alpine (#209)

1.0.3 - 17 November 2023
-----------------------
* `match_rating_codex` now raises a `ValueError` when passed non-alpha characters (#200)
11 changes: 7 additions & 4 deletions src/match_rating.rs
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@ use unicode_segmentation::UnicodeSegmentation;

pub fn match_rating_codex(s: &str) -> Result<String, String> {
// match rating only really makes sense on strings

let s = &s.to_uppercase()[..];
let v = UnicodeSegmentation::graphemes(s, true).collect::<FastVec<&str>>();
let mut codex = String::new();
@@ -24,10 +25,12 @@ pub fn match_rating_codex(s: &str) -> Result<String, String> {
}

if codex.len() > 6 {
let mut newcodex = String::new();
newcodex.push_str(codex.get(..3).unwrap());
newcodex.push_str(codex.get(codex.len() - 3..).unwrap());
return Ok(newcodex);
// not safe to take a slice without conversion to chars() since there
// can be unicode left, this implementation matches the Python one
// even though MRC really shouldn't be used with unicode chars
let first_three: String = codex.chars().take(3).collect();
let last_three: String = codex.chars().rev().take(3).collect::<String>().chars().rev().collect();
return Ok(first_three + &last_three);
}

Ok(codex)
2 changes: 1 addition & 1 deletion testdata