note_splitter.splitter module

For splitting a syntax tree’s tokens into Sections tokens.

class note_splitter.splitter.Splitter

Bases: object

Creates a Callable that splits a token list into Sections.

__call__(tokens_: list[note_splitter.tokens.Token], split_type: type[note_splitter.tokens.Token], split_attrs: dict, using_split_keyword: bool, remove_split_keyword: bool, split_keyword: str) tuple[list[note_splitter.tokens.Section], list[str]]

Splits a tokens list into Sections.

Parameters
  • tokens (list[tokens.Token]) – A list of tokens to split.

  • split_type (type[tokens.Token]) – The type of token to split by.

  • split_attrs (dict) – The attributes of the token to split by.

  • using_split_keyword (bool) – Whether to use a keyword to decide which files to split.

  • remove_split_keyword (bool) – Whether to remove the keyword from the content of the token.

  • split_keyword (str) – The keyword for deciding which files to split.

Returns

  • sections (list[tokens.Section]) – A list of the sections created by splitting. These are like smaller syntax trees.

  • global_tags (list[str]) – A list of the tags that are not in any of the sections.