Skip to content

Commit

Permalink
exclude "yandex panoramas" written in Russian
Browse files Browse the repository at this point in the history
  • Loading branch information
deevroman authored and willemarcel committed Aug 30, 2023
1 parent 1196ea9 commit 9f713f6
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
2 changes: 2 additions & 0 deletions osmcha/changeset.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,8 @@ def verify_words(self):
if word in self.source.lower():
if word == 'yandex' and 'yandex panorama' in self.source.lower():
pass
elif word == 'яндекс' and ('яндекс панорам' in self.source.lower() or 'яндекс.панорам' in self.source.lower()):
pass
else:
self.label_suspicious('suspect_word')
break
Expand Down
2 changes: 2 additions & 0 deletions osmcha/suspect_words.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,5 @@ exclude:
- important
- importante
- yandex panorama
- яндекс панорам
- яндекс.панорам
44 changes: 44 additions & 0 deletions tests/test_mod.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ def test_find_words():
assert find_words('places from 2гис', suspect_words, excluded_words)
assert find_words('places from yandex', suspect_words, excluded_words)
assert not find_words('Yandex Panorama', suspect_words, excluded_words)
assert not find_words('Яндекс Панорамы', suspect_words, excluded_words)
assert not find_words('Яндекс.Панорамы', suspect_words, excluded_words)


def test_changeset_list():
Expand Down Expand Up @@ -223,6 +225,48 @@ def test_analyse_verify_words():
ch.verify_words()
assert not ch.is_suspect

ch_dict = {
'created_by': 'Potlatch 2',
'created_at': '2015-04-25T18:08:46Z',
'build': '2.3-650-gad99430',
'version': '2.3',
'comment': 'Somewhere in Brazil',
'comments_count': '1',
'source': 'Яндекс.Панорамы',
'id': '1',
'user': 'JustTest',
'uid': '123123',
'bbox': Polygon([
(-71.0646843, 44.2371354), (-71.0048652, 44.2371354),
(-71.0048652, 44.2430624), (-71.0646843, 44.2430624),
(-71.0646843, 44.2371354)
])
}
ch = Analyse(ch_dict)
ch.verify_words()
assert not ch.is_suspect

ch_dict = {
'created_by': 'Potlatch 2',
'created_at': '2015-04-25T18:08:46Z',
'build': '2.3-650-gad99430',
'version': '2.3',
'comment': 'Somewhere in Brazil',
'comments_count': '1',
'source': 'Яндекс Панорамы',
'id': '1',
'user': 'JustTest',
'uid': '123123',
'bbox': Polygon([
(-71.0646843, 44.2371354), (-71.0048652, 44.2371354),
(-71.0048652, 44.2430624), (-71.0646843, 44.2430624),
(-71.0646843, 44.2371354)
])
}
ch = Analyse(ch_dict)
ch.verify_words()
assert not ch.is_suspect


def test_analyse_verify_editor_josm():
"""Test if JOSM is a powerfull_editor."""
Expand Down

0 comments on commit 9f713f6

Please sign in to comment.