Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

BUG ColloquialWordswapConverter skips words next to punctuation and inserts spaces into hyphenated words

クローズ 初心者向け
#3,131 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

@ShivamSharma43 がすでに取り組んでいます。

2026年10月11日 から。

  • #3133 @ShivamSharma43 による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
backend

調査の方向性

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-mail becomes e -mail, father-in-law becomes papa -in-law.
  • The clean-up regex removes a space the user wrote: a 'quoted' word becomes a'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

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/PyRIT のほかの issue

microsoft/PyRIT の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。