Git Product home page Git Product logo

tweet-generator's Introduction

Tweet Generator: TVD

Home Character

About

Tweet Generator was an extremely fun project to work on. This project implements a basic form of Natural Language Processing utilizing Markov Chains. Markov Chains are structured similarly to a finite state machine model.

Tweet Generation Methodology

The way the Tweet Generator works is divided into steps:

  1. Initally, the program will take in a given text file and build a Markov chain using a Dictogram Structure which is simply a Python's dictonary class extended to have additional functionality.

  2. The chain is built by specifiying an order. The order indicates the amount of words in a given state.

For Instance take the sentence

one fish two fish red fish blue fish

A second order chain would dictate that each state would be two words one fish fish two two fish etc.. each state contains all words that follow that exact sequence of characters. The higher the order the more consecutive words appear in a single state. Too high of an order will only generate sentences that already exisit in the sample text.

  1. As the chain is built start and stop states are generated. Start states consists of the begining of sentencres and stop states consists of ending punctuation like . ? !.

  2. Now the fun begins! This is the point where the chain is fully built and the sentence starts to generate. Markov chains use a form of stoicastic sampling which just simply means words are chosen based on probability.

Author

  • Audaris 'Audi' Blades

Getting Started

Simply click here to go to the tweet generator's website. The server may take a minute or two to load up as it switches from a dormant to active state.

Author

  • Audaris 'Audi' Blades

Technologies Used

  • Python - Programming Language
  • Flask - Lightweight web application framework
  • Jinja - Template engine for python
  • Bootstrap - Front end framework
  • Heroku - Application deployment site

Acknowledgments

  • Make School's CS 1.2 course provided the fondation for this assignment.

tweet-generator's People

Watchers

 avatar  avatar

tweet-generator's Issues

Code Review of Tweet Generator Submission 1

  1. Dictionary_words works well and looks optimized for run time, nice job! I recommend adding benchmarking to your functions to test out alternative solutions. One idea is to try is pulling words while opening the file rather than after.
  2. Creating histograms with dictionaries, list of lists and list of tuples all work and seem well optimized. All tests pass for listogram and dictogram, nice job! Your list of counts is incomplete, but it's off to a good start. Here is my solution if you need some inspiration: https://github.com/SWHarrison/CS1.2-Tweet-Generator/blob/9e24aa04322102c5563cc560d13eab0c86ea411c/histogram.py#L79
    This is a great challenge to level up your understanding of arrays/matrices!
  3. In your sample class you are using a while loop for a set number of iterations. In general it is better practice to use a for loop in situations with a set number of iterations. Your sampling method also seems to be inaccurately sampling words, make sure to test your methods thoroughly!
  4. Heroku app is working and seems to be running as expected, nice job! I am not seeing any stretch challenges however. If you make local changes be sure to push them to the deployed version.
  5. Your markov chain is being created successfully, but it is hard coded for the start token. There also appears to be some trouble when trying to create the sentence. Make sure to test your functions with different inputs to see if your code is robust.

Linked List Submission

  • You can reduce the time complexity from O(n) to O(1) of your length() method by adding an attribute to keep track of the number of nodes you added or deleted. for example .size or something like that. so if you append or prepend a node you would do self.size += 1, if you delete self.size -= 1.
  • Great work on implementing the stretch challenge.
  • Don't forget to test the stretch challenges you completed to make sure it is robust.

Final Project Submission Review

  • Heroku app works, but text generation seems a little funky in terms of length of sentence, and some buttons appear non-functional. Try your best to improve the UI!
  • Great job on n-th order Markov chains!

Hashtable feedback

Hi Audi! I've graded your hashtable submission and have feedback for you:

  • good job passing all unit tests
  • good job using underlying linked list methods
  • unfortunately, your time complexity analysis is off. Even though you have some nested for loops in some methods (like items), the code will never iterate through more than n items where n is the number of items in the hashtable. Remember that with Big O notation, a quadratic time complexity means that the number of operations done increases exponentially as n increases - however these functions will only increase linearly. Please fix
  • try some stretch challenges!

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.