Git Product home page Git Product logo

markov's Introduction

Markov Chains

These scripts were created in R for a class I took Fall Quarter of my Freshman year at Stanford called Breaking Codes, Finding Patterns.

I was tasked with using Markov Chains to randomly generate text based off a corpus of input text and a order for the chain.

More information about the actual process can be found on the Wikipedia page I linked to.

I wrote this as I was learning R and haven't given it a substantial look-over since, so there are guaranteed to be inefficiencies or mistakes. If you spot one, please let me know!

Steps to Run

  1. Install and launch R. I like to use RStudio.
  2. Create a directory called markov. From the command line: mkdir markov
  3. Open up that directory. From the command line: cd markov
  4. Clone this repository. From the command line: git clone [email protected]:abromberg/markov.git
  5. Open whichever R file you want to use in RStudio (there is one for word-based Markov chain text generation, and one for character-based).
  6. Make sure your working directory is the markov directory. From RStudio, you can go to Tools -> Set Working Directory -> Choose Directory. Or you can run the command setwd('path/to/directory')
  7. Download .txt files of whatever you want to base the output off of and place them in the Markov directory.
  8. Change the lines that define the filenames in the program to include those text files.
  9. Change the variable look_forward to the Markov order you want to use.
  10. Select 'Run' to execute the program.

markov's People

Contributors

abromberg avatar

Watchers

 avatar  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.