readPlain: Read In a Text Document

Description Usage Arguments Value See Also Examples

View source: R/reader.R

Description

Read in a text document without knowledge about its internal structure and possible available metadata.

Usage

1
readPlain(elem, language, id)

Arguments

elem

a named list with the component content which must hold the document to be read in.

language

a string giving the language.

id

a character giving a unique identifier for the created text document.

Value

A PlainTextDocument representing elem$content. The argument id is used as fallback if elem$uri is null.

See Also

Reader for basic information on the reader infrastructure employed by package tm.

Examples

1
2
3
4
5
docs <- c("This is a text.", "This another one.")
vs <- VectorSource(docs)
elem <- getElem(stepNext(vs))
(result <- readPlain(elem, "en", "id1"))
meta(result)

Example output

Loading required package: NLP
<<PlainTextDocument>>
Metadata:  7
Content:  chars: 15
  author       : character(0)
  datetimestamp: 2018-02-02 19:16:36
  description  : character(0)
  heading      : character(0)
  id           : id1
  language     : en
  origin       : character(0)

tm documentation built on April 7, 2021, 3:01 a.m.