Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: move paragraph separation back to two newlines #904

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

yisding
Copy link
Contributor

@yisding yisding commented Jun 5, 2024

No description provided.

@yisding yisding requested a review from himself65 June 5, 2024 00:00
Copy link

vercel bot commented Jun 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
llama-index-ts-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 5, 2024 7:15am

Copy link

changeset-bot bot commented Jun 5, 2024

🦋 Changeset detected

Latest commit: 32bd990

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
llamaindex Patch
@llamaindex/env Patch
docs Patch
@llamaindex/community Patch
@llamaindex/experimental Patch
@llamaindex/cloudflare-worker-agent-test Patch
@llamaindex/next-agent-test Patch
@llamaindex/nextjs-edge-runtime-test Patch
@llamaindex/waku-query-engine-test Patch
@llamaindex/autotool-01-node-example Patch
@llamaindex/autotool-02-next-example Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

// many documents will use it.
// NOTE this is different from Python because in Python a lot of the heavy lifting for paragraph separation
// is already handled by NLTK, but we don't have that option here.
export const defaultParagraphSeparator = /\n\n|\r\n\r\n|\r\r/g;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This way we decouple the document encoding from the OS that the user is currently running on.

@himself65 himself65 changed the title move paragraph separation back to two newlines fix: move paragraph separation back to two newlines Jun 5, 2024
].join(
typeof this.paragraphSeparator === "string"
? this.paragraphSeparator
: "\n\n",
Copy link
Collaborator

Choose a reason for hiding this comment

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

\n\n works for all envs?

@@ -55,10 +53,9 @@ export function cjkSentenceTokenizer(sentence: string): string[] {
return slist.filter((s) => s.length > 0);
}

export const defaultParagraphSeparator = EOL + EOL + EOL;
Copy link
Collaborator

Choose a reason for hiding this comment

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

wasn't the problem that we're not using export const defaultParagraphSeparator = EOL + EOL?

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.

None yet

3 participants