Skip to content

Commit

Permalink
番組タイトルからタイトルを抽出するやつ追加 silane#7
Browse files Browse the repository at this point in the history
  • Loading branch information
noriokun4649 committed Mar 15, 2021
1 parent 505c7b5 commit 57e6e63
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions TVTComment/Model/TwitterUtils/AnnimeTitleGetter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System.Text.RegularExpressions;

namespace TVTComment.Model.TwitterUtils
{
class AnnimeTitleGetter
{
const string flag = @"\[新\]|\[終\]|\[再\]|\[字\]|\[デ\]|\[解\]|\[無\]|\[二\]|\[S\]|\[SS\]|\[初\]|\[生\]|\[N\]|\[映\]|\[多\]|\[双\]";
const string subtitleflag = @"「.+」|【.+】|▽.+ |▼.+|◆.+|★.+";
const string tvIndex = @"[##♯](?<index>[0-90-9]{1,3})|[第](?<index>[0-90-9]{1,3})[話回]";

public static string Convert(string eventname)
{
var series = Regex.Replace(Regex.Replace(eventname, " ", " "), flag + "|" + subtitleflag + "|" + tvIndex, "");
if (series.Split(' ').Length > 1)
{
series = series.Split(' ')[0];
}
return series;
}
}
}

0 comments on commit 57e6e63

Please sign in to comment.