|
@@ -2,12 +2,14 @@ package examples.extractor.v20250218;
|
|
|
|
|
|
import examples.extractor.ExtractorUtils;
|
|
|
import examples.extractor.RankExtractorFeature_20240530;
|
|
|
+import examples.utils.FestiveUtil;
|
|
|
import examples.utils.SimilarityUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
import java.time.Instant;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.ZoneId;
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
@@ -60,10 +62,9 @@ public class ExtractFeature20250218 {
|
|
|
Object size = videoFeature.getOrDefault("size", "0d");
|
|
|
Object bit_rate = videoFeature.getOrDefault("bit_rate", "0d");
|
|
|
String festiveLabel1 = videoFeature.getOrDefault("festive_label1", "").toString();
|
|
|
+ String festiveLabel2 = videoFeature.getOrDefault("festive_label2", "").toString();
|
|
|
|
|
|
- long createTs = Long.parseLong(videoFeature.getOrDefault("gmt_create_timestamp", "0").toString());
|
|
|
|
|
|
- featureMap.put("create_ts_diff", ExtractorUtils.getDaysBetween(createTs, ts));
|
|
|
featureMap.put("total_time", totalTime);
|
|
|
featureMap.put("width", width);
|
|
|
featureMap.put("height", height);
|
|
@@ -81,6 +82,21 @@ public class ExtractFeature20250218 {
|
|
|
LocalDateTime now = LocalDateTime.ofInstant(Instant.ofEpochSecond(ts), ZoneId.systemDefault());
|
|
|
featureMap.put("hour_" + now.getHour(), "0.1");
|
|
|
featureMap.put("day_of_week" + now.getDayOfWeek(), "0.1");
|
|
|
+
|
|
|
+ long createTs = Long.parseLong(videoFeature.getOrDefault("gmt_create_timestamp", "0").toString());
|
|
|
+ featureMap.put("create_ts_diff", ExtractorUtils.getDaysBetween(createTs, ts));
|
|
|
+
|
|
|
+ String date = LocalDateTime.ofInstant(Instant.ofEpochSecond(ts), ZoneId.systemDefault()).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
|
|
+ String festiveByDate = FestiveUtil.getFestiveByDate(date);
|
|
|
+ featureMap.put("today_is_fes", 0);
|
|
|
+ featureMap.put("video_fes_eq", 0);
|
|
|
+ if (StringUtils.isNotBlank(festiveByDate)) {
|
|
|
+ featureMap.put("today_is_fes", 1);
|
|
|
+ if (StringUtils.equals(festiveByDate, festiveLabel2)) {
|
|
|
+ featureMap.put("video_fes_eq", 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public static void handleC1(Map<String, Object> c1Feature, Map<String, Object> featureMap) {
|