Skip to content

Commit

Permalink
1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Hill23333 committed Dec 1, 2024
1 parent 2285f58 commit dbabf55
Show file tree
Hide file tree
Showing 15 changed files with 848,072 additions and 20 deletions.
2 changes: 1 addition & 1 deletion PCLIssueHelper/FormMain.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions PCLIssueHelper/FormMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ private void 关于AToolStripMenuItem_Click(object sender, EventArgs e)
taskDialogPage.Heading = "关于 PCL Issue Helper";
taskDialogPage.Icon = TaskDialogIcon.Information;
taskDialogPage.Text = """
版本: 1.0.1
版本: 1.0.2
作者: Hill233
开放源代码许可:
<a href="https://github.com/feature23/StringSimilarity.NET/blob/main/LICENSE">StringSimilarity.NET</a> Copyright © 2015 feature[23]
<a href="https://github.com/anderscui/jieba.NET/blob/master/LICENSE">jieba.NET</a> Copyright © 2015 andersc
<a href="https://github.com/xoofx/markdig/blob/master/license.txt">MarkDig</a> Copyright © 2018-2019, Alexandre Mutel All rights reserved.
""";

Expand Down
60 changes: 44 additions & 16 deletions PCLIssueHelper/IssueSimilarityChecker.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
using F23.StringSimilarity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Concurrent;
using PCLIssueHelper.Similaries;

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

public (IOrderedEnumerable<KeyValuePair<string, double>>, IOrderedEnumerable<KeyValuePair<string, double>>) CheckSimilarity(string title, string body)
{
Dictionary<string, double> check1 = new();
Dictionary<string, double> check2 = new();
ConcurrentDictionary<string, double> check1 = new();
ConcurrentDictionary<string, double> check2 = new();
var checker = new Jaccard();
foreach (var issue in _issues)
//foreach (var issue in _issues)
//{
// var _body = issue.body ?? "";
// _body = BodyReplace(_body);

// var similarity1 = checker.Similarity(title, issue.title ?? "");
// var similarity2 = checker.Similarity(body, _body);
// if (similarity1 != 0)
// {
// check1.Add(issue.number.ToString() ?? "", similarity1);
// }
// if (similarity2 != 0)
// {
// check2.Add(issue.number.ToString() ?? "", similarity2);
// }
//}
Parallel.ForEach(_issues, issue =>
{
var _body = issue.body ?? "";
_body = _body
_body = BodyReplace(_body);

var similarity1 = checker.Similarity(title, issue.title ?? "");
var similarity2 = checker.Similarity(body, _body);
if (similarity1 != 0)
{
//check1.Add(issue.number.ToString() ?? "", similarity1);
check1.AddOrUpdate(issue.number.ToString() ?? "", similarity1, (x, y) => y);
}
if (similarity2 != 0)
{
//check2.Add(issue.number.ToString() ?? "", similarity2);
check2.AddOrUpdate(issue.number.ToString() ?? "", similarity2, (x, y) => y);
}
});
var result1 = check1.OrderByDescending(x => x.Value);
var result2 = check2.OrderByDescending(x => x.Value);
return (result1, result2);
}

private static string BodyReplace(string body)
{
return body
.Replace("""我已在 [Issues 页面](https://github.com/Hex-Dragon/PCL2/issues?q=is%3Aissue+) 和 [常见&难检反馈及问题列表](https://github.com/Hex-Dragon/PCL2/discussions/1930) 中搜索,确认了这一建议未被提交过。""", "")
.Replace("""我已查看 [功能投票页面](https://github.com/Hex-Dragon/PCL2/discussions/categories/%E5%8A%9F%E8%83%BD%E6%8A%95%E7%A5%A8/),确认了这一建议未在投票列表中。""", "")
.Replace("""**我所启动的游戏不是整合包,且未安装任何 Mod。** 安装 Mod 后的游戏崩溃基本不是 PCL 的原因,请 **不要** 提交反馈。你可以在论坛或社区找人求助,但这里并不是你求助的地方。\n- [X] **我已尝试使用 HMCL 启动,HMCL 没有出现问题。** 如果 HMCL 也无法启动就不是 PCL 导致的问题,请 **不要** 提交反馈。[下载 HMCL](https://hmcl.huangyuhui.net/download)""", "")
.Replace("""我已在 [Issues 页面](https://github.com/Hex-Dragon/PCL2/issues?q=is%3Aissue+) 和 [常见&难检反馈及问题列表](https://github.com/Hex-Dragon/PCL2/discussions/1930) 中搜索,确认了这一 Bug 未被提交过。""", "");
check1.Add(issue.number.ToString() ?? "", checker.Similarity(title, issue.title ?? ""));
check2.Add(issue.number.ToString() ?? "", checker.Similarity(body, _body));
}
var result1 = check1.OrderByDescending(x => x.Value);
var result2 = check2.OrderByDescending(x => x.Value);
return (result1, result2);
}
}
}
32 changes: 31 additions & 1 deletion PCLIssueHelper/PCLIssueHelper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="F23.StringSimilarity" Version="6.0.0" />
<PackageReference Include="jieba.NET" Version="0.42.2" />
<PackageReference Include="Markdig" Version="0.38.0" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2903.40" />
</ItemGroup>
Expand All @@ -33,6 +33,36 @@
<None Update="issues.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\char_state_tab.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\cn_synonym.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\dict.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\idf.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\pos_prob_emit.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\pos_prob_start.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\pos_prob_trans.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\prob_emit.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\prob_trans.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\stopwords.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
Loading

0 comments on commit dbabf55

Please sign in to comment.