Skip to content

Commit

Permalink
Merge pull request #516 from Shikkanime/dev
Browse files Browse the repository at this point in the history
Add more name separator
  • Loading branch information
Ziedelth authored Jun 18, 2024
2 parents cacaab6 + ecadbe5 commit 0e90fcf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/kotlin/fr/shikkanime/utils/StringUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ object StringUtils {
private val nonLatinPattern: Pattern = Pattern.compile("[^\\w-]")
private val whitespacePattern: Pattern = Pattern.compile("\\s|:\\b|\\.\\b|/\\b|&\\b")
private val regex = "( [-|!].*[-|!])|( Saison \\d*)|\\(\\d*\\)".toRegex()
private val separators = listOf(":", ",", "!", "", " so ")
private val separators = listOf(":", ",", "!", "", " so ", " - ")

private fun isAllPartsHaveSameAmountOfWords(parts: List<String>, limit: Int): Boolean {
val words = parts.map { it.trim().split(" ").size }
Expand Down
4 changes: 4 additions & 0 deletions src/test/kotlin/fr/shikkanime/utils/StringUtilsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class StringUtilsTest {
"Rent-a-Girlfriend" to "Rent-a-Girlfriend",
"After-school Hanako-kun" to "After-school Hanako-kun",
"Kaguya-sama: Love Is War" to "Kaguya-sama",
"DanMachi - La Légende des Familias" to "DanMachi",
"Demon Slayer - Le village des forgerons" to "Demon Slayer",
)

list.forEach { (input, expected) ->
Expand Down Expand Up @@ -69,6 +71,8 @@ class StringUtilsTest {
"The Strongest Tank's Labyrinth Raids -A Tank with a Rare 9999 Resistance Skill Got Kicked from the Hero's Party-" to "the-strongest-tanks-labyrinth-raids",
"'Tis Time for \"Torture,\" Princess" to "tis-time-for-torture-princess",
"X&Y" to "x-y",
"DanMachi - La Légende des Familias" to "danmachi",
"Demon Slayer - Le village des forgerons" to "demon-slayer",
)

list.forEach { (input, expected) ->
Expand Down

0 comments on commit 0e90fcf

Please sign in to comment.