Skip to content

Commit dbabf55

Browse files
committed
1.0.2
1 parent 2285f58 commit dbabf55

15 files changed

+848072
-20
lines changed

PCLIssueHelper/FormMain.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PCLIssueHelper/FormMain.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@ private void 关于AToolStripMenuItem_Click(object sender, EventArgs e)
9393
taskDialogPage.Heading = "关于 PCL Issue Helper";
9494
taskDialogPage.Icon = TaskDialogIcon.Information;
9595
taskDialogPage.Text = """
96-
版本: 1.0.1
96+
版本: 1.0.2
9797
作者: Hill233
9898
9999
开放源代码许可:
100-
<a href="https://github.com/feature23/StringSimilarity.NET/blob/main/LICENSE">StringSimilarity.NET</a> Copyright © 2015 feature[23]
100+
<a href="https://github.com/anderscui/jieba.NET/blob/master/LICENSE">jieba.NET</a> Copyright © 2015 andersc
101101
<a href="https://github.com/xoofx/markdig/blob/master/license.txt">MarkDig</a> Copyright © 2018-2019, Alexandre Mutel All rights reserved.
102102
""";
103103

Lines changed: 44 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
using F23.StringSimilarity;
2-
using System;
3-
using System.Collections.Generic;
4-
using System.Linq;
5-
using System.Text;
6-
using System.Threading.Tasks;
1+
using System.Collections.Concurrent;
2+
using PCLIssueHelper.Similaries;
73

84
namespace PCLIssueHelper
95
{
@@ -18,23 +14,55 @@ public IssueSimilarityChecker(List<Issues> issues)
1814

1915
public (IOrderedEnumerable<KeyValuePair<string, double>>, IOrderedEnumerable<KeyValuePair<string, double>>) CheckSimilarity(string title, string body)
2016
{
21-
Dictionary<string, double> check1 = new();
22-
Dictionary<string, double> check2 = new();
17+
ConcurrentDictionary<string, double> check1 = new();
18+
ConcurrentDictionary<string, double> check2 = new();
2319
var checker = new Jaccard();
24-
foreach (var issue in _issues)
20+
//foreach (var issue in _issues)
21+
//{
22+
// var _body = issue.body ?? "";
23+
// _body = BodyReplace(_body);
24+
25+
// var similarity1 = checker.Similarity(title, issue.title ?? "");
26+
// var similarity2 = checker.Similarity(body, _body);
27+
// if (similarity1 != 0)
28+
// {
29+
// check1.Add(issue.number.ToString() ?? "", similarity1);
30+
// }
31+
// if (similarity2 != 0)
32+
// {
33+
// check2.Add(issue.number.ToString() ?? "", similarity2);
34+
// }
35+
//}
36+
Parallel.ForEach(_issues, issue =>
2537
{
2638
var _body = issue.body ?? "";
27-
_body = _body
39+
_body = BodyReplace(_body);
40+
41+
var similarity1 = checker.Similarity(title, issue.title ?? "");
42+
var similarity2 = checker.Similarity(body, _body);
43+
if (similarity1 != 0)
44+
{
45+
//check1.Add(issue.number.ToString() ?? "", similarity1);
46+
check1.AddOrUpdate(issue.number.ToString() ?? "", similarity1, (x, y) => y);
47+
}
48+
if (similarity2 != 0)
49+
{
50+
//check2.Add(issue.number.ToString() ?? "", similarity2);
51+
check2.AddOrUpdate(issue.number.ToString() ?? "", similarity2, (x, y) => y);
52+
}
53+
});
54+
var result1 = check1.OrderByDescending(x => x.Value);
55+
var result2 = check2.OrderByDescending(x => x.Value);
56+
return (result1, result2);
57+
}
58+
59+
private static string BodyReplace(string body)
60+
{
61+
return body
2862
.Replace("""我已在 [Issues 页面](https://github.com/Hex-Dragon/PCL2/issues?q=is%3Aissue+) 和 [常见&难检反馈及问题列表](https://github.com/Hex-Dragon/PCL2/discussions/1930) 中搜索,确认了这一建议未被提交过。""", "")
2963
.Replace("""我已查看 [功能投票页面](https://github.com/Hex-Dragon/PCL2/discussions/categories/%E5%8A%9F%E8%83%BD%E6%8A%95%E7%A5%A8/),确认了这一建议未在投票列表中。""", "")
3064
.Replace("""**我所启动的游戏不是整合包,且未安装任何 Mod。** 安装 Mod 后的游戏崩溃基本不是 PCL 的原因,请 **不要** 提交反馈。你可以在论坛或社区找人求助,但这里并不是你求助的地方。\n- [X] **我已尝试使用 HMCL 启动,HMCL 没有出现问题。** 如果 HMCL 也无法启动就不是 PCL 导致的问题,请 **不要** 提交反馈。[下载 HMCL](https://hmcl.huangyuhui.net/download)""", "")
3165
.Replace("""我已在 [Issues 页面](https://github.com/Hex-Dragon/PCL2/issues?q=is%3Aissue+) 和 [常见&难检反馈及问题列表](https://github.com/Hex-Dragon/PCL2/discussions/1930) 中搜索,确认了这一 Bug 未被提交过。""", "");
32-
check1.Add(issue.number.ToString() ?? "", checker.Similarity(title, issue.title ?? ""));
33-
check2.Add(issue.number.ToString() ?? "", checker.Similarity(body, _body));
34-
}
35-
var result1 = check1.OrderByDescending(x => x.Value);
36-
var result2 = check2.OrderByDescending(x => x.Value);
37-
return (result1, result2);
3866
}
3967
}
4068
}

PCLIssueHelper/PCLIssueHelper.csproj

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="F23.StringSimilarity" Version="6.0.0" />
12+
<PackageReference Include="jieba.NET" Version="0.42.2" />
1313
<PackageReference Include="Markdig" Version="0.38.0" />
1414
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2903.40" />
1515
</ItemGroup>
@@ -33,6 +33,36 @@
3333
<None Update="issues.json">
3434
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
3535
</None>
36+
<None Update="Resources\char_state_tab.json">
37+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
38+
</None>
39+
<None Update="Resources\cn_synonym.txt">
40+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
41+
</None>
42+
<None Update="Resources\dict.txt">
43+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
44+
</None>
45+
<None Update="Resources\idf.txt">
46+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
47+
</None>
48+
<None Update="Resources\pos_prob_emit.json">
49+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
50+
</None>
51+
<None Update="Resources\pos_prob_start.json">
52+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
53+
</None>
54+
<None Update="Resources\pos_prob_trans.json">
55+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
56+
</None>
57+
<None Update="Resources\prob_emit.json">
58+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
59+
</None>
60+
<None Update="Resources\prob_trans.json">
61+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
62+
</None>
63+
<None Update="Resources\stopwords.txt">
64+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
65+
</None>
3666
</ItemGroup>
3767

3868
</Project>

0 commit comments

Comments
 (0)