aeidon.Liner

Source: aeidon/liner.py

Anchestors: aeidon.parser.Parser, aeidon.finder.Finder, builtins.object

class aeidon.Liner

Breaking lines to a specified width.

Liner.length_func

A function that returns the length of its argument

Liner.max_length

Maximum length of a line in units of length_func

Liner.max_lines

Maximum preferred amount of lines (may be exceeded)

Methods

Liner.__init__(re_tag=None, clean_func=None)

Initialize a Liner instance.

Liner.break_lines()

Break lines and return text.

Liner.set_penalties(penalties)

Set penalty patterns.

penalties should be a list of dictionaries with items “pattern”, “flags”, “group” and “value”, where pattern is a regular expression with group parentheses around a space, group is the number of the group in pattern to hold the penalty of value. A negative penalty encourages a break and a positive penalty discourages.

Liner.set_text(text)

Set the target text to search in and parse it.