Synchronized AutoDetectLanguageName with AutoDetectGoogleLanguage (LanguageAutoDetect)

This commit is contained in:
Waldi Ravens 2016-04-13 20:56:17 +02:00
parent a3d8186302
commit 27c98d0403

View File

@ -73,7 +73,7 @@ namespace Nikse.SubtitleEdit.Core
}
}
private static readonly string[] AutoDetectWordsEnglish = { "we", "are", "and", "your?", "what", "That's", "something", "You're", "What's", "money", "everything", "anything", "because" };
private static readonly string[] AutoDetectWordsEnglish = { "we", "are", "and", "your?", "what", "[TW]hat's", "You're", "(any|some|every)thing", "money", "because" };
private static readonly string[] AutoDetectWordsDanish = { "vi", "han", "og", "jeg", "var", "men", "gider", "bliver", "virkelig", "kommer", "tilbage", "Hej" };
private static readonly string[] AutoDetectWordsNorwegian = { "vi", "er", "og", "jeg", "var", "men" };
private static readonly string[] AutoDetectWordsSwedish = { "vi", "är", "och", "Jag", "inte", "för" };
@ -128,7 +128,7 @@ namespace Nikse.SubtitleEdit.Core
if (count > bestCount)
{
int dutchCount = GetCount(text, AutoDetectWordsDutch);
if (count > dutchCount)
if (dutchCount < count)
return "en";
}
@ -370,6 +370,9 @@ namespace Nikse.SubtitleEdit.Core
case "en_US":
count = GetCount(text, AutoDetectWordsEnglish);
if (count > bestCount)
{
int dutchCount = GetCount(text, AutoDetectWordsDutch);
if (dutchCount < count)
{
languageName = shortName;
if (containsEnGb)
@ -380,10 +383,14 @@ namespace Nikse.SubtitleEdit.Core
languageName = "en_GB";
}
}
}
break;
case "en_GB":
count = GetCount(text, AutoDetectWordsEnglish);
if (count > bestCount)
{
int dutchCount = GetCount(text, AutoDetectWordsDutch);
if (dutchCount < count)
{
languageName = shortName;
if (containsEnUs)
@ -394,6 +401,7 @@ namespace Nikse.SubtitleEdit.Core
languageName = "en_US";
}
}
}
break;
case "es_ES":
count = GetCount(text, AutoDetectWordsSpanish);