Coder Social home page Coder Social logo

tushushu / murmurust Goto Github PK

View Code? Open in Web Editor NEW
8.0 0.0 1.0 59 KB

Python binding of MurmurHash3 Rust implementation.

License: BSD 3-Clause "New" or "Revised" License

Python 70.31% Rust 26.24% Shell 3.45%
murmurhash3 pyo3 python rust hash mmh3 murmurhash

murmurust's Introduction

Hey there ๐Ÿ‘‹

I'm a machine learning engineer.

  • ๐ŸŒฑ Iโ€™m currently learning Rust, and using Go and Python in my daily work.
  • ๐Ÿ“ซ How to reach me: twitter
  • ๐Ÿ˜„ Pronouns: He/His
  • โšก Fun fact: I enjoy playing with guitar and composed some original songs myself.

murmurust's People

Contributors

tushushu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

yutiansut

murmurust's Issues

Recover clippy test.

The clippy test shows the errors below, which is not expected:

error: deref on an immutable reference
  --> src/lib.rs:80:34
   |
80 | fn hash128_x[64](https://github.com/tushushu/murmurust/runs/7928640580?check_suite_focus=true#step:6:65)(_py: Python, key: &str, seed: u32, signed: bool) -> Py<PyAny> {
   |                                  ^ help: if you would like to reborrow, try removing `&*`: `&`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#borrow_deref_ref

This is going to be fixed by PyO3/pyo3#2555. Currently, I have to disable the clippy errors, and when PYO3 0.17.0 released, we need change it back.

Support signed int as return value.

User can decide whether use signed int(i32) or unsigned int (u32) as hash32 function return type. For example:

>>> import mmh3
>>> mmh3.hash('foo', signed=False)
4138058784
>>> mmh3.hash('foo', signed=True)
-156908512
>>> mmh3.hash('foo')
-156908512

Implement hash128 function.

Need to implement hash128 function by Rust, and provide a Python wrapper. For the details, please refer to how we implement hash32 in this repo.

Make parameter `seed` optional.

The default seed of hash32 function is zero, for example:

>>> import mmr3
>>> mmr3.hash32('foo')
4138058784
>>> mmr3.hash32('foo', 0)
4138058784

Support Numpy array.

By calling Numpy C-API, implement hash functions for Numpy array. For example:

import numpy as np
import mmr3

arr = np.array(['foo', 'bar', 'baz'], dtype=object)
mmr3.hash32(arr)

Here is the Rust bindings for Numpy C-API: https://github.com/PyO3/rust-numpy

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.