Skip to content

Fix raw text paragraph break normalization#4884

Open
kiankyars wants to merge 2 commits intounslothai:mainfrom
kiankyars:fix/raw-text-clean-text-newlines
Open

Fix raw text paragraph break normalization#4884
kiankyars wants to merge 2 commits intounslothai:mainfrom
kiankyars:fix/raw-text-clean-text-newlines

Conversation

@kiankyars
Copy link
Copy Markdown
Contributor

Summary

  • preserve paragraph breaks when cleaning raw text
  • normalize horizontal whitespace without collapsing newlines
  • add a regression check for repeated CRLF paragraph separators

Testing

  • python3 tests/test_raw_text.py

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fa85bc3ee6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +248 to +249
text = re.sub(r"[^\x20-\x7E\n\t]", "", text)
text = re.sub(r"[^\S\n]+", " ", text)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Normalize whitespace before stripping non-ASCII chars

clean_text now removes non-ASCII characters before whitespace normalization, so non-ASCII whitespace (for example NBSP \u00A0 from HTML/PDF text) is deleted instead of converted to a space. In this path, inputs like "hello\u00A0world" become "helloworld", which corrupts word boundaries and downstream tokenization; prior behavior preserved the separator because whitespace collapsing happened first.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant