@@ -210,26 +210,25 @@ def regex_split(input,
210
210
211
211
212
212
class RegexSplitter (splitter .SplitterWithOffsets ):
213
- """A `Splitter` that splits sentences separated by a newline .
213
+ """`RegexSplitter` splits text on the given regular expression .
214
214
215
- `RegexSplitter` splits text when a newline character is detected.
216
- The newline character is determined by a regex pattern. It also returns the
217
- sentence beginning and ending byte offsets as well.
215
+ The default is a newline character pattern. It can also returns the beginning
216
+ and ending byte offsets as well.
218
217
"""
219
218
220
- def __init__ (self , new_sentence_regex = None ):
219
+ def __init__ (self , split_regex = None ):
221
220
r"""Creates an instance of `RegexSplitter`.
222
221
223
222
Args:
224
- new_sentence_regex : (optional) A string containing the regex pattern of a
225
- new line sentence delimiter . Default is '\r?\n'.
223
+ split_regex : (optional) A string containing the regex pattern of a
224
+ delimiter to split on . Default is '\r?\n'.
226
225
"""
227
- if not new_sentence_regex :
228
- new_sentence_regex = "\r ?\n "
229
- self ._new_sentence_regex = new_sentence_regex
226
+ if not split_regex :
227
+ split_regex = "\r ?\n "
228
+ self ._split_regex = split_regex
230
229
231
230
def split (self , input ): # pylint: disable=redefined-builtin
232
- return regex_split (input , self ._new_sentence_regex )
231
+ return regex_split (input , self ._split_regex )
233
232
234
233
def split_with_offsets (self , input ): # pylint: disable=redefined-builtin
235
- return regex_split_with_offsets (input , self ._new_sentence_regex )
234
+ return regex_split_with_offsets (input , self ._split_regex )
0 commit comments