Formats and prints text to make it more readable, especially useful in NLP tasks. It allows the option to truncate text to a specific character length and to wrap text to a specified width.

nlp_pretty_text(x, width = 50L, char_length = NULL)

Arguments

x

A character vector; the text to be formatted.

width

An integer; the width to wrap the text at. Defaults to 50.

char_length

An optional integer; the maximum character length of the text. If specified, text longer than this will be truncated.

Value

The function prints formatted text and does not return a value.

Examples

nlp_pretty_text("This is an example of a longer string that will be wrapped for better readability", width = 40)
#> This is an example of a longer string
#> that will be wrapped for better
#> readability
# With character length limit
nlp_pretty_text("This is an example of a longer string", width = 40, char_length = 20)
#> This is an example o