Home / Companies / Neo4j / Blog / Post Details
Content Deep Dive

Improving My CLI’s Autocomplete with Markov Chains

Blog post from Neo4j

Post Details
Company
Date Published
Author
Nicole White
Word Count
1,664
Language
English
Hacker News Points
-
Summary

The author has implemented a Markov chain-based autocompletion system for Cypher keywords in their CLI tool cycli. The system uses a dictionary of tuples, where each tuple contains a keyword and its probability of being used next given the current keyword. The probabilities are calculated based on the order of appearance of each keyword in a dataset of Cypher queries scraped from the GraphGist wiki. The author has demonstrated how to use this data structure to provide more intelligent autocompletion suggestions for Cypher keywords, such as suggesting `WHERE` and `WITH` after a `MATCH` keyword, rather than just listing all possible keywords alphabetically. This approach is expected to improve the user experience of the cycli tool by providing more relevant and context-dependent suggestions.