diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2021-09-30 23:03:48 +0200 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2021-09-30 23:03:48 +0200 |
commit | cd3304f3ca7c3035563d9333cb9b76e53b70701f (patch) | |
tree | 05bf6c2cca15ba5518410d11550dc81bf8cd3c0b /text_recognizer/data | |
parent | 0299192894a9fe25a1a50ed82507e09cf4374e18 (diff) |
Lint sentence_generator
Diffstat (limited to 'text_recognizer/data')
-rw-r--r-- | text_recognizer/data/sentence_generator.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/text_recognizer/data/sentence_generator.py b/text_recognizer/data/sentence_generator.py index f09703b..afcdbe9 100644 --- a/text_recognizer/data/sentence_generator.py +++ b/text_recognizer/data/sentence_generator.py @@ -25,20 +25,22 @@ class SentenceGenerator: self.max_length = max_length def generate(self, max_length: Optional[int] = None) -> str: - """Generates a word or sentences from the Brown corpus. + r"""Generates a word or sentences from the Brown corpus. - Sample a string from the Brown corpus of length at least one word and at most max_length, padding to - max_length with the '_' characters if sentence is shorter. + Sample a string from the Brown corpus of length at least one word and at most + max_length, padding to max_length with the '_' characters if sentence is + shorter. Args: - max_length (Optional[int]): The maximum number of characters in the sentence. Defaults to None. + max_length (Optional[int]): The maximum number of characters in the sentence. + Defaults to None. Returns: str: A sentence from the Brown corpus. Raises: - ValueError: If max_length was not specified at initialization and not given as an argument. - + ValueError: If max_length was not specified at initialization and not + given as an argument. """ if max_length is None: max_length = self.max_length |