Created
November 7, 2015 11:54
-
-
Save bicycle1885/918a0fee5dbb3d68f05a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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