Skip to content

Commit 11d5806

Browse files
committed
improve: extract quantity when it's immediately followed by a shortened "a stamp" word.
Fix #1300
1 parent 72bcbfc commit 11d5806

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/main/java/ru/mystamps/web/feature/series/importing/SeriesInfoExtractorServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public class SeriesInfoExtractorServiceImpl implements SeriesInfoExtractorServic
6161
// Regular expression matches number of the stamps in a series (from 1 to 999).
6262
// CheckStyle: ignore LineLength for next 2 lines
6363
private static final Pattern NUMBER_OF_STAMPS_REGEXP = Pattern.compile(
64-
"(?<quantity>[1-9][0-9]{0,2})(-?(ти|ой|ух))?( ((без)?зубцов(ая|ы[ех])))? (мар(ок|к[аи])|блок(а|ов)?|БЛ)",
64+
"(?<quantity>[1-9][0-9]{0,2})(-?(ти|ой|ух))?( ((без)?зубцов(ая|ы[ех])))?\\*{0,2}|( (мар(ок|к[аи])|блок(а|ов)?|БЛ)?))",
6565
Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE
6666
);
6767

src/test/groovy/ru/mystamps/web/feature/series/importing/SeriesInfoExtractorServiceImplTest.groovy

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,10 @@ class SeriesInfoExtractorServiceImplTest extends Specification {
402402
service.extractQuantity(fragment) == expectedQuantity
403403
where:
404404
fragment || expectedQuantity
405+
'' || 3
406+
'3м**' || 3
405407
'1 марка' || 1
408+
'5марок' || 5
406409
'5 марок' || 5
407410
'5 МАРОК' || 5
408411
'22 марки' || 22

0 commit comments

Comments
 (0)