mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 03:02:35 +01:00
Interjections split to _se and _user file - thx Andrebavila :)
Fix #7491
This commit is contained in:
parent
3ad9da7d8d
commit
5c53560668
@ -245,9 +245,9 @@ Source: ..\Dictionaries\ita_WordSplitList.txt; DestDir: {userappdata}\Subtit
|
|||||||
Source: ..\Dictionaries\pol_WordSplitList.txt; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist; Components: main
|
Source: ..\Dictionaries\pol_WordSplitList.txt; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist; Components: main
|
||||||
Source: ..\Dictionaries\spa_WordSplitList.txt; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist; Components: main
|
Source: ..\Dictionaries\spa_WordSplitList.txt; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist; Components: main
|
||||||
Source: ..\Dictionaries\deu_Nouns.txt; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist; Components: main
|
Source: ..\Dictionaries\deu_Nouns.txt; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist; Components: main
|
||||||
Source: ..\Dictionaries\da_interjections.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist; Components: main
|
Source: ..\Dictionaries\da_interjections_se.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist; Components: main
|
||||||
Source: ..\Dictionaries\en_interjections.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist; Components: main
|
Source: ..\Dictionaries\en_interjections_se.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist; Components: main
|
||||||
Source: ..\Dictionaries\es_interjections.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist; Components: main
|
Source: ..\Dictionaries\es_interjections_se.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist; Components: main
|
||||||
|
|
||||||
|
|
||||||
Source: ..\Ocr\Latin.db; DestDir: {userappdata}\Subtitle Edit\Ocr; Flags: ignoreversion uninsneveruninstall onlyifdoesntexist; Components: main
|
Source: ..\Ocr\Latin.db; DestDir: {userappdata}\Subtitle Edit\Ocr; Flags: ignoreversion uninsneveruninstall onlyifdoesntexist; Components: main
|
||||||
@ -399,9 +399,9 @@ Type: files; Name: {app}\Dictionaries\ita_WordSplitList.txt; Check: Is
|
|||||||
Type: files; Name: {app}\Dictionaries\pol_WordSplitList.txt; Check: IsUpgrade()
|
Type: files; Name: {app}\Dictionaries\pol_WordSplitList.txt; Check: IsUpgrade()
|
||||||
Type: files; Name: {app}\Dictionaries\spa_WordSplitList.txt; Check: IsUpgrade()
|
Type: files; Name: {app}\Dictionaries\spa_WordSplitList.txt; Check: IsUpgrade()
|
||||||
Type: files; Name: {app}\Dictionaries\deu_Nouns.txt; Check: IsUpgrade()
|
Type: files; Name: {app}\Dictionaries\deu_Nouns.txt; Check: IsUpgrade()
|
||||||
Type: files; Name: {app}\Dictionaries\da_interjections.txt; Check: IsUpgrade()
|
Type: files; Name: {app}\Dictionaries\da_interjections_se.xml; Check: IsUpgrade()
|
||||||
Type: files; Name: {app}\Dictionaries\en_interjections.txt; Check: IsUpgrade()
|
Type: files; Name: {app}\Dictionaries\en_interjections_se.xml; Check: IsUpgrade()
|
||||||
Type: files; Name: {app}\Dictionaries\es_interjections.txt; Check: IsUpgrade()
|
Type: files; Name: {app}\Dictionaries\es_interjections_se.xml; Check: IsUpgrade()
|
||||||
|
|
||||||
Type: dirifempty; Name: {app}\Dictionaries; Check: IsUpgrade()
|
Type: dirifempty; Name: {app}\Dictionaries; Check: IsUpgrade()
|
||||||
Type: files; Name: {app}\TessData\eng.DangAmbigs; Check: IsUpgrade()
|
Type: files; Name: {app}\TessData\eng.DangAmbigs; Check: IsUpgrade()
|
||||||
|
@ -23,7 +23,7 @@ namespace Test.Logic.Forms
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public TestContext TestContext { get; set; }
|
public TestContext TestContext { get; set; }
|
||||||
|
|
||||||
private static string _interjectionsFileName;
|
private static string _interjectionsLanguageCode;
|
||||||
|
|
||||||
private static RemoveTextForHI GetRemoveTextForHiLib()
|
private static RemoveTextForHI GetRemoveTextForHiLib()
|
||||||
{
|
{
|
||||||
@ -35,10 +35,42 @@ namespace Test.Logic.Forms
|
|||||||
|
|
||||||
private static void SetInterjections()
|
private static void SetInterjections()
|
||||||
{
|
{
|
||||||
if (_interjectionsFileName == null)
|
if (_interjectionsLanguageCode == null)
|
||||||
{
|
{
|
||||||
_interjectionsFileName = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".xml");
|
_interjectionsLanguageCode = "en";
|
||||||
File.WriteAllText(_interjectionsFileName, "<interjections> <word>Ah</word> <word>Ahem</word> <word>Ahh</word> <word>Ahhh</word> <word>Ahhhh</word> <word>Eh</word> <word>Ehh</word> <word>Ehhh</word> <word>Erm</word> <word>Gah</word> <word>Hm</word> <word>Hmm</word> <word>Hmmm</word> <word>Huh</word> <word>Mm</word> <word>Mmm</word> <word>Mmmm</word> <word>Oh</word> <word>Ohh</word> <word>Ohhh</word> <word>Ow</word> <word>Oww</word> <word>Owww</word> <word>Phew</word> <word>Ugh</word> <word>Ughh</word> <word>Uh</word> <word>Uhh</word> <word>Uhhh</word> <word>Whew</word></interjections>", Encoding.UTF8);
|
InterjectionsRepository.SaveInterjections(_interjectionsLanguageCode, new List<string>()
|
||||||
|
{
|
||||||
|
"Ah",
|
||||||
|
"Ahem",
|
||||||
|
"Ahh",
|
||||||
|
"Ahhh",
|
||||||
|
"Ahhhh",
|
||||||
|
"Eh",
|
||||||
|
"Ehh",
|
||||||
|
"Ehhh",
|
||||||
|
"Erm",
|
||||||
|
"Gah",
|
||||||
|
"Hm",
|
||||||
|
"Hmm",
|
||||||
|
"Hmmm",
|
||||||
|
"Huh",
|
||||||
|
"Mm",
|
||||||
|
"Mmm",
|
||||||
|
"Mmmm",
|
||||||
|
"Oh",
|
||||||
|
"Ohh",
|
||||||
|
"Ohhh",
|
||||||
|
"Ow",
|
||||||
|
"Oww",
|
||||||
|
"Owww",
|
||||||
|
"Phew",
|
||||||
|
"Ugh",
|
||||||
|
"Ughh",
|
||||||
|
"Uh",
|
||||||
|
"Uhh",
|
||||||
|
"Uhhh",
|
||||||
|
"Whew",
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,7 +81,7 @@ namespace Test.Logic.Forms
|
|||||||
return new InterjectionRemoveContext
|
return new InterjectionRemoveContext
|
||||||
{
|
{
|
||||||
OnlySeparatedLines = onlyInSeparatedLine,
|
OnlySeparatedLines = onlyInSeparatedLine,
|
||||||
Interjections = RemoveTextForHI.GetInterjectionList(_interjectionsFileName),
|
Interjections = RemoveTextForHI.GetInterjectionList(_interjectionsLanguageCode),
|
||||||
Text = text,
|
Text = text,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -262,7 +294,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||||
string text = "- He's got the clap." + Environment.NewLine + "- SAM: (gasps) What?";
|
string text = "- He's got the clap." + Environment.NewLine + "- SAM: (gasps) What?";
|
||||||
string expected = "- He's got the clap." + Environment.NewLine + "- What?";
|
string expected = "- He's got the clap." + Environment.NewLine + "- What?";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -299,7 +331,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.ColonSeparateLine = false;
|
target.Settings.ColonSeparateLine = false;
|
||||||
const string text = "- Aw, save it. Storm?\r\n- [Storm]\r\nWe're outta here.";
|
const string text = "- Aw, save it. Storm?\r\n- [Storm]\r\nWe're outta here.";
|
||||||
const string expected = "- Aw, save it. Storm?\r\n- We're outta here.";
|
const string expected = "- Aw, save it. Storm?\r\n- We're outta here.";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -317,7 +349,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.ColonSeparateLine = false;
|
target.Settings.ColonSeparateLine = false;
|
||||||
const string text = "[Chuckles,\r\nCoughing]\r\nBut we lived through it.";
|
const string text = "[Chuckles,\r\nCoughing]\r\nBut we lived through it.";
|
||||||
const string expected = "But we lived through it.";
|
const string expected = "But we lived through it.";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,7 +366,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.ColonSeparateLine = false;
|
target.Settings.ColonSeparateLine = false;
|
||||||
const string text = "is the body of a mutant kid\r\non the 6:00 news.";
|
const string text = "is the body of a mutant kid\r\non the 6:00 news.";
|
||||||
const string expected = "is the body of a mutant kid\r\non the 6:00 news.";
|
const string expected = "is the body of a mutant kid\r\non the 6:00 news.";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -353,7 +385,7 @@ namespace Test.Logic.Forms
|
|||||||
string text = "<i>NARRATOR:" + Environment.NewLine +
|
string text = "<i>NARRATOR:" + Environment.NewLine +
|
||||||
"Previously on NCIS</i>";
|
"Previously on NCIS</i>";
|
||||||
const string expected = "<i>Previously on NCIS</i>";
|
const string expected = "<i>Previously on NCIS</i>";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -372,7 +404,7 @@ namespace Test.Logic.Forms
|
|||||||
string text = "<b>NARRATOR:" + Environment.NewLine +
|
string text = "<b>NARRATOR:" + Environment.NewLine +
|
||||||
"Previously on NCIS</b>";
|
"Previously on NCIS</b>";
|
||||||
const string expected = "<b>Previously on NCIS</b>";
|
const string expected = "<b>Previously on NCIS</b>";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -390,7 +422,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.ColonSeparateLine = false;
|
target.Settings.ColonSeparateLine = false;
|
||||||
string text = "- JOHN: Hey." + Environment.NewLine + "- ...hey.";
|
string text = "- JOHN: Hey." + Environment.NewLine + "- ...hey.";
|
||||||
string expected = "- Hey." + Environment.NewLine + "- ...hey.";
|
string expected = "- Hey." + Environment.NewLine + "- ...hey.";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -414,7 +446,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.ColonSeparateLine = false;
|
target.Settings.ColonSeparateLine = false;
|
||||||
const string text = "[MAN]Where?![MAN]";
|
const string text = "[MAN]Where?![MAN]";
|
||||||
const string expected = "Where?!";
|
const string expected = "Where?!";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -430,7 +462,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.ColonSeparateLine = false;
|
target.Settings.ColonSeparateLine = false;
|
||||||
string text = "HECTOR: Hi." + Environment.NewLine + "-Oh, hey, Hector.";
|
string text = "HECTOR: Hi." + Environment.NewLine + "-Oh, hey, Hector.";
|
||||||
string expected = "- Hi." + Environment.NewLine + "- Oh, hey, Hector.";
|
string expected = "- Hi." + Environment.NewLine + "- Oh, hey, Hector.";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -446,7 +478,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.ColonSeparateLine = false;
|
target.Settings.ColonSeparateLine = false;
|
||||||
const string text = "<b>HECTOR: Hi.</b>";
|
const string text = "<b>HECTOR: Hi.</b>";
|
||||||
const string expected = "<b>Hi.</b>";
|
const string expected = "<b>Hi.</b>";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -722,7 +754,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.ColonSeparateLine = false;
|
target.Settings.ColonSeparateLine = false;
|
||||||
const string text = "MICHAEL: How are you?";
|
const string text = "MICHAEL: How are you?";
|
||||||
const string expected = "How are you?";
|
const string expected = "How are you?";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -940,7 +972,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveTextBeforeColon = true;
|
target.Settings.RemoveTextBeforeColon = true;
|
||||||
string text = "- I insist." + Environment.NewLine + "<i>- [ Woman Laughing]</i>";
|
string text = "- I insist." + Environment.NewLine + "<i>- [ Woman Laughing]</i>";
|
||||||
const string expected = "I insist.";
|
const string expected = "I insist.";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -967,7 +999,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveTextBeforeColon = true;
|
target.Settings.RemoveTextBeforeColon = true;
|
||||||
string text = "WOMAN: A glass of champagne, please." + Environment.NewLine + "- (Laughter)";
|
string text = "WOMAN: A glass of champagne, please." + Environment.NewLine + "- (Laughter)";
|
||||||
const string expected = "A glass of champagne, please.";
|
const string expected = "A glass of champagne, please.";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -986,7 +1018,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveTextBetweenQuestionMarks = true;
|
target.Settings.RemoveTextBetweenQuestionMarks = true;
|
||||||
string text = "? My Paul ?" + Environment.NewLine + "? I give you all ?";
|
string text = "? My Paul ?" + Environment.NewLine + "? I give you all ?";
|
||||||
string expected = string.Empty;
|
string expected = string.Empty;
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1052,7 +1084,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveTextBetweenBrackets = true;
|
target.Settings.RemoveTextBetweenBrackets = true;
|
||||||
string text = "<i>- A man who wants to make his mark..." + Environment.NewLine + "- [ Coughing]</i>";
|
string text = "<i>- A man who wants to make his mark..." + Environment.NewLine + "- [ Coughing]</i>";
|
||||||
const string expected = "<i>A man who wants to make his mark...</i>";
|
const string expected = "<i>A man who wants to make his mark...</i>";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1063,7 +1095,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveIfAllUppercase = true;
|
target.Settings.RemoveIfAllUppercase = true;
|
||||||
string text = "- And you?" + Environment.NewLine + "- I—";
|
string text = "- And you?" + Environment.NewLine + "- I—";
|
||||||
string expected = "- And you?" + Environment.NewLine + "- I—";
|
string expected = "- And you?" + Environment.NewLine + "- I—";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1073,7 +1105,7 @@ namespace Test.Logic.Forms
|
|||||||
var target = GetRemoveTextForHiLib();
|
var target = GetRemoveTextForHiLib();
|
||||||
target.Settings.RemoveIfAllUppercase = true;
|
target.Settings.RemoveIfAllUppercase = true;
|
||||||
string text = string.Empty;
|
string text = string.Empty;
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(text, actual);
|
Assert.AreEqual(text, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1086,7 +1118,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveIfTextContains = null;
|
target.Settings.RemoveIfTextContains = null;
|
||||||
const string text = "<i>♪♪[Ambient Electronic]</i>";
|
const string text = "<i>♪♪[Ambient Electronic]</i>";
|
||||||
const string expected = "<i>♪♪</i>";
|
const string expected = "<i>♪♪</i>";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1100,7 +1132,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveInterjections = true;
|
target.Settings.RemoveInterjections = true;
|
||||||
const string text = "Oh — Oh, that's nice!";
|
const string text = "Oh — Oh, that's nice!";
|
||||||
const string expected = "That's nice!";
|
const string expected = "That's nice!";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1112,7 +1144,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveInterjections = true;
|
target.Settings.RemoveInterjections = true;
|
||||||
string text = "- Uh—uh, my God!" + Environment.NewLine + "- Uh, my God.";
|
string text = "- Uh—uh, my God!" + Environment.NewLine + "- Uh, my God.";
|
||||||
string expected = "- My God!" + Environment.NewLine + "- My God.";
|
string expected = "- My God!" + Environment.NewLine + "- My God.";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1124,7 +1156,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveInterjections = true;
|
target.Settings.RemoveInterjections = true;
|
||||||
string text = "- Uh — uh, my God!" + Environment.NewLine + "- Uh, my God.";
|
string text = "- Uh — uh, my God!" + Environment.NewLine + "- Uh, my God.";
|
||||||
string expected = "- My God!" + Environment.NewLine + "- My God.";
|
string expected = "- My God!" + Environment.NewLine + "- My God.";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1136,7 +1168,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveInterjections = true;
|
target.Settings.RemoveInterjections = true;
|
||||||
string text = "- I just, uh —" + Environment.NewLine + "- What?";
|
string text = "- I just, uh —" + Environment.NewLine + "- What?";
|
||||||
string expected = "- I just —" + Environment.NewLine + "- What?";
|
string expected = "- I just —" + Environment.NewLine + "- What?";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1148,7 +1180,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveTextBetweenParentheses = true;
|
target.Settings.RemoveTextBetweenParentheses = true;
|
||||||
const string text = "I'm trying to! (MASTER): Faster now. evacuate.";
|
const string text = "I'm trying to! (MASTER): Faster now. evacuate.";
|
||||||
const string expected = "I'm trying to! Faster now. evacuate.";
|
const string expected = "I'm trying to! Faster now. evacuate.";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1160,7 +1192,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveInterjections = true;
|
target.Settings.RemoveInterjections = true;
|
||||||
string text = "- Mr. Harding?" + Environment.NewLine + "Uh--";
|
string text = "- Mr. Harding?" + Environment.NewLine + "Uh--";
|
||||||
const string expected = "Mr. Harding?";
|
const string expected = "Mr. Harding?";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1172,7 +1204,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveInterjections = true;
|
target.Settings.RemoveInterjections = true;
|
||||||
string text = "- Mr. Harding?" + Environment.NewLine + "- Mm-hm. Oh.";
|
string text = "- Mr. Harding?" + Environment.NewLine + "- Mm-hm. Oh.";
|
||||||
const string expected = "Mr. Harding?";
|
const string expected = "Mr. Harding?";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1184,7 +1216,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveInterjections = true;
|
target.Settings.RemoveInterjections = true;
|
||||||
string text = "-Sit down. Sit down." + Environment.NewLine + "-Oh! Oh!";
|
string text = "-Sit down. Sit down." + Environment.NewLine + "-Oh! Oh!";
|
||||||
const string expected = "Sit down. Sit down.";
|
const string expected = "Sit down. Sit down.";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1196,7 +1228,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveInterjections = true;
|
target.Settings.RemoveInterjections = true;
|
||||||
string text = "Oh." + Environment.NewLine + "-I'm awfully tired.";
|
string text = "Oh." + Environment.NewLine + "-I'm awfully tired.";
|
||||||
const string expected = "I'm awfully tired.";
|
const string expected = "I'm awfully tired.";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1233,7 +1265,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveInterjections = false;
|
target.Settings.RemoveInterjections = false;
|
||||||
string text = "WOMAN: <i>Mr. Sportello?</i>" + Environment.NewLine + "- Mm-hm.";
|
string text = "WOMAN: <i>Mr. Sportello?</i>" + Environment.NewLine + "- Mm-hm.";
|
||||||
string expected = "<i>- Mr. Sportello?</i>" + Environment.NewLine + "- Mm-hm.";
|
string expected = "<i>- Mr. Sportello?</i>" + Environment.NewLine + "- Mm-hm.";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1246,7 +1278,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveInterjections = true;
|
target.Settings.RemoveInterjections = true;
|
||||||
string text = "WOMAN: <i>Mr. Sportello?</i>" + Environment.NewLine + "- Mm-hm.";
|
string text = "WOMAN: <i>Mr. Sportello?</i>" + Environment.NewLine + "- Mm-hm.";
|
||||||
string expected = "<i>Mr. Sportello?</i>";
|
string expected = "<i>Mr. Sportello?</i>";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1259,7 +1291,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveInterjections = true;
|
target.Settings.RemoveInterjections = true;
|
||||||
string text = "- \"My father doesn't want me to be him.\"" + Environment.NewLine + "EAMES: Exactly.";
|
string text = "- \"My father doesn't want me to be him.\"" + Environment.NewLine + "EAMES: Exactly.";
|
||||||
string expected = "- \"My father doesn't want me to be him.\"" + Environment.NewLine + "- Exactly.";
|
string expected = "- \"My father doesn't want me to be him.\"" + Environment.NewLine + "- Exactly.";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1280,7 +1312,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveTextBetweenBrackets = true;
|
target.Settings.RemoveTextBetweenBrackets = true;
|
||||||
string text = "-[gurgling]" + Environment.NewLine + "-Mom?";
|
string text = "-[gurgling]" + Environment.NewLine + "-Mom?";
|
||||||
const string expected = "Mom?";
|
const string expected = "Mom?";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1291,7 +1323,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveTextBetweenBrackets = true;
|
target.Settings.RemoveTextBetweenBrackets = true;
|
||||||
string text = "-[Ronnie laughs]" + Environment.NewLine + "-[sighs] Wow, Ronnie.";
|
string text = "-[Ronnie laughs]" + Environment.NewLine + "-[sighs] Wow, Ronnie.";
|
||||||
const string expected = "Wow, Ronnie.";
|
const string expected = "Wow, Ronnie.";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1302,7 +1334,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveTextBetweenBrackets = true;
|
target.Settings.RemoveTextBetweenBrackets = true;
|
||||||
const string text = "<font color=\"#808080\">[Whistling]</font> Hallo everybody!";
|
const string text = "<font color=\"#808080\">[Whistling]</font> Hallo everybody!";
|
||||||
const string expected = "Hallo everybody!";
|
const string expected = "Hallo everybody!";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1313,7 +1345,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveTextBetweenBrackets = true;
|
target.Settings.RemoveTextBetweenBrackets = true;
|
||||||
const string text = "♪ <font color=\"#000000\">[LIGHT SWITCH CLICKS]</font>";
|
const string text = "♪ <font color=\"#000000\">[LIGHT SWITCH CLICKS]</font>";
|
||||||
const string expected = "♪";
|
const string expected = "♪";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1324,7 +1356,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveTextBetweenBrackets = true;
|
target.Settings.RemoveTextBetweenBrackets = true;
|
||||||
const string text = "Foobar <font color=\"#808080\">[CHAINS RATTLING]</font> Foobar";
|
const string text = "Foobar <font color=\"#808080\">[CHAINS RATTLING]</font> Foobar";
|
||||||
const string expected = "Foobar Foobar";
|
const string expected = "Foobar Foobar";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1350,7 +1382,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveWhereContains = false;
|
target.Settings.RemoveWhereContains = false;
|
||||||
string text = "<i>- ♪♪[Continues ]</i>" + Environment.NewLine + "- It's pretty strong stuff.";
|
string text = "<i>- ♪♪[Continues ]</i>" + Environment.NewLine + "- It's pretty strong stuff.";
|
||||||
const string expected = "It's pretty strong stuff.";
|
const string expected = "It's pretty strong stuff.";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1365,7 +1397,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveTextBetweenBrackets = true;
|
target.Settings.RemoveTextBetweenBrackets = true;
|
||||||
string text = "♪ Trotting down the paddock" + Environment.NewLine + "on a bright, sunny day ♪♪";
|
string text = "♪ Trotting down the paddock" + Environment.NewLine + "on a bright, sunny day ♪♪";
|
||||||
string expected = string.Empty;
|
string expected = string.Empty;
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1380,7 +1412,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveTextBetweenBrackets = true;
|
target.Settings.RemoveTextBetweenBrackets = true;
|
||||||
string text = "<i>♪ Trotting down the paddock" + Environment.NewLine + "on a bright, sunny day ♪♪</i>";
|
string text = "<i>♪ Trotting down the paddock" + Environment.NewLine + "on a bright, sunny day ♪♪</i>";
|
||||||
string expected = string.Empty;
|
string expected = string.Empty;
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1395,7 +1427,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveTextBetweenBrackets = true;
|
target.Settings.RemoveTextBetweenBrackets = true;
|
||||||
string text = "- ♪ Honey, honey, yeah ♪" + Environment.NewLine + "- ♪ Heard it through|the grapevine ♪";
|
string text = "- ♪ Honey, honey, yeah ♪" + Environment.NewLine + "- ♪ Heard it through|the grapevine ♪";
|
||||||
string expected = string.Empty;
|
string expected = string.Empty;
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1409,11 +1441,11 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.CustomEnd = "♪";
|
target.Settings.CustomEnd = "♪";
|
||||||
target.Settings.RemoveTextBetweenBrackets = true;
|
target.Settings.RemoveTextBetweenBrackets = true;
|
||||||
Configuration.Settings.General.DialogStyle = DialogType.DashBothLinesWithSpace;
|
Configuration.Settings.General.DialogStyle = DialogType.DashBothLinesWithSpace;
|
||||||
string text = "The meal is ready. Let's go!" + Environment.NewLine + "<i>- [Nick]</i> J. T. Lancer!";
|
var text = "The meal is ready. Let's go!" + Environment.NewLine + "<i>- [Nick]</i> J. T. Lancer!";
|
||||||
string expected = "- The meal is ready. Let's go!" + Environment.NewLine + "- J. T. Lancer!";
|
var expected = "- The meal is ready. Let's go!" + Environment.NewLine + "- J. T. Lancer!";
|
||||||
var sub = new Subtitle();
|
var sub = new Subtitle();
|
||||||
sub.Paragraphs.Add(new Paragraph(text, 0, 2000));
|
sub.Paragraphs.Add(new Paragraph(text, 0, 2000));
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, sub, 0, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, sub, 0, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1471,7 +1503,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveTextBetweenCustomTags = true;
|
target.Settings.RemoveTextBetweenCustomTags = true;
|
||||||
target.Settings.CustomStart = "♪";
|
target.Settings.CustomStart = "♪";
|
||||||
target.Settings.CustomEnd = "♪";
|
target.Settings.CustomEnd = "♪";
|
||||||
string actual = target.RemoveTextFromHearImpaired("- ♪ To defeat ♪" + Environment.NewLine + "- Referee: Salute.", _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired("- ♪ To defeat ♪" + Environment.NewLine + "- Referee: Salute.", _interjectionsLanguageCode);
|
||||||
Assert.AreEqual("Salute.", actual);
|
Assert.AreEqual("Salute.", actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1516,7 +1548,7 @@ namespace Test.Logic.Forms
|
|||||||
|
|
||||||
string text = "Let's count!" + Environment.NewLine + "1.. 2... 3!";
|
string text = "Let's count!" + Environment.NewLine + "1.. 2... 3!";
|
||||||
string expected = "Let's count!" + Environment.NewLine + "1.. 2... 3!";
|
string expected = "Let's count!" + Environment.NewLine + "1.. 2... 3!";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1533,7 +1565,7 @@ namespace Test.Logic.Forms
|
|||||||
|
|
||||||
const string text = "ENGINE STARTING";
|
const string text = "ENGINE STARTING";
|
||||||
const string expected = "";
|
const string expected = "";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1551,7 +1583,7 @@ namespace Test.Logic.Forms
|
|||||||
|
|
||||||
string text = "- NORA: <i>Sir?</i>" + Environment.NewLine + "- (CAR DOOR CLOSES)";
|
string text = "- NORA: <i>Sir?</i>" + Environment.NewLine + "- (CAR DOOR CLOSES)";
|
||||||
string expected = "<i>Sir?</i>";
|
string expected = "<i>Sir?</i>";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1569,7 +1601,7 @@ namespace Test.Logic.Forms
|
|||||||
|
|
||||||
string text = "- Well, received, technically." + Environment.NewLine + "- KEVIN: <i>Mmm-hmm.</i>";
|
string text = "- Well, received, technically." + Environment.NewLine + "- KEVIN: <i>Mmm-hmm.</i>";
|
||||||
string expected = "- Well, received, technically." + Environment.NewLine + "<i>- Mmm-hmm.</i>";
|
string expected = "- Well, received, technically." + Environment.NewLine + "<i>- Mmm-hmm.</i>";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1588,7 +1620,7 @@ namespace Test.Logic.Forms
|
|||||||
|
|
||||||
string text = "- Well, received, technically." + Environment.NewLine + "- KEVIN: <i>Mmm-hmm.</i>";
|
string text = "- Well, received, technically." + Environment.NewLine + "- KEVIN: <i>Mmm-hmm.</i>";
|
||||||
string expected = "Well, received, technically.";
|
string expected = "Well, received, technically.";
|
||||||
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1639,7 +1671,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveTextBetweenParentheses = true;
|
target.Settings.RemoveTextBetweenParentheses = true;
|
||||||
target.Settings.RemoveInterjections = true;
|
target.Settings.RemoveInterjections = true;
|
||||||
string expected = "- How many, sir?" + Environment.NewLine + "- 275.";
|
string expected = "- How many, sir?" + Environment.NewLine + "- 275.";
|
||||||
string actual = target.RemoveTextFromHearImpaired("- How many, sir?" + Environment.NewLine + "- Uh — (clears throat) 275.", _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired("- How many, sir?" + Environment.NewLine + "- Uh — (clears throat) 275.", _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1650,7 +1682,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveTextBetweenParentheses = false;
|
target.Settings.RemoveTextBetweenParentheses = false;
|
||||||
target.Settings.RemoveTextBetweenSquares = true;
|
target.Settings.RemoveTextBetweenSquares = true;
|
||||||
target.Settings.RemoveInterjections = false;
|
target.Settings.RemoveInterjections = false;
|
||||||
string actual = target.RemoveTextFromHearImpaired("[scoffs]: Nice try.", _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired("[scoffs]: Nice try.", _interjectionsLanguageCode);
|
||||||
Assert.AreEqual("Nice try.", actual);
|
Assert.AreEqual("Nice try.", actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1663,7 +1695,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveTextBetweenCustomTags = true;
|
target.Settings.RemoveTextBetweenCustomTags = true;
|
||||||
target.Settings.CustomStart = "♪";
|
target.Settings.CustomStart = "♪";
|
||||||
target.Settings.CustomEnd = "♪";
|
target.Settings.CustomEnd = "♪";
|
||||||
string actual = target.RemoveTextFromHearImpaired("- Ferguson, Kaz..." + Environment.NewLine + "- <i>♪ [Ominous tone plays] ♪</i>", _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired("- Ferguson, Kaz..." + Environment.NewLine + "- <i>♪ [Ominous tone plays] ♪</i>", _interjectionsLanguageCode);
|
||||||
Assert.AreEqual("Ferguson, Kaz...", actual);
|
Assert.AreEqual("Ferguson, Kaz...", actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1674,7 +1706,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveTextBetweenSquares = true;
|
target.Settings.RemoveTextBetweenSquares = true;
|
||||||
target.Settings.RemoveInterjections = false;
|
target.Settings.RemoveInterjections = false;
|
||||||
target.Settings.RemoveTextBetweenCustomTags = false;
|
target.Settings.RemoveTextBetweenCustomTags = false;
|
||||||
string actual = target.RemoveTextFromHearImpaired("- Ferguson, Kaz..." + Environment.NewLine + "- <i>♪ [Ominous tone plays] ♪</i>", _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired("- Ferguson, Kaz..." + Environment.NewLine + "- <i>♪ [Ominous tone plays] ♪</i>", _interjectionsLanguageCode);
|
||||||
Assert.AreEqual("Ferguson, Kaz...", actual);
|
Assert.AreEqual("Ferguson, Kaz...", actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1686,7 +1718,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveTextBetweenSquares = true;
|
target.Settings.RemoveTextBetweenSquares = true;
|
||||||
target.Settings.RemoveInterjections = false;
|
target.Settings.RemoveInterjections = false;
|
||||||
target.Settings.RemoveTextBetweenCustomTags = false;
|
target.Settings.RemoveTextBetweenCustomTags = false;
|
||||||
string actual = target.RemoveTextFromHearImpaired("KIRK:" + Environment.NewLine + "<i>Captain's log, stardate 1514. 1:</i>", _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired("KIRK:" + Environment.NewLine + "<i>Captain's log, stardate 1514. 1:</i>", _interjectionsLanguageCode);
|
||||||
Assert.AreEqual("<i>Captain's log, stardate 1514. 1:</i>", actual);
|
Assert.AreEqual("<i>Captain's log, stardate 1514. 1:</i>", actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1697,7 +1729,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveTextBetweenSquares = true;
|
target.Settings.RemoveTextBetweenSquares = true;
|
||||||
target.Settings.RemoveInterjections = false;
|
target.Settings.RemoveInterjections = false;
|
||||||
target.Settings.RemoveTextBetweenCustomTags = false;
|
target.Settings.RemoveTextBetweenCustomTags = false;
|
||||||
string actual = target.RemoveTextFromHearImpaired("KIRK:" + Environment.NewLine + "Captain's log, stardate 1514. 1:", _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired("KIRK:" + Environment.NewLine + "Captain's log, stardate 1514. 1:", _interjectionsLanguageCode);
|
||||||
Assert.AreEqual("Captain's log, stardate 1514. 1:", actual);
|
Assert.AreEqual("Captain's log, stardate 1514. 1:", actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1708,7 +1740,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveTextBetweenSquares = true;
|
target.Settings.RemoveTextBetweenSquares = true;
|
||||||
target.Settings.RemoveInterjections = false;
|
target.Settings.RemoveInterjections = false;
|
||||||
target.Settings.RemoveTextBetweenCustomTags = false;
|
target.Settings.RemoveTextBetweenCustomTags = false;
|
||||||
string actual = target.RemoveTextFromHearImpaired("BALOK[OVER RADIO]:" + Environment.NewLine + "<i>--and trespassed into our star systems.</i>", _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired("BALOK[OVER RADIO]:" + Environment.NewLine + "<i>--and trespassed into our star systems.</i>", _interjectionsLanguageCode);
|
||||||
Assert.AreEqual("<i>--and trespassed into our star systems.</i>", actual);
|
Assert.AreEqual("<i>--and trespassed into our star systems.</i>", actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1719,7 +1751,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveTextBetweenSquares = true;
|
target.Settings.RemoveTextBetweenSquares = true;
|
||||||
target.Settings.RemoveInterjections = false;
|
target.Settings.RemoveInterjections = false;
|
||||||
target.Settings.RemoveTextBetweenCustomTags = false;
|
target.Settings.RemoveTextBetweenCustomTags = false;
|
||||||
string actual = target.RemoveTextFromHearImpaired("BALOK[OVER RADIO]:" + Environment.NewLine + "--and trespassed into our star systems.", _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired("BALOK[OVER RADIO]:" + Environment.NewLine + "--and trespassed into our star systems.", _interjectionsLanguageCode);
|
||||||
Assert.AreEqual("--and trespassed into our star systems.", actual);
|
Assert.AreEqual("--and trespassed into our star systems.", actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1730,7 +1762,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveTextBetweenSquares = true;
|
target.Settings.RemoveTextBetweenSquares = true;
|
||||||
target.Settings.RemoveInterjections = false;
|
target.Settings.RemoveInterjections = false;
|
||||||
target.Settings.RemoveTextBetweenCustomTags = false;
|
target.Settings.RemoveTextBetweenCustomTags = false;
|
||||||
string actual = target.RemoveTextFromHearImpaired("BALOK[OVER RADIO]:" + Environment.NewLine + "<i>—and trespassed into our star systems.</i>", _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired("BALOK[OVER RADIO]:" + Environment.NewLine + "<i>—and trespassed into our star systems.</i>", _interjectionsLanguageCode);
|
||||||
Assert.AreEqual("<i>—and trespassed into our star systems.</i>", actual);
|
Assert.AreEqual("<i>—and trespassed into our star systems.</i>", actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1742,7 +1774,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveInterjections = false;
|
target.Settings.RemoveInterjections = false;
|
||||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||||
target.Settings.RemoveTextBetweenCustomTags = false;
|
target.Settings.RemoveTextBetweenCustomTags = false;
|
||||||
string actual = target.RemoveTextFromHearImpaired("<i> -JOHN: Hvordan går det?</i>" + Environment.NewLine + "<i>-Marry: Det går fint!</i>", _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired("<i> -JOHN: Hvordan går det?</i>" + Environment.NewLine + "<i>-Marry: Det går fint!</i>", _interjectionsLanguageCode);
|
||||||
Assert.AreEqual("<i>- Hvordan går det?</i>" + Environment.NewLine + "<i>- Det går fint!</i>", actual);
|
Assert.AreEqual("<i>- Hvordan går det?</i>" + Environment.NewLine + "<i>- Det går fint!</i>", actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1806,7 +1838,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveTextBetweenCustomTags = true;
|
target.Settings.RemoveTextBetweenCustomTags = true;
|
||||||
target.Settings.CustomStart = "♪";
|
target.Settings.CustomStart = "♪";
|
||||||
target.Settings.CustomEnd = "♪";
|
target.Settings.CustomEnd = "♪";
|
||||||
string actual = target.RemoveTextFromHearImpaired("♪ Give me hope and" + Environment.NewLine + "give me patience ♪", _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired("♪ Give me hope and" + Environment.NewLine + "give me patience ♪", _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(string.Empty, actual);
|
Assert.AreEqual(string.Empty, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1816,7 +1848,7 @@ namespace Test.Logic.Forms
|
|||||||
var target = GetRemoveTextForHiLib();
|
var target = GetRemoveTextForHiLib();
|
||||||
target.Settings.RemoveTextBeforeColon = false;
|
target.Settings.RemoveTextBeforeColon = false;
|
||||||
target.Settings.RemoveTextBetweenParentheses = true;
|
target.Settings.RemoveTextBetweenParentheses = true;
|
||||||
string actual = target.RemoveTextFromHearImpaired("(Not, it's not (a secret).)", _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired("(Not, it's not (a secret).)", _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(string.Empty, actual);
|
Assert.AreEqual(string.Empty, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1826,7 +1858,7 @@ namespace Test.Logic.Forms
|
|||||||
var target = GetRemoveTextForHiLib();
|
var target = GetRemoveTextForHiLib();
|
||||||
target.Settings.RemoveTextBeforeColon = false;
|
target.Settings.RemoveTextBeforeColon = false;
|
||||||
target.Settings.RemoveTextBetweenParentheses = true;
|
target.Settings.RemoveTextBetweenParentheses = true;
|
||||||
string actual = target.RemoveTextFromHearImpaired("(MAN) Not, it's... (WOMAN) not.", _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired("(MAN) Not, it's... (WOMAN) not.", _interjectionsLanguageCode);
|
||||||
Assert.AreEqual("Not, it's... not.", actual);
|
Assert.AreEqual("Not, it's... not.", actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1902,7 +1934,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveTextBeforeColon = true;
|
target.Settings.RemoveTextBeforeColon = true;
|
||||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = true;
|
target.Settings.RemoveTextBeforeColonOnlyUppercase = true;
|
||||||
target.Settings.OnlyIfInSeparateLine = true;
|
target.Settings.OnlyIfInSeparateLine = true;
|
||||||
string actual = target.RemoveTextFromHearImpaired("<i>-Era stato avveritito.</i>" + Environment.NewLine + "-(PARLA IN SPANOLO)", _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired("<i>-Era stato avveritito.</i>" + Environment.NewLine + "-(PARLA IN SPANOLO)", _interjectionsLanguageCode);
|
||||||
Assert.AreEqual("<i>Era stato avveritito.</i>", actual);
|
Assert.AreEqual("<i>Era stato avveritito.</i>", actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1913,7 +1945,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveTextBeforeColon = true;
|
target.Settings.RemoveTextBeforeColon = true;
|
||||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = true;
|
target.Settings.RemoveTextBeforeColonOnlyUppercase = true;
|
||||||
target.Settings.OnlyIfInSeparateLine = false;
|
target.Settings.OnlyIfInSeparateLine = false;
|
||||||
string actual = target.RemoveTextFromHearImpaired("Senti, [si schiarisce la voce]," + Environment.NewLine + "dille semplicemente che ti e mancata.", _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired("Senti, [si schiarisce la voce]," + Environment.NewLine + "dille semplicemente che ti e mancata.", _interjectionsLanguageCode);
|
||||||
Assert.AreEqual("Senti," + Environment.NewLine + "dille semplicemente che ti e mancata.", actual);
|
Assert.AreEqual("Senti," + Environment.NewLine + "dille semplicemente che ti e mancata.", actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1930,7 +1962,7 @@ namespace Test.Logic.Forms
|
|||||||
var target = GetRemoveTextForHiLib();
|
var target = GetRemoveTextForHiLib();
|
||||||
target.Settings.RemoveTextBeforeColon = false;
|
target.Settings.RemoveTextBeforeColon = false;
|
||||||
target.Settings.RemoveTextBetweenBrackets = true;
|
target.Settings.RemoveTextBetweenBrackets = true;
|
||||||
string actual = target.RemoveTextFromHearImpaired("Spoken text." + Environment.NewLine + "<i>- [hearing impaired text] Spoken text.</i>", _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired("Spoken text." + Environment.NewLine + "<i>- [hearing impaired text] Spoken text.</i>", _interjectionsLanguageCode);
|
||||||
Assert.AreEqual("- Spoken text." + Environment.NewLine + "<i>- Spoken text.</i>", actual);
|
Assert.AreEqual("- Spoken text." + Environment.NewLine + "<i>- Spoken text.</i>", actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1941,7 +1973,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveTextBeforeColon = true;
|
target.Settings.RemoveTextBeforeColon = true;
|
||||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = true;
|
target.Settings.RemoveTextBeforeColonOnlyUppercase = true;
|
||||||
target.Settings.RemoveInterjections = false;
|
target.Settings.RemoveInterjections = false;
|
||||||
string actual = target.RemoveTextFromHearImpaired("- [chuckles]" + Environment.NewLine + "- MRS. TRYON: Mr. Wylie!", _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired("- [chuckles]" + Environment.NewLine + "- MRS. TRYON: Mr. Wylie!", _interjectionsLanguageCode);
|
||||||
Assert.AreEqual("Mr. Wylie!", actual);
|
Assert.AreEqual("Mr. Wylie!", actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1952,7 +1984,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveTextBeforeColon = true;
|
target.Settings.RemoveTextBeforeColon = true;
|
||||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||||
target.Settings.RemoveInterjections = false;
|
target.Settings.RemoveInterjections = false;
|
||||||
string actual = target.RemoveTextFromHearImpaired("- [chuckles]" + Environment.NewLine + "- MRS. TRYON: Mr. Wylie!", _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired("- [chuckles]" + Environment.NewLine + "- MRS. TRYON: Mr. Wylie!", _interjectionsLanguageCode);
|
||||||
Assert.AreEqual("Mr. Wylie!", actual);
|
Assert.AreEqual("Mr. Wylie!", actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1966,7 +1998,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveInterjections = false;
|
target.Settings.RemoveInterjections = false;
|
||||||
target.Settings.RemoveTextBetweenBrackets = true;
|
target.Settings.RemoveTextBetweenBrackets = true;
|
||||||
target.Settings.OnlyIfInSeparateLine = false;
|
target.Settings.OnlyIfInSeparateLine = false;
|
||||||
string actual = target.RemoveTextFromHearImpaired("[man] Aren't you a little old" + Environment.NewLine + "to be playing with dolls, Michael?", _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired("[man] Aren't you a little old" + Environment.NewLine + "to be playing with dolls, Michael?", _interjectionsLanguageCode);
|
||||||
Assert.AreEqual("Aren't you a little old" + Environment.NewLine + "to be playing with dolls, Michael?", actual);
|
Assert.AreEqual("Aren't you a little old" + Environment.NewLine + "to be playing with dolls, Michael?", actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1979,7 +2011,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveInterjections = false;
|
target.Settings.RemoveInterjections = false;
|
||||||
target.Settings.RemoveTextBetweenBrackets = true;
|
target.Settings.RemoveTextBetweenBrackets = true;
|
||||||
target.Settings.OnlyIfInSeparateLine = true;
|
target.Settings.OnlyIfInSeparateLine = true;
|
||||||
string actual = target.RemoveTextFromHearImpaired("[man] Aren't you a little old" + Environment.NewLine + "to be playing with dolls, Michael?", _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired("[man] Aren't you a little old" + Environment.NewLine + "to be playing with dolls, Michael?", _interjectionsLanguageCode);
|
||||||
Assert.AreEqual("[man] Aren't you a little old" + Environment.NewLine + "to be playing with dolls, Michael?", actual);
|
Assert.AreEqual("[man] Aren't you a little old" + Environment.NewLine + "to be playing with dolls, Michael?", actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1992,7 +2024,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveInterjections = false;
|
target.Settings.RemoveInterjections = false;
|
||||||
target.Settings.RemoveTextBetweenBrackets = true;
|
target.Settings.RemoveTextBetweenBrackets = true;
|
||||||
target.Settings.OnlyIfInSeparateLine = false;
|
target.Settings.OnlyIfInSeparateLine = false;
|
||||||
string actual = target.RemoveTextFromHearImpaired("- You're weird!" + Environment.NewLine + "- [sigh]", _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired("- You're weird!" + Environment.NewLine + "- [sigh]", _interjectionsLanguageCode);
|
||||||
Assert.AreEqual("You're weird!", actual);
|
Assert.AreEqual("You're weird!", actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2005,7 +2037,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveInterjections = false;
|
target.Settings.RemoveInterjections = false;
|
||||||
target.Settings.RemoveTextBetweenBrackets = true;
|
target.Settings.RemoveTextBetweenBrackets = true;
|
||||||
target.Settings.OnlyIfInSeparateLine = false;
|
target.Settings.OnlyIfInSeparateLine = false;
|
||||||
string actual = target.RemoveTextFromHearImpaired("\u2010 You're weird!" + Environment.NewLine + "\u2010 [sigh]", _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired("\u2010 You're weird!" + Environment.NewLine + "\u2010 [sigh]", _interjectionsLanguageCode);
|
||||||
Assert.AreEqual("You're weird!", actual);
|
Assert.AreEqual("You're weird!", actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2057,7 +2089,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveInterjections = false;
|
target.Settings.RemoveInterjections = false;
|
||||||
target.Settings.RemoveTextBetweenBrackets = false;
|
target.Settings.RemoveTextBetweenBrackets = false;
|
||||||
target.Settings.OnlyIfInSeparateLine = false;
|
target.Settings.OnlyIfInSeparateLine = false;
|
||||||
string actual = target.RemoveTextFromHearImpaired("- Oh. No." + Environment.NewLine + "-", _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired("- Oh. No." + Environment.NewLine + "-", _interjectionsLanguageCode);
|
||||||
Assert.AreEqual("Oh. No.", actual);
|
Assert.AreEqual("Oh. No.", actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2070,7 +2102,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveInterjections = false;
|
target.Settings.RemoveInterjections = false;
|
||||||
target.Settings.RemoveTextBetweenBrackets = false;
|
target.Settings.RemoveTextBetweenBrackets = false;
|
||||||
target.Settings.OnlyIfInSeparateLine = false;
|
target.Settings.OnlyIfInSeparateLine = false;
|
||||||
string actual = target.RemoveTextFromHearImpaired("-" + Environment.NewLine + "- Oh. No.", _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired("-" + Environment.NewLine + "- Oh. No.", _interjectionsLanguageCode);
|
||||||
Assert.AreEqual("Oh. No.", actual);
|
Assert.AreEqual("Oh. No.", actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2083,7 +2115,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveInterjections = false;
|
target.Settings.RemoveInterjections = false;
|
||||||
target.Settings.RemoveTextBetweenBrackets = false;
|
target.Settings.RemoveTextBetweenBrackets = false;
|
||||||
target.Settings.OnlyIfInSeparateLine = true;
|
target.Settings.OnlyIfInSeparateLine = true;
|
||||||
var actual = target.RemoveTextFromHearImpaired("What's going on...?! [gasps]", _interjectionsFileName);
|
var actual = target.RemoveTextFromHearImpaired("What's going on...?! [gasps]", _interjectionsLanguageCode);
|
||||||
Assert.AreEqual("What's going on...?! [gasps]", actual);
|
Assert.AreEqual("What's going on...?! [gasps]", actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2096,7 +2128,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveInterjections = false;
|
target.Settings.RemoveInterjections = false;
|
||||||
target.Settings.RemoveTextBetweenBrackets = false;
|
target.Settings.RemoveTextBetweenBrackets = false;
|
||||||
target.Settings.OnlyIfInSeparateLine = false;
|
target.Settings.OnlyIfInSeparateLine = false;
|
||||||
string actual = target.RemoveTextFromHearImpaired("What's going on...?! [gasps]", _interjectionsFileName);
|
string actual = target.RemoveTextFromHearImpaired("What's going on...?! [gasps]", _interjectionsLanguageCode);
|
||||||
Assert.AreEqual("What's going on...?!", actual);
|
Assert.AreEqual("What's going on...?!", actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2232,7 +2264,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||||
var text = "Oh, I was just in my office" + Environment.NewLine + "and-and it was... 10:00.";
|
var text = "Oh, I was just in my office" + Environment.NewLine + "and-and it was... 10:00.";
|
||||||
var expected = "I was just in my office" + Environment.NewLine + "and-and it was... 10:00.";
|
var expected = "I was just in my office" + Environment.NewLine + "and-and it was... 10:00.";
|
||||||
var actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
var actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2249,7 +2281,7 @@ namespace Test.Logic.Forms
|
|||||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||||
var text = "and that is gonna take..." + Environment.NewLine + "[STAMMERS] ... real deep pockets.";
|
var text = "and that is gonna take..." + Environment.NewLine + "[STAMMERS] ... real deep pockets.";
|
||||||
var expected = "and that is gonna take..." + Environment.NewLine + "... real deep pockets.";
|
var expected = "and that is gonna take..." + Environment.NewLine + "... real deep pockets.";
|
||||||
var actual = target.RemoveTextFromHearImpaired(text, _interjectionsFileName);
|
var actual = target.RemoveTextFromHearImpaired(text, _interjectionsLanguageCode);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.AreEqual(expected, actual);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
109
src/libse/Common/InterjectionsRepository.cs
Normal file
109
src/libse/Common/InterjectionsRepository.cs
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Xml;
|
||||||
|
|
||||||
|
namespace Nikse.SubtitleEdit.Core.Common
|
||||||
|
{
|
||||||
|
public static class InterjectionsRepository
|
||||||
|
{
|
||||||
|
|
||||||
|
private const string UserFileName = "_interjections_user.xml";
|
||||||
|
private const string SeFileName = "_interjections_se.xml";
|
||||||
|
|
||||||
|
public static List<string> LoadInterjections(string twoLetterIsoLanguageName)
|
||||||
|
{
|
||||||
|
var seFileName = twoLetterIsoLanguageName + SeFileName;
|
||||||
|
var userFileName = twoLetterIsoLanguageName + UserFileName;
|
||||||
|
var interjections = new List<string>();
|
||||||
|
var se = LoadInterjections(seFileName, out _);
|
||||||
|
var user = LoadInterjections(userFileName, out var ignoreList);
|
||||||
|
|
||||||
|
foreach (var w in se)
|
||||||
|
{
|
||||||
|
if (!interjections.Contains(w) && !ignoreList.Contains(w))
|
||||||
|
{
|
||||||
|
interjections.Add(w);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var w in user)
|
||||||
|
{
|
||||||
|
if (!interjections.Contains(w) && !ignoreList.Contains(w))
|
||||||
|
{
|
||||||
|
interjections.Add(w);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return interjections.OrderBy(p => p).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SaveInterjections(string twoLetterIsoLanguageName, List<string> interjections)
|
||||||
|
{
|
||||||
|
var seFileName = twoLetterIsoLanguageName + SeFileName;
|
||||||
|
var userFileName = twoLetterIsoLanguageName + UserFileName;
|
||||||
|
var se = LoadInterjections(seFileName, out _);
|
||||||
|
var ignoreList = new List<string>();
|
||||||
|
|
||||||
|
foreach (var w in se)
|
||||||
|
{
|
||||||
|
if (!interjections.Contains(w) && !ignoreList.Contains(w))
|
||||||
|
{
|
||||||
|
ignoreList.Add(w);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var xmlDocument = new XmlDocument();
|
||||||
|
xmlDocument.LoadXml("<interjections><ignore></ignore></interjections>");
|
||||||
|
var ignoreNode = xmlDocument.DocumentElement.SelectSingleNode("ignore");
|
||||||
|
foreach (var w in ignoreList)
|
||||||
|
{
|
||||||
|
var node = xmlDocument.CreateElement( "word");
|
||||||
|
node.InnerText = w;
|
||||||
|
ignoreNode.AppendChild(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var w in interjections)
|
||||||
|
{
|
||||||
|
var node = xmlDocument.CreateElement("word");
|
||||||
|
node.InnerText = w;
|
||||||
|
xmlDocument.DocumentElement.AppendChild(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
var fullFileName = Path.Combine(Configuration.DictionariesDirectory, userFileName);
|
||||||
|
xmlDocument.Save(fullFileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<string> LoadInterjections(string fileName, out List<string> ignoreList)
|
||||||
|
{
|
||||||
|
ignoreList = new List<string>();
|
||||||
|
var interjections = new List<string>();
|
||||||
|
var fullFileName = Path.Combine(Configuration.DictionariesDirectory, fileName);
|
||||||
|
if (File.Exists(fullFileName))
|
||||||
|
{
|
||||||
|
var xmlDocument = new XmlDocument();
|
||||||
|
xmlDocument.Load(fullFileName);
|
||||||
|
foreach (XmlNode node in xmlDocument.DocumentElement.SelectNodes("word"))
|
||||||
|
{
|
||||||
|
var w = node.InnerText.Trim();
|
||||||
|
if (!string.IsNullOrEmpty(w) && !interjections.Contains(w))
|
||||||
|
{
|
||||||
|
interjections.Add(w);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (XmlNode node in xmlDocument.DocumentElement.SelectNodes("ignore/word"))
|
||||||
|
{
|
||||||
|
var w = node.InnerText.Trim();
|
||||||
|
if (!string.IsNullOrEmpty(w) && !ignoreList.Contains(w))
|
||||||
|
{
|
||||||
|
ignoreList.Add(w);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return interjections;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -849,12 +849,12 @@ namespace Nikse.SubtitleEdit.Core.Forms
|
|||||||
|
|
||||||
private static readonly char[] TrimStartNoiseChar = { '-', ' ' };
|
private static readonly char[] TrimStartNoiseChar = { '-', ' ' };
|
||||||
|
|
||||||
public string RemoveTextFromHearImpaired(string input, string interjectionsFileName)
|
public string RemoveTextFromHearImpaired(string input, string twoLetterIsoLanguageName)
|
||||||
{
|
{
|
||||||
return RemoveTextFromHearImpaired(input, null, -1, interjectionsFileName);
|
return RemoveTextFromHearImpaired(input, null, -1, twoLetterIsoLanguageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string RemoveTextFromHearImpaired(string inputWithoutUnicodeReplace, Subtitle subtitle, int index, string interjectionsFileName)
|
public string RemoveTextFromHearImpaired(string inputWithoutUnicodeReplace, Subtitle subtitle, int index, string twoLetterIsoLanguageName)
|
||||||
{
|
{
|
||||||
if (StartsAndEndsWithHearImpairedTags(HtmlUtil.RemoveHtmlTags(inputWithoutUnicodeReplace, true).TrimStart(TrimStartNoiseChar)))
|
if (StartsAndEndsWithHearImpairedTags(HtmlUtil.RemoveHtmlTags(inputWithoutUnicodeReplace, true).TrimStart(TrimStartNoiseChar)))
|
||||||
{
|
{
|
||||||
@ -1023,7 +1023,7 @@ namespace Nikse.SubtitleEdit.Core.Forms
|
|||||||
{
|
{
|
||||||
if (_interjections == null)
|
if (_interjections == null)
|
||||||
{
|
{
|
||||||
ReloadInterjection(interjectionsFileName);
|
ReloadInterjection(twoLetterIsoLanguageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
// reusable context
|
// reusable context
|
||||||
@ -1595,15 +1595,10 @@ namespace Nikse.SubtitleEdit.Core.Forms
|
|||||||
return words;
|
return words;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetInterjectionsFileName(string twoLetterLanguage)
|
public static IList<string> GetInterjectionList(string twoLetterIsoLanguageName)
|
||||||
{
|
|
||||||
return Path.Combine(Configuration.DictionariesDirectory, twoLetterLanguage + "_interjections.xml");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IList<string> GetInterjectionList(string fileName)
|
|
||||||
{
|
{
|
||||||
var interjectionList = new HashSet<string>();
|
var interjectionList = new HashSet<string>();
|
||||||
foreach (var s in GetInterjections(fileName))
|
foreach (var s in InterjectionsRepository.LoadInterjections(twoLetterIsoLanguageName))
|
||||||
{
|
{
|
||||||
if (s.Length <= 0)
|
if (s.Length <= 0)
|
||||||
{
|
{
|
||||||
@ -1621,9 +1616,9 @@ namespace Nikse.SubtitleEdit.Core.Forms
|
|||||||
return sortedList;
|
return sortedList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReloadInterjection(string fileName)
|
public void ReloadInterjection(string twoLetterIsoLanguageName)
|
||||||
{
|
{
|
||||||
_interjections = GetInterjectionList(fileName);
|
_interjections = GetInterjectionList(twoLetterIsoLanguageName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2057,13 +2057,12 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
var prev = sub.GetParagraphOrDefault(0);
|
var prev = sub.GetParagraphOrDefault(0);
|
||||||
var first = true;
|
var first = true;
|
||||||
var lang = LanguageAutoDetect.AutoDetectGoogleLanguage(sub);
|
var lang = LanguageAutoDetect.AutoDetectGoogleLanguage(sub);
|
||||||
var interjectionsFileName = RemoveTextForHI.GetInterjectionsFileName(lang);
|
|
||||||
foreach (var p in sub.Paragraphs)
|
foreach (var p in sub.Paragraphs)
|
||||||
{
|
{
|
||||||
if (IsActionEnabled(CommandLineConverter.BatchAction.RemoveTextForHI))
|
if (IsActionEnabled(CommandLineConverter.BatchAction.RemoveTextForHI))
|
||||||
{
|
{
|
||||||
_removeTextForHearingImpaired.Settings = _removeTextForHiSettings;
|
_removeTextForHearingImpaired.Settings = _removeTextForHiSettings;
|
||||||
p.Text = _removeTextForHearingImpaired.RemoveTextFromHearImpaired(p.Text, sub, sub.Paragraphs.IndexOf(p), interjectionsFileName);
|
p.Text = _removeTextForHearingImpaired.RemoveTextFromHearImpaired(p.Text, sub, sub.Paragraphs.IndexOf(p), lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsActionEnabled(CommandLineConverter.BatchAction.RemoveFormatting))
|
if (IsActionEnabled(CommandLineConverter.BatchAction.RemoveFormatting))
|
||||||
|
@ -156,8 +156,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
_removeTextForHiLib.Settings = GetSettings(Subtitle);
|
_removeTextForHiLib.Settings = GetSettings(Subtitle);
|
||||||
_removeTextForHiLib.Warnings = new List<int>();
|
_removeTextForHiLib.Warnings = new List<int>();
|
||||||
|
|
||||||
var fileName = GetInterjectionsFileName();
|
_removeTextForHiLib.ReloadInterjection(_interjectionsLanguage);
|
||||||
_removeTextForHiLib.ReloadInterjection(fileName);
|
|
||||||
|
|
||||||
listViewFixes.BeginUpdate();
|
listViewFixes.BeginUpdate();
|
||||||
listViewFixes.Items.Clear();
|
listViewFixes.Items.Clear();
|
||||||
@ -176,7 +175,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var newText = _removeTextForHiLib.RemoveTextFromHearImpaired(p.Text, Subtitle, index, GetInterjectionsFileName());
|
var newText = _removeTextForHiLib.RemoveTextFromHearImpaired(p.Text, Subtitle, index, _interjectionsLanguage);
|
||||||
if (p.Text.RemoveChar(' ') != newText.RemoveChar(' '))
|
if (p.Text.RemoveChar(' ') != newText.RemoveChar(' '))
|
||||||
{
|
{
|
||||||
count++;
|
count++;
|
||||||
@ -306,8 +305,13 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
|
|
||||||
private void buttonEditInterjections_Click(object sender, EventArgs e)
|
private void buttonEditInterjections_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var fileName = GetInterjectionsFileName();
|
var lang = "en";
|
||||||
using (var editInterjections = new InterjectionsEditList(RemoveTextForHI.GetInterjections(fileName)))
|
if (comboBoxLanguage.SelectedIndex >= 0 && comboBoxLanguage.Items[comboBoxLanguage.SelectedIndex] is LanguageItem l)
|
||||||
|
{
|
||||||
|
lang = l.Code.TwoLetterISOLanguageName;
|
||||||
|
}
|
||||||
|
|
||||||
|
using (var editInterjections = new InterjectionsEditList(InterjectionsRepository.LoadInterjections(lang)))
|
||||||
{
|
{
|
||||||
if (editInterjections.ShowDialog(this) == DialogResult.OK)
|
if (editInterjections.ShowDialog(this) == DialogResult.OK)
|
||||||
{
|
{
|
||||||
@ -321,20 +325,6 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void SaveInterjections(List<string> interjections)
|
private void SaveInterjections(List<string> interjections)
|
||||||
{
|
|
||||||
var xml = new XmlDocument();
|
|
||||||
xml.LoadXml("<interjections/>");
|
|
||||||
foreach (var s in interjections)
|
|
||||||
{
|
|
||||||
XmlNode node = xml.CreateElement("word");
|
|
||||||
node.InnerText = s;
|
|
||||||
xml.DocumentElement.AppendChild(node);
|
|
||||||
}
|
|
||||||
|
|
||||||
xml.Save(GetInterjectionsFileName());
|
|
||||||
}
|
|
||||||
|
|
||||||
private string GetInterjectionsFileName()
|
|
||||||
{
|
{
|
||||||
var lang = "en";
|
var lang = "en";
|
||||||
if (comboBoxLanguage.SelectedIndex >= 0 && comboBoxLanguage.Items[comboBoxLanguage.SelectedIndex] is LanguageItem l)
|
if (comboBoxLanguage.SelectedIndex >= 0 && comboBoxLanguage.Items[comboBoxLanguage.SelectedIndex] is LanguageItem l)
|
||||||
@ -342,7 +332,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
lang = l.Code.TwoLetterISOLanguageName;
|
lang = l.Code.TwoLetterISOLanguageName;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RemoveTextForHI.GetInterjectionsFileName(lang);
|
InterjectionsRepository.SaveInterjections(lang, interjections);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FormRemoveTextForHearImpaired_Resize(object sender, EventArgs e)
|
private void FormRemoveTextForHearImpaired_Resize(object sender, EventArgs e)
|
||||||
|
@ -2197,10 +2197,9 @@ namespace Nikse.SubtitleEdit.Logic.CommandLineConvert
|
|||||||
var hiSettings = new Core.Forms.RemoveTextForHISettings(sub);
|
var hiSettings = new Core.Forms.RemoveTextForHISettings(sub);
|
||||||
var hiLib = new Core.Forms.RemoveTextForHI(hiSettings);
|
var hiLib = new Core.Forms.RemoveTextForHI(hiSettings);
|
||||||
var lang = LanguageAutoDetect.AutoDetectGoogleLanguage(sub);
|
var lang = LanguageAutoDetect.AutoDetectGoogleLanguage(sub);
|
||||||
var interjectionsFileName = RemoveTextForHI.GetInterjectionsFileName(lang);
|
|
||||||
foreach (var p in sub.Paragraphs)
|
foreach (var p in sub.Paragraphs)
|
||||||
{
|
{
|
||||||
p.Text = hiLib.RemoveTextFromHearImpaired(p.Text, sub, sub.Paragraphs.IndexOf(p), interjectionsFileName);
|
p.Text = hiLib.RemoveTextFromHearImpaired(p.Text, sub, sub.Paragraphs.IndexOf(p), lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user