<commit_before>--
layout:      post
title:       关于自动提示/补全
subtitle:    Trie（前缀树）/Redis（基于内存的数据库）
date:        2015-11-14 16:00:11
author:      Damnever
keywords:    autocomplete, trie, redis
description: 用 Trie 或 Redis 实现自动提示/完成, implement autocomplement with trie and redis.
categories:
  - 自动提示
tags:
  - Trie
  - Redis

---

蛋疼，就酱（[autocomplete](https://github.com/Damnever/Note/tree/master/autocomplete)）↓:

![](https://raw.githubusercontent.com/Damnever/Note/master/autocomplete/test.gif)

参考↓：

- [Trie（维基百科）](https://zh.wikipedia.org/wiki/Trie)
- [Redis 命令参考](http://redisdoc.com/)
- [Three Autocomplete implementations compared（Java 实现）](http://sujitpal.blogspot.com/2007/02/three-autocomplete-implementations.html)
- [Powerful autocomplete with Redis in under 200 lines of Python](http://charlesleifer.com/blog/powerful-autocomplete-with-redis-in-under-200-lines-of-python/)

***<commit_msg>implement autocomplete with trie and redis<commit_after>--
layout:      post
title:       关于自动提示|补全
subtitle:    Trie（前缀树）/Redis（基于内存的数据库）
date:        2015-11-14 16:00:11
author:      Damnever
keywords:    autocomplete, trie, redis
description: implement autocomplement with trie and redis, 用 Trie 或 Redis 实现自动提示和补全
categories:
  - 自动提示
tags:
  - Trie
  - Redis

---

蛋疼，就酱（[autocomplete](https://github.com/Damnever/Note/tree/master/autocomplete)）↓:

![](https://raw.githubusercontent.com/Damnever/Note/master/autocomplete/test.gif)

参考↓：

- [Trie（维基百科）](https://zh.wikipedia.org/wiki/Trie)
- [Redis 命令参考](http://redisdoc.com/)
- [Three Autocomplete implementations compared（Java 实现）](http://sujitpal.blogspot.com/2007/02/three-autocomplete-implementations.html)
- [Powerful autocomplete with Redis in under 200 lines of Python](http://charlesleifer.com/blog/powerful-autocomplete-with-redis-in-under-200-lines-of-python/)

***
{'fraction_non_alphanumeric': 0.14863387978142076, 'fraction_numerical': 0.02841530054644809, 'mean_word_length': 4.216524216524217, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5628605', 'n_tokens_mistral': 779, 'n_tokens_neox': 737, 'n_words': 113}