|
@@ -27,6 +27,7 @@ public class FeatureTransform {
|
|
|
private static final List<String> videoSimAttrs = Arrays.asList("title", "cate2", "cate2_list", "keywords");
|
|
|
private static final List<String> hVideoSimAttrs = Arrays.asList("title");
|
|
|
private static final List<String> cfList = Arrays.asList("share", "return");
|
|
|
+ private static final List<String> userAttrList = Arrays.asList("province", "city", "model", "brand", "system");
|
|
|
|
|
|
public static void getContextFeature(long currentMs, Map<String, Double> featureMap) {
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
@@ -46,7 +47,7 @@ public class FeatureTransform {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static void getUserProfileFeature(UserShareReturnProfile profile, Map<String, Double> featMap) {
|
|
|
+ public static void getUserProfileFeature(UserShareReturnProfile profile, Map<String, String> userInfo, Map<String, Double> featMap) {
|
|
|
if (null != profile) {
|
|
|
long s_pv = profile.getS_pv(); // share_pv(分享pv)
|
|
|
long s_cnt = profile.getS_cnt(); // share_cnt(分享次数)
|
|
@@ -75,6 +76,17 @@ public class FeatureTransform {
|
|
|
featMap.put("c9_ros_minus", ros_minus);
|
|
|
}
|
|
|
}
|
|
|
+ if (null != userInfo && !userInfo.isEmpty()) {
|
|
|
+ for (String attr : userAttrList) {
|
|
|
+ if (userInfo.containsKey(attr)) {
|
|
|
+ String value = userInfo.get(attr).trim().replaceAll("(\\s*|\t|:)", "_");
|
|
|
+ if (!value.isEmpty()) {
|
|
|
+ String key = String.format("%s@%s", attr, value.toLowerCase());
|
|
|
+ featMap.put(key, 1.0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public static void getUserTagsCrossVideoFeature(String prefix, Map<String, String> videoInfo, Map<String, String> infoMap, Map<String, Double> featMap) {
|