BUG ColloquialWordswapConverter skips words next to punctuation and inserts spaces into hyphenated words
Los mantenedores suelen responder en 2 días
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
Línea de trabajo
Encuentra ColloquialWordswapConverter en el paquete de conversores de PyRIT y lee su lógica de tokenización y espaciado, junto con la prueba existente test_awkward_spacing. Reproduce los ejemplos del issue y comprueba las pruebas de conversores cercanas para ver qué intercambios de palabras se esperan. Se considerará terminado cuando los signos de puntuación y las palabras con guion conserven el espaciado con el que están escritas, mientras se intercambian las palabras aptas, y siga pasando la normalización de espacios en blanco existente.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Python
- Estrellas
- 4.6k
- Forks
- 944
- Merge medio
- 2 d 16 h
- PR fusionados (30 d)
- 350
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/PyRIT
-
BUG: SQLInjectionOutputScorer misses standard inline comment bypasses ('-- and ' OR 1=1--)Posiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
microsoft/PyRIT#3204 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
BUG: label queries only return the final conversation of an attackPosiblemente ocupada @u7k4rs6 la tomó hace 1 día. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
microsoft/PyRIT#3095 · 4 comentarios · 1 asignado ·
Los mantenedores suelen responder en 2 días
-
BUG Configuration keeps runtime-status errors after polling recoversPosiblemente ocupada @joeyvictorino la tomó hace 5 días. AbiertoBug: triage GUI help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
microsoft/PyRIT#2868 · 4 comentarios · 1 asignado ·
Los mantenedores suelen responder en 2 días
-
BUG: HTTPTarget sends conflicting Content-Length and Transfer-Encoding headersPosiblemente ocupada @Kaap10 la tomó hace 9 días. AbiertoBug: triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 35/100
microsoft/PyRIT#3202 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
Dificultad 3/5 Medio día Aptitud para principiantes 25/100
Los mantenedores suelen responder en 2 días
Todos los issues de microsoft/PyRIT
Issues similares
-
Workflow.schedule stops when a cron deadline passes before sleepPosiblemente ocupada @HuaTNA la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
[Bug] HiveDialect shares its colspecs dict with SQLAlchemy's DefaultDialect (python/pyhive)Posiblemente ocupada @rusackas la tomó hoy. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 80/100
apache/kyuubi#7786 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
Los mantenedores suelen responder en 1 día
-
[20.0] hr_work_entry: Duration column of Export Time Entries is truncated to whole hoursPosiblemente ocupada @odooaktiv la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
fix formatting of the sample database page of the docsPosiblemente ocupada @Aaqibhafeezkhan la tomó hoy. Abiertodocumentation good first issue help wanted
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
chaoss/CollectOSS#544 · 1 comentario ·
Los mantenedores suelen responder en 1 día