janus.metrics.file_pairing#

Attributes#

Functions#

register_pairing_method([name])

Registers a pairing method for pairing strings between files

pair_by_file(target, reference, **kwargs)

Pairs the entire contents of a file together

pair_by_line(target, reference, **kwargs)

Pairs the contents of a file together by line

pair_by_line_comment(target, reference, **kwargs)

Pairs the comments of a file together by line

Module Contents#

janus.metrics.file_pairing.FILE_PAIRING_METHODS: dict[str, Callable[[str, str], list[tuple[str, str]]]]#
janus.metrics.file_pairing.register_pairing_method(name=None)#

Registers a pairing method for pairing strings between files

Parameters:
  • name (None | str) – The name of the pairing method. If None, the function name is used.

  • help – The help text for the pairing method.

Returns:

The decorator function.

Return type:

Callable[[Callable], Callable]

janus.metrics.file_pairing.pair_by_file(target, reference, **kwargs)#

Pairs the entire contents of a file together

Parameters:
  • target (str) – The target file text.

  • reference (str) – The reference file text.

  • state – The current evaluation state.

  • kwargs (dict[str, Any]) –

Returns:

A list of tuples of the target and reference file text.

Return type:

list[tuple[str, str]]

janus.metrics.file_pairing.pair_by_line(target, reference, **kwargs)#

Pairs the contents of a file together by line

Parameters:
  • target (str) – The target file text.

  • reference (str) – The reference file text.

  • state – The current evaluation state.

  • kwargs (dict[str, Any]) –

Returns:

A list of tuples of the target and reference file text.

Return type:

list[tuple[str, str]]

janus.metrics.file_pairing.pair_by_line_comment(target, reference, **kwargs)#

Pairs the comments of a file together by line

WARNING: Do not use, as this method is extremely brittle.

Parameters:
  • target (str) – The target file text.

  • reference (str) – The reference/reference file text.

  • state – The current evaluation state.

  • kwargs (dict[str, Any]) –

Returns:

A list of tuples of the target and reference file text.

Return type:

list[tuple[str, str]]