public static string GetCompleteTitle(redux_items redux) { var match = titlePartFromDescription.Match(redux.short_description); if (match.Success) { string maintitle; var stripMatch = strip.Match(redux.programme_name); if (stripMatch.Success && stripMatch.Value.Length > 0) { maintitle = redux.programme_name.Substring(0, redux.programme_name.Length - stripMatch.Value.Length); } else { maintitle = redux.programme_name; } int firstNonFullStop = 0; while (match.Value[firstNonFullStop] == '.') { firstNonFullStop++; } string joinedTitle = maintitle.Trim() + " " + match.Value.Substring(firstNonFullStop).Trim(); return joinedTitle; } return redux.programme_name; }
public static bool IsPartialTitleMatch(redux_items redux, pips_programmes pips) { if (redux == null || pips == null) { return false; } string reduxtitle = GetCompleteTitle(redux); if (PartialMatch.IsPartialMatch(reduxtitle, pips.display_title)) { return true; } return false; }
public static bool IsPartialTitleMatchWithDescription(redux_items redux, pips_programmes pips) { if (redux == null || pips == null) { return false; } string reduxtitle = GetCompleteTitle(redux); if (PartialMatch.IsPartialMatch(reduxtitle, pips.display_title)) { return true; } if (PartialMatch.IsPartialMatch(reduxtitle, pips.display_subtitle)) { return true; } string reduxdesc = redux.short_description; if (reduxdesc.Contains("] Followed by ")) { reduxdesc = reduxdesc.Substring(0, reduxdesc.IndexOf("] Followed by ")); } if (reduxdesc.Contains("] Then ")) { reduxdesc = reduxdesc.Substring(0, reduxdesc.IndexOf("] Then ")); } return PartialMatch.IsPartialMatch(redux.programme_name + " " + reduxdesc, pips.display_title + " " + pips.display_subtitle + " " + pips.description); }
public static double GetSimpleWeighting(redux_items redux, pips_programmes pips) { if (IsGoodTitleMatch(redux, pips)) { return 100.0; } if (IsPartialTitleMatch(redux, pips)) { return 10.0; } if (IsPartialTitleMatchWithDescription(redux, pips)) { return 1.0; } return 0.0; }
public static bool IsGoodTitleMatch(redux_items redux, pips_programmes pips) { if (redux == null || pips == null) { return false; } string reduxtitle = NormaliseTitle(GetCompleteTitle(redux)); string pipstitle = NormaliseTitle(pips.display_title); if (reduxtitle == pipstitle) { return true; } if (reduxtitle == NormaliseTitle(pips.display_subtitle)) { return true; } return false; }
public static ScheduleMatchData GetScheduleWeighting(redux_items redux, pips_programmes pips) { ScheduleMatchData data = new ScheduleMatchData(); data.StartDistance = Math.Abs((redux.aired - pips.start_gmt).TotalSeconds); data.DurationDelta = Math.Abs(redux.duration - (pips.end_gmt - pips.start_gmt).TotalSeconds); DateTime maxstart = pips.start_gmt; if (redux.aired > pips.start_gmt) { maxstart = redux.aired; } DateTime minend = pips.end_gmt; if (redux.aired.AddSeconds(redux.duration) < minend) { minend = redux.aired.AddSeconds(redux.duration); } var overlap = minend - maxstart; if (overlap.TotalSeconds < 0) { data.OverlapWeight = 0.0; } else { data.OverlapWeight = 100.0 * (overlap.TotalSeconds / (double)redux.duration) + 100.0 * (overlap.TotalSeconds / (pips.end_gmt - pips.start_gmt).TotalSeconds); } return data; }
public static double GetMatchWeighting(redux_items redux, pips_programmes pips) { var titlematch = Match(redux.programme_name, pips.display_title); var partialmatch = Match(pips.display_title + " " + pips.display_subtitle + " " + pips.description, redux.programme_name + " " + redux.short_description); double weight = 1; if (titlematch.PercentFirstInSecond > 0) { weight = weight * titlematch.PercentFirstInSecond * 2; } if (titlematch.PercentSecondInFirst > 0) { weight = weight * titlematch.PercentSecondInFirst * 2; } if (partialmatch.PercentFirstInSecond > 0) { weight = weight * partialmatch.PercentFirstInSecond; } if (partialmatch.PercentSecondInFirst > 0) { weight = weight * partialmatch.PercentSecondInFirst; } return weight; }
/// <summary> /// Deprecated Method for adding a new object to the redux_items EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToredux_items(redux_items redux_items) { base.AddObject("redux_items", redux_items); }
/// <summary> /// Create a new redux_items object. /// </summary> /// <param name="id">Initial value of the id property.</param> /// <param name="duration">Initial value of the duration property.</param> /// <param name="service_id">Initial value of the service_id property.</param> /// <param name="aired">Initial value of the aired property.</param> /// <param name="has_live_subtitles">Initial value of the has_live_subtitles property.</param> /// <param name="created_at">Initial value of the created_at property.</param> /// <param name="updated_at">Initial value of the updated_at property.</param> public static redux_items Createredux_items(global::System.Int32 id, global::System.Int32 duration, global::System.Int32 service_id, global::System.DateTime aired, global::System.Boolean has_live_subtitles, global::System.DateTime created_at, global::System.DateTime updated_at) { redux_items redux_items = new redux_items(); redux_items.id = id; redux_items.duration = duration; redux_items.service_id = service_id; redux_items.aired = aired; redux_items.has_live_subtitles = has_live_subtitles; redux_items.created_at = created_at; redux_items.updated_at = updated_at; return redux_items; }
/// <summary> /// Create a new redux_items object. /// </summary> /// <param name="id">Initial value of the id property.</param> public static redux_items Createredux_items(global::System.Int32 id) { redux_items redux_items = new redux_items(); redux_items.id = id; return redux_items; }