koverholt

koverholt / randomtext / 0.1.0

README.md

Overview

Uses a neural network to generate random text samples based on website text from a URL.

Applicable Scenarios and Problems

This algorithm works best with simple, clean websites since it uses all visible text to train the neural network.

Usage

Input

ParameterDescription
urlURL of text to train neural network on

Output

ParameterDescription
resultFive generated samples of random text from the trained model

Examples

Example 1

In this example, the neural network is trained on a simple webpage that describes how to make websites. Very meta.

Input:

{"url": "https://www.york.ac.uk/teaching/cws/wws/webpage1.html"}

The results show five generates samples from the trained neural network.

Output:

[
  "lessons main least markup lessons more by english sure",
  "bold code extras other thoughts u lots others practice isn typing code literary same these their coded only",
  "over brackets accessories\\ programs\\ sounds program texts useful starting proof your case language in programs\\ preface write opened",
  "computer underlying starting ve would by have cornflake inserted practice inserted menu own write open\\ computer out program",
  "! underlying most u going sounds already pick programs\\ slip other content what thoughts useful code correct format"
]

Example 2

This example is a post on r/python, note that there is a lot of visible text in the nav areas. This could be cleaned up by scraping for only the webpage elements of interest.

Input:

{"url": "https://www.reddit.com/r/Python/comments/9alwnx/are_websphere_liberty_wildflyjboss_application/"}

The output makes it clear that we are on r/python and that most of the text was gathered from the nav elements on the webpage.

Output:

[
  ", ) ) a python / . r . . python . ( python . . . python",
  "of of . add ( . . . the / . python python . ( ) notebooks to",
  "/ of : . ) : . : python for ( . ( : ) . . module",
  ". the . . ) . ) \" python python python . . python python . ( python",
  ". . . for following . python . . . . python . python python python , python"
]