line_joiner.py

Join a list of text lines into a single line, adding spaces between lines only where necessary and rejoining hyphenated words.

class malti.line_joiner.line_joiner.LineJoiner

Bases: ABC

Top-level abstract class representing all line joiners.

join_lines(lines: list[str], fix_hyphenated_words: bool = False) str

Join a list of Maltese text lines into one string, adding a space where necessary. Optionally, try to join hyphenated word segments back together as well.

Parameters:
  • lines (list[str]) – A list of Maltese text lines.

  • fix_hyphenated_words (bool) – Whether to try to join hyphenated word segments back together as well.

Returns:

The joined lines.

Return type:

str