normalize_answer#

scikitplot.corpus.normalize_answer(text, *, mode='squad')[source]#

Normalise an answer string for comparison.

Parameters:
textstr

Answer text.

mode{“squad”, “basic”, None}, default=”squad”

See the module documentation.

Returns:
str
Raises:
TypeError

If text is not a str.

ValueError

For an unknown mode.

Parameters:
  • text (str)

  • mode (str | None)

Return type:

str

Examples

>>> normalize_answer("The  Eiffel Tower!")
'eiffel tower'
>>> normalize_answer("Straße", mode="basic")
'strasse'