Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
diff --git a/src/TinySegmenter.jl b/src/TinySegmenter.jl
index 7fcb27a..7e73fbb 100644
--- a/src/TinySegmenter.jl
+++ b/src/TinySegmenter.jl
@@ -5,6 +5,11 @@ export tokenize
typealias US UTF8String
+Base.hash(x::Tuple{Char,Char}) = hash((UInt64(x[2]) << 32) | UInt64(x[1]))
+Base.hash(x::Tuple{UInt8,UInt8}) = hash((UInt64(x[2]) << 8) | UInt64(x[1]))
+Base.hash(x::Tuple{UInt8,UInt8,UInt8}) = hash((UInt64(x[3]) << 16) | (UInt64(x[2]) << 8) | UInt64(x[1]))
+Base.hash(x::Tuple{UInt8,UInt8,UInt8,UInt8}) = hash((UInt64(x[4]) << 24) | (UInt64(x[3]) << 16) | (UInt64(x[2]) << 8) | UInt64(x[1]))
+
macro t_str(s)
tuple(s...)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.