BUG ColloquialWordswapConverter skips words next to punctuation and inserts spaces into hyphenated words
メンテナーはふだん 2 日以内に返信
評価
調査の方向性
PyRIT の converter パッケージで ColloquialWordswapConverter を見つけ、トークン化とスペース処理のロジック、および既存の test_awkward_spacing テストを確認してください。issue の例を再現し、近くにある converter のテストで想定される単語の入れ替えを確認してください。句読点とハイフン付きの単語が元のスペースを保ったまま、対象となる単語が入れ替わり、既存の空白正規化も引き続きパスすれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
ColloquialWordswapConverter tokenizes with re.findall(r"\w+|\S+", prompt), rejoins every token with a space, and then removes the space before ?.!,'". That loses or changes text in a few common cases:
- A word that starts after punctuation is never swapped, because
\S+takes the whole run, e.g.(father)or"mother". - A space is inserted inside hyphenated words:
e-mailbecomese -mail,father-in-lawbecomespapa -in-law. - The clean-up regex removes a space the user wrote:
a 'quoted' wordbecomesa'quoted' word.
To Reproduce
import asyncio
from pyrit.converter import ColloquialWordswapConverter
c = ColloquialWordswapConverter(deterministic=True)
for s in ["Ask (father) first.", '"mother" said hi', "My father-in-law called.", "e-mail your brother", "a 'quoted' word"]:
print(repr(s), "->", repr(asyncio.run(c.convert_async(prompt=s)).output_text))
'Ask (father) first.' -> 'Ask (father) first.'
'"mother" said hi' -> '"mother" said hi'
'My father-in-law called.' -> 'My papa -in-law called.'
'e-mail your brother' -> 'e -mail your bro'
"a 'quoted' word" -> "a'quoted' word"
Expected behavior
Words are swapped wherever they appear and surrounding punctuation is left as written: Ask (papa) first., "mama" said hi, My papa-in-law called., e-mail your bro, a 'quoted' word. The existing whitespace normalization (test_awkward_spacing) stays as it is.
Version
main at 60c3386a, Python 3.11, Windows.
- 主要言語
- Python
- スター
- 4.6k
- フォーク
- 944
- 平均マージ
- 2日 20時間
- マージ済み PR(30日)
- 309
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/PyRIT のほかの issue
-
BUG UnicodeReplacementConverter writes characters outside the BMP as invalid five-digit \u escapes対応中かも @ShivamSharma43 が 2 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信
-
BUG: label queries only return the final conversation of an attack対応中かも @richlundeen が 2 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
microsoft/PyRIT#3095 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
-
BUG Configuration keeps runtime-status errors after polling recovers対応中かも @joeyvictorino が 2 日前に担当しました。 オープンBug: triage GUI help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
microsoft/PyRIT#2868 · コメント 4 件 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
-
BUG JailBreakV-28K loader reads a `transfer_attack_type` column that does not exist upstream and drops the real `from` / `transfer_from_llm` provenance対応中かも @kushaltalati が今日担当しました。 オープン
難易度 1/5 1〜3時間 初心者へのやさしさ 35/100
microsoft/PyRIT#3161 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
BUG QuestionAnswerScorer counts a wrong option as correct when the answer appears inside a longer word or number対応中かも @barkha1research-ai が今日担当しました。 オープンBug: triage
難易度 2/5 1〜3時間 初心者へのやさしさ 25/100
メンテナーはふだん 2 日以内に返信
microsoft/PyRIT の issue をすべて見る
似ている issue
-
effort: low prio: low ready
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
digitalfabrik/integreat-cms#4616 ·
メンテナーはふだん 5 日以内に返信
-
bug difficulty:2 good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
MakazhanAlpamys/Soup#1865 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
FinanceFlash/unvibecode#233 ·
メンテナーはふだん 1 日以内に返信
-
area: agents area: docs good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
openapi/gknowledge#23 ·
-
useless-suppression reported for deprecated-* messages that should be exempt対応中かも @adityasinha-ghub が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
pylint-dev/pylint#11656 ·
メンテナーはふだん 1 日以内に返信