svmlight: Generate svmlight format

svmlightR Documentation

Generate svmlight format

Description

The svmlight data format is an input format used by Mallet.

Usage

svmlight(x, ...)

## S4 method for signature 'DocumentTermMatrix'
svmlight(x, filename, verbose = TRUE)

Arguments

x

Input object, 'DocumentTermMatrix' for the time being.

...

Additional arguments.

filename

Path to a file.

verbose

A 'logical' value, whether to output progress messages.

Details

Note that it is (currently) not possible to generate a (Mallet) 'InstanceList' from svmlight input that can be used for Mallet topic modelling: The Mallet output from svmlight input is a 'FeatureVector', but Mallet topic modelling requires a 'FeatureSequence' as input.

Examples

library(polmineR)
use("RcppCWB")

svmlight_file <- tempfile()
corpus("REUTERS") %>%
  as.DocumentTermMatrix(p_attribute = "word", s_attribute = "id") %>%
  svmlight(filename = svmlight_file)

PolMine/biglda documentation built on Feb. 25, 2023, 11:24 p.m.