diff --git a/STranslate/Style/Dark/DictionaryCommonDark.xaml b/STranslate/Style/Dark/DictionaryCommonDark.xaml index db95788..d6e053a 100644 --- a/STranslate/Style/Dark/DictionaryCommonDark.xaml +++ b/STranslate/Style/Dark/DictionaryCommonDark.xaml @@ -55,6 +55,8 @@ + + diff --git a/STranslate/ViewModel/MainVM.cs b/STranslate/ViewModel/MainVM.cs index 44f0da2..c4d9689 100644 --- a/STranslate/ViewModel/MainVM.cs +++ b/STranslate/ViewModel/MainVM.cs @@ -79,6 +79,11 @@ namespace STranslate.ViewModel /// private Tuple AutomaticLanguageRecognition(string text) { + //https://www.techiedelight.com/zh/strip-punctuations-from-a-string-in-csharp/ + //预处理 + text = System.Text.RegularExpressions.Regex.Replace(text, + "[1234567890!\"#$%&'()*+,-./:;<=>?@\\[\\]^_`{|}~,。、《》?;‘’:“”【】、{}|·!@#¥%……&*()——+~\\\\]", + string.Empty); //如果输入是中文 if (System.Text.RegularExpressions.Regex.IsMatch(text, @"^[\u4e00-\u9fa5]+$")) {