Giter Site home page Giter Site logo

complete_me's Introduction

About

This repository contains the finished CompleteMe project from the Turing School curriculum.

Purpose

The purpose of complete me is to build an autocomplete system with a trie data structure. A trie consists of nodes which know the location of their children, but not their parents. Nodes are unaware of the key with which they are associated. Keys are defined entirely by the node's location in the trie. In our case, the only bit of information that a node stores aside from it's children, is a boolean to describe whether or not it is a word.

Functionality

The autocomplete system should have four basic functions:

  • Insert words
  • Delete words
  • Suggest completed words from a given string
  • Update suggestions based on previous selections

Methods

The most important idea in our implementation of the trie, is the ability to dynamically set and call variables based on a string. For example, when a word is inserted, we look at the letters one at a time, and attach links to the current node based on those letters.

current_node.instance_variable_set("@#{letter}", Node.new(is_word))

This technique allowed us to created unique links for each letter without writing 26 specific cases.

Testing functionality is simple with this setup. We can easily confirm that "cat" is a word with this statement:

assert trie.root.c.a.t.is_word

Shoes GUI

In addition to the four basic functionalities, our autocomplete system also includes a GUI. The GUI was written with Shoes and Ruby. Initially there are no words loaded into the trie. The ‘Load dictionary’ button will populate the trie with words listed from “/usr/share/dict/words”. There are edit lines for the user to insert words or phrases and buttons that will perform either the insert, suggest, select, or delete functionality.

complete_me's People

Contributors

jstans12 avatar dshinzie avatar riverswb avatar

Watchers

James Cloos avatar Daniel Shin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.