improve colon handling

This commit is contained in:
Robin Appelman
2016-02-16 20:45:41 +01:00
parent dcfda61aba
commit 5e834ae3be
2 changed files with 10 additions and 2 deletions

View File

@ -15,7 +15,8 @@ public class ChapterRecognition {
private static final Pattern withAlphaPostfix = Pattern.compile("(\\d+[\\.,]?\\d*\\s*)([a-z])($|\\b)");
private static final Pattern cleanNumber = Pattern.compile("(\\d+[\\.,]?\\d+)($|\\b)");
private static final Pattern uncleanNumber = Pattern.compile("(\\d+[\\.,]?\\d*)");
private static final Pattern withColon = Pattern.compile("(\\d+[\\.,]?\\d*\\s*:)");
private static final Pattern withColon = Pattern.compile("(\\d+[\\.,]?\\d*\\s*:)([^\\d]|$)");
private static final Pattern startingNumber = Pattern.compile("^(\\d+[\\.,]?\\d*)");
private static final Pattern pUnwanted =
Pattern.compile("(\\b|\\d)(v|ver|vol|version|volume)\\.?\\s*\\d+\\b");
@ -84,7 +85,7 @@ public class ChapterRecognition {
// Try to remove the manga name from the chapter, and try again
String mangaName = replaceIrrelevantCharacters(manga.title);
String nameWithoutManga = difference(mangaName, name);
String nameWithoutManga = difference(mangaName, name).trim();
if (!nameWithoutManga.isEmpty()) {
matcher = uncleanNumber.matcher(nameWithoutManga);
occurrences = getAllOccurrences(matcher);