mirror of
https://github.com/open-thought/reasoning-gym.git
synced 2026-04-28 17:29:39 +00:00
refactor: Update sentence extraction regex to preserve ending punctuation
This commit is contained in:
parent
fa9465e6a9
commit
b03b02f3a5
1 changed files with 2 additions and 2 deletions
|
|
@ -33,8 +33,8 @@ class SentenceReorderingDataset(ProceduralDataset):
|
||||||
# Extract sentences make sure they are greater than or equal to the number of words in a sentence
|
# Extract sentences make sure they are greater than or equal to the number of words in a sentence
|
||||||
# Ensure that only the length of alphanumeric characters in the sentence is considered
|
# Ensure that only the length of alphanumeric characters in the sentence is considered
|
||||||
self.sentences = [
|
self.sentences = [
|
||||||
sentence
|
sentence.strip()
|
||||||
for sentence in re.findall(r"[^.!?]+", text)
|
for sentence in re.findall(r"[^.!?]+[.!?]", text) # Changed pattern to include the ending punctuation
|
||||||
if self.config.min_words_in_sentence <= len(re.findall(r"\b\w+\b", sentence)) <= self.config.max_words_in_sentence
|
if self.config.min_words_in_sentence <= len(re.findall(r"\b\w+\b", sentence)) <= self.config.max_words_in_sentence
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue