Paraphraser

This module contains the Paraphraser class.

Classes

class chemdatawriter.paraphraser.Paraphraser(language='de')

A class to perform paraphrasing using back-translation.

__init__(language='de')

Initialize with a specific language for back-translation.

Parameters:

language (str) – Language for back-translation (default is ‘de’). Supported languages: de, zh, ge, fr, ru, ar, jap.

paraphrase(text)

Paraphrase a given text using back-translation.

Parameters:

text (str) – The text to be paraphrased.

Returns:

The paraphrased text.

Return type:

str

score(text)

Calculate the Rouge score for the paraphrased version of the text.

Parameters:

text (str) – The original text.

Returns:

The Rouge scores comparing the original and the paraphrased text.

Return type:

dict