perf: update optimized identification

dev_deconstruction
DESKTOP-3BO4HSG\ksat 2 years ago
parent d3d39d37d5
commit 2735a6f6b5

@ -55,6 +55,8 @@
<Setter Property="BorderBrush" Value="{x:Null}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="IsReadOnly" Value="True"/>
<!--选区颜色-->
<Setter Property="SelectionBrush" Value="#404856"/>
<Setter Property="Margin" Value="10,10,5,35"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="MaxHeight" Value="400"/>

@ -79,6 +79,11 @@ namespace STranslate.ViewModel
/// </returns>
private Tuple<string, string> 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]+$"))
{

Loading…
Cancel
Save