make_model: Create a Mallet object; from here we can gather word...

Description Usage Arguments Value See Also Examples

Description

Create a Mallet object; from here we can gather word frequency statistics, and feed into createLDAvis

Usage

1
2
3
4
make_model(dataframe, n.topics, idcolname = "id", textcolname = "text",
  datecolname = "date",
  stopListFile = "~/Dropbox/The Egoist PDFs/R/blankstopwords.txt",
  optFreq = 20, burnIn = 50, numRuns = 200)

Arguments

dataframe

data.frame usually taken from prep_corpus, a data.frame with fields for text, journal, date

n.topics

numeric number of topics that we want from LDA

idcolname

string the name of the id column from dataframe

textcolname

string the name of the text column from dataframe

datecolname

string the name of the date column from dataframe

stopListFile

string location of the stop list file to be run with Mallet. Defaults to the blank file provided by this package. Note that this file must have a single word per line, and no special characters, and MUST be a .txt file

optFreq

numeric how often should mallet optimize parameters?

burnIn

numeric number of burn in iterations for LDA

numRuns

numeric total number of runs Mallet should run before finalizing a model

Value

a Mallet object that from which we can get word frequencies, and can run LDA on

See Also

prep_corpus, which creates the data.frame this function draws on

Examples

1
2
3
4
5
6
date_vec <- date_vec
dataframe <- stripped_xmlData
marsden_journals <- make_model(dataframe, 10, journalVec = c("Blast", "Egoist", "Freewoman", "NewFreewoman"))
old_poetryMagazine <- make_model(dataframe, 10, journalVec = "Poetry Magazine", yearRangeRule = "< 1919")
poetry_vocab <- old_poetryMagazine$getVocabulary()
poetry_word.freqs <- mallet.word.freqs(marsden_journals)

mlinegar/litMagModelling documentation built on May 23, 2019, 2:12 a.m.