Datasets:

Modalities:
Text
Formats:
json
ArXiv:
Libraries:
Datasets
pandas
License:
do-me commited on
Commit
24f111e
·
verified ·
1 Parent(s): 98b666b

Keep new lines

Browse files

Removing new lines by default is not a good idea as they are one of the most crucial semantic delimiters for text chunkers that are required for semantic search. Please see these two issues of two of the best chunkers out there at the moment:
- https://github.com/umarbutler/semchunk/issues/8
- https://github.com/benbrandt/text-splitter/issues/184

So it would be great to have them included by default. For any other tasks that require removing them, I would argue that it's best done afterwards as it requires very little effort.

Files changed (1) hide show
  1. update.py +1 -1
update.py CHANGED
@@ -59,7 +59,7 @@ def clean_text(func):
59
 
60
  def inner(*args, **kwargs):
61
  text = func(*args, **kwargs)
62
- text = text.replace("\n", " ")
63
  text = text.replace(" .", ".")
64
  text = re.sub(' +', ' ', text)
65
  text = re.sub(' *[.] *', '. ', text)
 
59
 
60
  def inner(*args, **kwargs):
61
  text = func(*args, **kwargs)
62
+ # text = text.replace("\n", " ")
63
  text = text.replace(" .", ".")
64
  text = re.sub(' +', ' ', text)
65
  text = re.sub(' *[.] *', '. ', text)