зеркало из https://github.com/mozilla/bugbug.git
Add some more synonyms and ignore case when replacing synonyms
This commit is contained in:
Родитель
9fdf09d231
Коммит
b4dd6acb75
|
@ -182,10 +182,15 @@ def cleanup_fileref(text):
|
|||
|
||||
|
||||
def cleanup_synonyms(text):
|
||||
synonyms = [('safemode', ['safe mode', 'safemode'])]
|
||||
synonyms = [
|
||||
('safemode', ['safemode', 'safe mode']),
|
||||
('str', ['str', 'steps to reproduce', 'repro steps']),
|
||||
('uaf', ['uaf', 'use after free', 'use-after-free']),
|
||||
('asan', ['asan', 'address sanitizer']),
|
||||
]
|
||||
|
||||
for synonym_group, synonym_list in synonyms:
|
||||
text = re.sub('|'.join(synonym_list), synonym_group, text)
|
||||
text = re.sub('|'.join(synonym_list), synonym_group, text, flags=re.IGNORECASE)
|
||||
|
||||
return text
|
||||
|
||||
|
|
|
@ -28,6 +28,10 @@ def test_cleanup_fileref():
|
|||
def test_cleanup_synonyms():
|
||||
tests = [
|
||||
('I was in safemode, but the problem occurred in safe mode too', 'I was in safemode, but the problem occurred in safemode too'),
|
||||
('SAFE MODE or SAFEMODE?', 'safemode or safemode?'),
|
||||
('are there str? steps to reproduce? repro steps?', 'are there str? str? str?'),
|
||||
('this is a use-after-free, also called uaf, also called use after free', 'this is a uaf, also called uaf, also called uaf'),
|
||||
('found via address sanitizer or asan', 'found via asan or asan'),
|
||||
]
|
||||
for orig_text, cleaned_text in tests:
|
||||
assert bug_features.cleanup_synonyms(orig_text) == cleaned_text
|
||||
|
|
Загрузка…
Ссылка в новой задаче