Giter Club home page Giter Club logo

ann-writer's Introduction

Machine learning text generator

Machine learning that utilises sk-learn, numpy and nltk in an attempt to generate text in the style of any given training data. Written in python3.

Installing


pip3 install -U scikit-learn
pip3 install -U numpy
pip3 install -U nltk

### Usage ------ Run the program: ```bash python3 main.py ``` Run the unit test function on the sentence structuring: ```bash python3 main.py -utss ``` Unit test function for vocabulary: ```bash python3 main.py -utv ``` Specify the training data file: ```bash python3 main.py -td ``` Specify test sentence: (Generates text that follows on from the input) example input = "the boy ran" ```bash python3 main.py -ts "" ``` Specify the number of words generated for given test sentence: ```bash python3 main.py -tsc ``` Example usage scenario: ```bash python3 main.py -ts "today i will" -tsc 10 -td "Datasets/HarryPotter(xxlarge).txt" ```

Datasets


Includes 6 datasets:

HarryPotter(small).txt = 346 training vectors
HarryPotter(medium).txt = 2500 training vectors
HarryPotter(large).txt = 4550 training vectors
HarryPotter(xlarge).txt = 11429 training vectors
HarryPotter(xxlarge).txt = 15829 training vectors

MacbookAirBlog(large).txt = 3576 training vectors

Change the data sets with the '-td' command. The larger the data set, the longer the program will take to fit and produce a result. The ability to load an already fitted network has not been implemented yet, so the program has to run the initial fit every time.
The Harry potter data sets have been taken from the book directly and the macbook dataset was taken from a random blog.
It is extremely easy to add your own data set, just make sure that it is in the form of a text blob (see provided datasets). And then simply use the command line to select your dataset

python3 main.py -td "Datasets/your_set.txt"

Dataset has to contain more words than the training range (default = 3).

Go here to see results!

Here I show multiple text generations with different training data sets and how accurate the program is at impersonating the training data.

ann-writer's People

Contributors

lemonscript avatar

Watchers

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