KEY模糊哈希表查找 [英] KEY fuzzy hash table lookup

查看:168
本文介绍了KEY模糊哈希表查找的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何对哈希表(而不是遍历)进行关键的模糊查找.
例如:哈希中的单词"EA"查找键"EAS","EAGGG"等.

How to make a key fuzzy lookup the hash table, not Traversal.
eg: word ''EA'' lookup Key ''EAS'',''EAGGG'' etc. in the hash

推荐答案

首先,我''我不得不承认我从未尝试过类似的方法,但我想我可以指导您一点.如果您有Hashtable(甚至是Dictionary),它们将以1:1为基础存储值(即一个键,一个值).

因此,解决该问题的唯一方法是如您所说的那样,不诉诸可能更合适的其他数据结构,您将不得不遍历表中的每个键,并将其与模糊"比较进行比较方法.您还可以尝试为散列表填充可能的值,以将多个键映射到相同的值,但这将需要有限的有效值集.
否则,您将需要查看更适合您需要的其他数据结构.
To start off, I''ll have to admit I''ve never tried something like this, but I think I can direct you a bit. If you have a Hashtable (or even a Dictionary), they store values on a 1:1 basis (i.e. one key, one value).

So, the only way to approach this problem as you''ve stated it without resorting to a different data structure that might be more appropriate, you would have to iterate over each key in the table comparing it with your ''fuzzy'' compare method. You could also try seeding the hashtable with possible values to map the multiple keys to the same value, but this would require a limited set of valid values it would map to.

Otherwise, you''ll need to look at different data structure that would be more suited to your needs.


这篇关于KEY模糊哈希表查找的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆