summaryrefslogtreecommitdiff
path: root/lampion.rb
diff options
context:
space:
mode:
authorPatrick Simianer <simianer@cl.uni-heidelberg.de>2014-04-11 11:55:24 +0200
committerPatrick Simianer <simianer@cl.uni-heidelberg.de>2014-04-11 11:55:24 +0200
commitd637e517919852217705a34d1355020a97af2f6a (patch)
treec8e80ea31f2e9a2b5d683f074dea2b72034cdd38 /lampion.rb
parentbe45f7b253c23757449103ffe3005107ce9169fa (diff)
hashing, helper scripts
Diffstat (limited to 'lampion.rb')
-rwxr-xr-xlampion.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lampion.rb b/lampion.rb
index ab8861f..ab527d0 100755
--- a/lampion.rb
+++ b/lampion.rb
@@ -4,6 +4,7 @@ require 'nlp_ruby'
require 'trollop'
require 'tempfile'
require 'memcached'
+require 'digest'
require_relative './hopefear'
@@ -11,7 +12,7 @@ def exec natural_language_string, reference_output, no_output=false
mrl = output = feedback = nil
# this may cause collisions, but there are not so many German words that
# could have different Umlauts at the same position, e.g. Häuser => H?user
- key_prefix = natural_language_string.encode('ASCII', :invalid => :replace, :undef => :replace, :replace => '?').gsub(/ /,'_')
+ key_prefix = Digest::SHA1.hexdigest(natural_language_string.encode('ASCII', :invalid => :replace, :undef => :replace, :replace => '?').gsub(/ /,'_'))
begin
mrl = $cache.get key_prefix+'__MRL'
output = $cache.get key_prefix+'__OUTPUT'