All Projects → abresler → markovifyR

abresler / markovifyR

Licence: other
Markovify wrapper for R

Programming Languages

r
7636 projects

Projects that are alternatives of or similar to markovifyR

text-generator
Golang text generator for generate SEO texts
Stars: ✭ 18 (-77.78%)
Mutual labels:  text, text-generator
ConTexto
Librería en Python para minería de texto y NLP
Stars: ✭ 43 (-46.91%)
Mutual labels:  text
jomini
Low level, performance oriented parser for save and game files from EU4, CK3, HOI4, Vic3, Imperator, and other PDS titles.
Stars: ✭ 40 (-50.62%)
Mutual labels:  text
react-watermark-module
React水印组件,支持图片水印,文字水印。
Stars: ✭ 31 (-61.73%)
Mutual labels:  text
textalyzer
Analyze key metrics like number of words, readability, complexity, etc. of any kind of text
Stars: ✭ 50 (-38.27%)
Mutual labels:  text
clifs
Contrastive Language-Image Forensic Search allows free text searching through videos using OpenAI's machine learning model CLIP
Stars: ✭ 271 (+234.57%)
Mutual labels:  text
TextBoxes
TextBoxes: A Fast Text Detector with a Single Deep Neural Network
Stars: ✭ 625 (+671.6%)
Mutual labels:  text
justified
Wrap, align and justify the words in a string.
Stars: ✭ 30 (-62.96%)
Mutual labels:  text
porn-description-generator
Generates new porn descriptions based on an edited dataset of xhamster video descriptions uploaded between 2007-2016.
Stars: ✭ 40 (-50.62%)
Mutual labels:  markov-chain
readthat
Read Text Data
Stars: ✭ 27 (-66.67%)
Mutual labels:  text
react-bones
💀 Dead simple content loading components for React and React-Native. 💀
Stars: ✭ 42 (-48.15%)
Mutual labels:  text
vue-swimlane
A Text Swimlane plugin for Vue.js
Stars: ✭ 71 (-12.35%)
Mutual labels:  text
svelte-slate
slate svelte view layer
Stars: ✭ 43 (-46.91%)
Mutual labels:  text
TwitchMarkovChain
Twitch Bot for generating messages based on what it learned from chat
Stars: ✭ 87 (+7.41%)
Mutual labels:  markov-chain
cape
Continuous Augmented Positional Embeddings (CAPE) implementation for PyTorch
Stars: ✭ 29 (-64.2%)
Mutual labels:  text
presidential-rnn
Project 4 for Metis bootcamp. Objective was generation of character-level RNN trained on Donald Trump's statements using Keras. Also generated Markov chains, and quick pyTorch RNN as baseline. Attempted semi-supervised GAN, but was unable to test in time.
Stars: ✭ 26 (-67.9%)
Mutual labels:  markov-chain
markdown
markdown tools, libraries & scripts
Stars: ✭ 52 (-35.8%)
Mutual labels:  text
walrus
Это самый лучший женобот на этой планете // Нейросеть феминистка
Stars: ✭ 38 (-53.09%)
Mutual labels:  markov-chain
Nonlinear-Systems-and-Control
Files for my Nonlinear Systems and Controls class.
Stars: ✭ 16 (-80.25%)
Mutual labels:  markov-chain
rounded background text
Text and TextField highlighted with rounded corners
Stars: ✭ 43 (-46.91%)
Mutual labels:  text

MarkovifyR

markovifyR : R wrapper for Markovify

Ref: https://github.com/jsvine/markovify

"Markovify is a simple, extensible Markov chain generator. Right now, its main use is for building Markov models of large corpora of text, and generating random sentences from that."

This package requires Python and markovify to be installed.

To install markovify in R you can run:

system("pip install markovify")

The following functions are implemented:

  • generate_markovify_model: Generates a markov model
  • markovify_text: Generates text from a markov model
  • generate_sentence_starting_with: Generates text, if possible, with your specified start word
  • generate_start_words: Produces a data frame with the starting words for each input sentence

Installation

devtools::install_github("abresler/markovifyR")
options(width=120)

Usage

library(markovifyR)
library(dplyr)

Generate New Peter Linneman "Life Lessons""

Here we are going to showcase how to use the package to create new Life Lessons from my favorite professor from college Peter Linneman.

Step 1 -- Build the Corpus

data("linneman_lessons")

lessons <-
  linneman_lessons %>% 
  pull(textLesson)

lessons %>% str()
##  chr [1:101] "You always have time for what is important to you" ...

Step 2 -- Build the Model

markov_model <-
  generate_markovify_model(
    input_text = lessons,
    markov_state_size = 2L,
    max_overlap_total = 25,
    max_overlap_ratio = .85
  )

Step 3 -- Generate the Text

markovify_text(
  markov_model = markov_model,
  maximum_sentence_length = NULL,
  output_column_name = 'textLinnemanBot',
  count = 25,
  tries = 100,
  only_distinct = TRUE,
  return_message = TRUE
)
## textLinnemanBot: “What is the bet?” is the bet?” is the outcome of hard work every day; not a eureka experience

## textLinnemanBot: Your job in life that can’t be fixed, so don’t go crazy when things break

## textLinnemanBot: Putting profits before power will generally result in a life of power

## textLinnemanBot: Members of the people you love

## textLinnemanBot: Generosity is cheap over the long term, as you will never realize it was your fault; then ask how you feel about them

## textLinnemanBot: Life isn’t fair, so don’t go crazy when things are unfair

## textLinnemanBot: “What is the right thing simply because it is what it is what it is the right thing simply because it is the bet?” is the outcome of hard work every day; not a eureka experience

## textLinnemanBot: Just when you are doing something, and do it Then it is learned as you wrinkle

## textLinnemanBot: Let the people you love

## textLinnemanBot: Genius is the critical question

## textLinnemanBot: Genius is the bet?” is the bet?” is the critical question

## textLinnemanBot: Enjoy what you do not respect yourself, why should anyone else respect you

## textLinnemanBot: In the battle between fear and greed, greed wins about 80% of the people you love

## textLinnemanBot: Assume it was your fault; then ask how you feel about them

## textLinnemanBot: Stick to what you do not feel so special

## textLinnemanBot: People are the problem

## textLinnemanBot: To interview well, think of yourself like a stripper; you need to be me and us; most people want it to be mean and they will view it as a very nasty statement

## textLinnemanBot: Why ever do less than the sadness of their life rather than the sadness of their life rather than the best you that you can be

## textLinnemanBot: Take ownership of your death, so do not love yourself, there is no reason others should love you

## textLinnemanBot: Stick to what you do not love yourself, there is no reason others should love you

## textLinnemanBot: There are very few things in life that can’t be fixed, so don’t take it personally if yours are strange and difficult; so don’t take it personally if yours are strange and difficult

## textLinnemanBot: Find out who you are If people don’t like it, that’s their problem

## textLinnemanBot: There are just a humble school teacher”

## textLinnemanBot: Life isn’t fair, so don’t take it personally if yours are strange and difficult

## textLinnemanBot: The machine is rarely the problem; the people you love

## # A tibble: 25 x 2
##    idRow textLinnemanBot                                                                                               
##    <int> <chr>                                                                                                         
##  1     1 "“What is the bet?” is the bet?” is the outcome of hard work every day; not a eureka experience"              
##  2     2 "Your job in life that can’t be fixed, so don’t go crazy when things break"                                   
##  3     3 "Putting profits before power will generally result in a life of power"                                       
##  4     4 "Members of the people you love"                                                                              
##  5     5 "Generosity is cheap over the long term, as you will never realize it was your fault; then ask how you feel a…
##  6     6 "Life isn’t fair, so don’t go crazy when things are unfair"                                                   
##  7     7 "“What is the right thing simply because it is what it is what it is the right thing simply because it is the…
##  8     8 "Just when you are doing something, and do it Then it is learned as you wrinkle"                              
##  9     9 "Let the people you love"                                                                                     
## 10    10 "Genius is the critical question"                                                                             
## # ... with 15 more rows

Step 4 -- Other Features

Generate random sentence starting with.

markovify_text(
  markov_model = markov_model,
  maximum_sentence_length = NULL,
  start_words = c("The", "You", "Life"),
  output_column_name = 'textLinnemanBot',
  count = 25,
  tries = 100,
  only_distinct = TRUE,
  return_message = TRUE
)
## textLinnemanBot: The machine is rarely the problem; the people you love

## textLinnemanBot: The machine is rarely the problem; the people who matter know how you feel about them

## textLinnemanBot: The machine is rarely the problem; the people operating the machine are the ultimate assets

## textLinnemanBot: The machine is rarely the problem; the people who matter know how you could have made it better

## textLinnemanBot: You may never get a second chance to tell people how you could have made it better

## textLinnemanBot: Life isn’t fair, so don’t be upset when things break

## textLinnemanBot: Life isn’t fair, so don’t take it personally if yours are strange and difficult

## textLinnemanBot: Life will end; face it and embrace the joy of their life rather than the best you can?

## textLinnemanBot: Life isn’t fair, so don’t go crazy when things are unfair

## textLinnemanBot: Life isn’t fair, so don’t go crazy when things break

## textLinnemanBot: Life will end; face it and embrace the joy of their life rather than the sadness of their life rather than the best you can?

## textLinnemanBot: Life will end; face it and embrace the joy of their life rather than the sadness of their life rather than the sadness of their life rather than the sadness of their death

## textLinnemanBot: Life isn’t fair, so don’t take it personally if yours are strange and difficult; so don’t go crazy when things break

## textLinnemanBot: Life will end; face it and embrace the joy of their life rather than the best you that you can be

## textLinnemanBot: Life will end; face it and embrace the joy of their life rather than the sadness of their life rather than the sadness of their life rather than the best you that you can be

## # A tibble: 15 x 3
##    idRow wordStart textLinnemanBot                                                                                     
##    <int> <chr>     <chr>                                                                                               
##  1     1 The       "The machine is rarely the problem; the people you love"                                            
##  2     2 The       "The machine is rarely the problem; the people who matter know how you feel about them"             
##  3     3 The       "The machine is rarely the problem; the people operating the machine are the ultimate assets"       
##  4     4 The       "The machine is rarely the problem; the people who matter know how you could have made it better"   
##  5     1 You       "You may never get a second chance to tell people how you could have made it better"                
##  6     1 Life      "Life isn’t fair, so don’t be upset when things break"                                              
##  7     2 Life      "Life isn’t fair, so don’t take it personally if yours are strange and difficult"                   
##  8     3 Life      "Life will end; face it and embrace the joy of their life rather than the best you can?"            
##  9     4 Life      "Life isn’t fair, so don’t go crazy when things are unfair"                                         
## 10     5 Life      "Life isn’t fair, so don’t go crazy when things break"                                              
## 11     6 Life      "Life will end; face it and embrace the joy of their life rather than the sadness of their life rat…
## 12     7 Life      "Life will end; face it and embrace the joy of their life rather than the sadness of their life rat…
## 13     8 Life      "Life isn’t fair, so don’t take it personally if yours are strange and difficult; so don’t go crazy…
## 14     9 Life      "Life will end; face it and embrace the joy of their life rather than the best you that you can be" 
## 15    10 Life      "Life will end; face it and embrace the joy of their life rather than the sadness of their life rat…

Look at corpus start-words

generate_start_words(markov_model = markov_model)
## # A tibble: 63 x 3
##    idSentence wordStart distanceCumulative
##         <int> <chr>                  <int>
##  1          1 There                      3
##  2          2 Travel,                    4
##  3          3 Genius                     5
##  4          4 Take                       9
##  5          5 You                       14
##  6          6 Analyze                   15
##  7          7 Careers                   16
##  8          8 Remember                  17
##  9          9 Be                        21
## 10         10 Life                      23
## # ... with 53 more rows
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].