text3preparation: Analyses and prepares a /text/

Description Usage Arguments Value Future Examples

View source: R/rbsa5.code.r

Description

from a text returns another text after some transformations.
Not intended for the standard user.

Usage

1
2
3
4
5
 
  text3preparation(text,preparation="rbR",
                   content=c(1,length(text)),
                   ccom="#",
                   llength=50) 

Arguments

text

A character vector containing the text to prepare.

preparation

A character(1) whose characters indicates the actions to perform (in this order):
r to remove the starting characters of ccom.
b to remove 'blank' characters at both ends of lines.
B to remove repeated 'blank' characters within lines.
R to remove empty lines.
w to return the first word of the first line delimited with either blank, = of <-.

The following options are hierarchized (for instance j is equivalent to cvVSj).
c to concatanate lines (between lists if any) into a unique line; one space is added between two initial lines.
v to return the vector with one word one component from the concatenated line of c.
V the same as v but eliminated repeated words.
S the same as v but sorting the found words.
j to gather the words obtained after v into text components having less that llength characters or only one word.

content

Indicates which component of text to prepare. Usually numeric(2) to indicate the interval of lines to consider. when numeric(1), only this line. When 0 or diff(content)<0 character(0) is returned.

ccom

A character(1) indicating which character(s) at the beginning of lines must possibly be removed (the character(s), not the complete line).

llength

Maximum number of characters for a line (except when it comprises only one word).

Value

The transformed text, that is a character.

Future

Other functionalities could be added.

Examples

1
2
3
4
5
6
7
8
 
  text3preparation(rbsa0$text2$v[1:3],preparation="j",llength=10) 
  uu <- c("Il etait une fois un petit et rouge chaperon", 
  "qui voulait aller voir sa mere-grand"); 
  text3preparation(uu,"j",llength=20); 
  text3preparation(uu,"j",llength=80); 
  text3preparation( c(" Je veux   voir  "," et re-voir  "),"rbBc") 
  text3preparation(c("# Je veux   voir  "," et re-voir  "),"rbBc") 

rbsa documentation built on May 31, 2017, 4:29 a.m.