BUG: CharacterSpaceConverter introduces whitespace holes and trailing whitespace
Maintainer thường phản hồi trong vòng 2 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 82/100
Hướng nghiên cứu
Tìm CharacterSpaceConverter và các bài kiểm thử của nó trong mã nguồn PyRIT. Đọc phần triển khai của bộ chuyển đổi và chạy các bài kiểm thử hiện có của bộ chuyển đổi trước; bổ sung kiểm thử cho dấu câu giữa các từ, dạng rút gọn và dấu câu ở cuối. Công việc hoàn tất khi dấu câu được xóa trước khi chèn khoảng trắng, đầu ra khớp với các ví dụ và mẫu dấu câu được biên dịch một lần ở cấp mô-đun.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
CharacterSpaceConverter spaces out characters with " ".join(prompt) before removing punctuation with re.sub(...). This order of operations introduces whitespace artifacts:
- Stripping punctuation leaves empty character "holes", producing 4 spaces between words (e.g.,
"Hello, world"->"H e l l o w o r l d"instead of the standard 3-space inter-word spacing"H e l l o w o r l d"). - Contractions or mid-word punctuation leave double spaces (e.g.,
"How's"->"H o w s"instead of"H o w s"). - Trailing punctuation leaves unwanted trailing whitespace (e.g.,
"hello!"->"h e l l o ").
Additionally, the punctuation regex is recompiled on every invocation of convert_async rather than precompiled at module level.
Steps/Code to Reproduce
import asyncio
from pyrit.converter import CharacterSpaceConverter
async def main():
converter = CharacterSpaceConverter()
res1 = await converter.convert_async(prompt="hello!")
print(repr(res1.output_text)) # prints 'h e l l o ' with trailing space
res2 = await converter.convert_async(prompt="Hello, world! How's everything?")
print(repr(res2.output_text)) # prints 'H e l l o w o r l d H o w s e v e r y t h i n g '
asyncio.run(main())
Expected Results
Punctuation should be stripped prior to character spacing so spacing remains uniform without artificial gaps or trailing whitespace:
"hello!"->'h e l l o'"Hello, world! How's everything?"->'H e l l o w o r l d H o w s e v e r y t h i n g'
Actual Results
'h e l l o ''H e l l o w o r l d H o w s e v e r y t h i n g '
Versions
- OS: Windows 11
- Python version: 3.12
- PyRIT version: main
- Ngôn ngữ chính
- Python
- Star
- 4.7k
- Fork
- 1k
- Merge trung bình
- 2 ngày 4 giờ
- Pull request đã merge (30 ngày)
- 510
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/PyRIT
-
BUG: HuggingFaceChatTarget runs model.generate() on the event loopCó thể đã có người làm @Shizoqua đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 2 ngày
-
BUG: StaticPromptInjectionScorer misses modern frontier chat template delimiters (DeepSeek, Cohere Command R, Mistral)Có thể đã có người làm @Kaap10 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Parameter required status is lost after wire round-tripCó thể đã có người làm @its-amann đã nhận 3 ngày trước. Đang mởBug: triage help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
microsoft/PyRIT#3854 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
BUG: LLMGenericTextConverter identifier changes between processes for set-valued template parametersCó thể đã có người làm @samrudhi03 đã nhận 3 ngày trước. Đang mởBug: triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
microsoft/PyRIT#3841 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
BUG: SelfAskGeneral scorers leave their output keys out of the identifierCó thể đã có người làm @Hrushikesh-ramilla đã nhận 4 ngày trước. Đang mởBug: triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của microsoft/PyRIT
Issue tương tự
-
ChatBedrockConverse changes the keys of JSON tool results to camelCase (`order_id` becomes `orderId`)Có thể đã có người làm @geyazheng đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
langchain-ai/langchain-aws#1469 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
EESSI/docs#949 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
b4b usability
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
fix(schedule): align list_tasks since cursor filter boundary from strict > to >=Có thể đã có người làm @bfs2021 đã nhận hôm nay. Đang mởagent-ready bug p2 schedule
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
allenporter/supernote#540 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
frazane/scoringrules#164 ·
Maintainer thường phản hồi trong vòng 1 ngày