Documentation ¶
Overview ¶
Package textproc provides text processing.
On a pair of channels (chan dataType, chan error) all data is transmitted then the data channel is closed then a single error is transmitted then the error channel is closed. The nil error represents success. Any non-nil error (including io.EOF) represents failure.
Index ¶
- Variables
- func ConvertLineTerminatorsToLF(runeIn <-chan rune, errIn <-chan error) (<-chan rune, <-chan error)
- func EnsureFinalLFIfNonEmpty(runeIn <-chan rune, errIn <-chan error) (<-chan rune, <-chan error)
- func ReadLFLineContent(runeIn <-chan rune, errIn <-chan error) (<-chan []rune, <-chan error)
- func ReadLFParagraphContent(runeIn <-chan rune, errIn <-chan error) (<-chan []rune, <-chan error)
- func ReadRunes(r io.Reader) (<-chan rune, <-chan error)
- func SortLFLinesI(runeIn <-chan rune, errIn <-chan error) (<-chan rune, <-chan error)
- func SortLFParagraphsI(runeIn <-chan rune, errIn <-chan error) (<-chan rune, <-chan error)
- func TrimLFTrailingWhiteSpace(runeIn <-chan rune, errIn <-chan error) (<-chan rune, <-chan error)
- func TrimLeadingEmptyLFLines(runeIn <-chan rune, errIn <-chan error) (<-chan rune, <-chan error)
- func TrimTrailingEmptyLFLines(runeIn <-chan rune, errIn <-chan error) (<-chan rune, <-chan error)
- type RuneProcessor
- type Tokenizer
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidUTF8 = errors.New("invalid UTF-8")
ErrInvalidUTF8 is the error returned when the input is not valid UTF-8.
Functions ¶
func ConvertLineTerminatorsToLF ¶
func ConvertLineTerminatorsToLF(runeIn <-chan rune, errIn <-chan error) ( <-chan rune, <-chan error)
ConvertLineTerminatorsToLF converts "\r" and "\r\n" to "\n".
func EnsureFinalLFIfNonEmpty ¶
EnsureFinalLFIfNonEmpty ensures non-empty content ends with "\n".
func ReadLFLineContent ¶
ReadLFLineContent reads the content of each line. The content does not include the line terminator. Lines are terminated by "\n".
func ReadLFParagraphContent ¶
ReadLFParagraphContent reads the content of each paragraph. The content does not include the line terminator of the paragraph's last line.
A paragraph consists of adjacent non-empty lines. Lines are terminated by "\n".
func ReadRunes ¶
ReadRunes reads the runes from r. It fails with ErrInvalidUTF8 if the input is not valid UTF-8.
func SortLFLinesI ¶
SortLFLinesI reads the content of all lines using ReadLFLineContent, sorts the items in case-insensitive order and adds "\n" after each.
func SortLFParagraphsI ¶
SortLFParagraphsI reads the content of all paragraphs using ReadLFParagraphContent, sorts the items in case-insensitive order, joins them with "\n\n" and adds "\n" after the last one.
func TrimLFTrailingWhiteSpace ¶
TrimLFTrailingWhiteSpace removes white space at the end of lines. Lines are terminated by "\n".
func TrimLeadingEmptyLFLines ¶
TrimLeadingEmptyLFLines removes empty lines at the start of the input. Lines are terminated by "\n".