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

change add_file_name language notation #717

Merged
merged 3 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions autorag/data/chunk/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@ def get_embedding_model(_embed_model_str: str, _module_type: str):
def add_file_name(
file_name_language: str, file_names: List[str], chunk_texts: List[str]
) -> List[str]:
if file_name_language == "english":
if file_name_language == "en":
return list(
map(
lambda x: f"file_name: {x[1]}\n contents: {x[0]}",
zip(chunk_texts, file_names),
)
)
elif file_name_language == "korean":
elif file_name_language == "ko":
return list(
map(
lambda x: f"파일 제목: {x[1]}\n 내용: {x[0]}",
Expand Down
2 changes: 1 addition & 1 deletion docs/source/data_creation/beta/chunk/chunk.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ chunker.start_chunking("your/path/to/chunk_config.yaml")
## Features

### 1. Add File Name
You need to set one of 'English' and 'Korean'
You need to set one of 'en'(=English) and 'ko'(=Korean) for the `add_file_name` parameter.
The 'add_file_name' feature is to add a file_name to chunked_contents.
This is used to prevent hallucination by retrieving contents from the wrong document.
Default form of English is `"file_name: {file_name}\n contents: {content}"`
Expand Down
Loading