使用redis实现trie结构
2011-12-11 11:30
656 查看
http://jedp.posterous.com/auto-complete-with-redis-and-python
Auto-complete with Redis and Python
Salvatore Sanfilippo is always sharing cool things to do with redis. As with all things redis, it never ceases to amaze how much you can do with so little code. Thanks, Salvatore.He posted this gist which implements an autocompleter in redis using ordered sets to represent trie data.
j4mie promptly translated the same into Python.
I’ve branched j4mie’s version and made it work for multi-word phrases. There’s a github gist here.
In his comments, j4mie extends the invitation to make his version more Pythonic. I’ve tried to do so in my fork. I hope I haven’t damaged too much in the process. I also put a command-line wrapper around it, so you can run it from the shell and play with redis interactively.
相关文章推荐
- redis应用之使用sentinel实现主从复制高可用
- 分布式中使用Redis实现Session共享(一)
- Rails中实现后台处理:Redis, Sidekiq 使用总结
- Redis 数据结构使用场景
- 使用jQuery加DIV实现可以动态添加的金字塔结构
- 使用Navicat实现MySQL数据库 表结构同步
- Google Gson的使用方法,实现Json结构的相互转换
- 使用ServiceStack.Redis实现Redis数据读写
- springboot整合redis使用nginx实现负载均衡实现session共享
- 使用memcache和redis实现队列
- 分布式缓存技术redis学习系列(五)——spring-data-redis与JedisPool的区别、使用ShardedJedisPool与spring集成的实现及一致性哈希分析
- Redis入门很简单之七【使用Jedis实现客户端Sharding】
- 使用Redis List简单实现抢红包
- 使用Spring+redis实现对session的分布式管理
- 使用 MVC 模式实现 JavaScript 树形结构
- 1 redis在spring中的配置及java代码实现 2 redis在java项目中的使用
- First Look at Silverlight 2--Part6:使用用户自定义控件实现祝主/子结构
- java-第三章-使用if选择结构实现,如果年龄够5岁并且是男,可以搬桌子
- Spring Boot 系列 | 第六篇:使用Redis实现消息队列
- 使用 redis list 实现滑动窗口