|
@@ -1,5 +1,6 @@
|
|
|
package com.aliyun.odps.spark.examples.myUtils;
|
|
|
|
|
|
+import com.tzld.piaoquan.recommend.similarity.word2vec.Segment;
|
|
|
import examples.utils.SimilarityUtils;
|
|
|
|
|
|
import java.util.*;
|
|
@@ -246,7 +247,7 @@ public class FeatureTransformV2 {
|
|
|
getTwoVideoCrossFeature("hr_sim", videoSimAttrs, headInfo, rankInfo, featMap);
|
|
|
}
|
|
|
|
|
|
- public static void getCreativeFeature(String prefix, Map<String, String> creativeInfo, Map<String, String> rankInfo, Map<String, Double> featMap) {
|
|
|
+ public static void getCreativeBaseFeature(String prefix, Map<String, String> creativeInfo, Map<String, Double> featMap) {
|
|
|
if (null == creativeInfo || creativeInfo.isEmpty()) {
|
|
|
return;
|
|
|
}
|
|
@@ -257,6 +258,21 @@ public class FeatureTransformV2 {
|
|
|
featMap.put(key, 1.0);
|
|
|
}
|
|
|
}
|
|
|
+ if (creativeInfo.containsKey("name")) {
|
|
|
+ String name = creativeInfo.get("name");
|
|
|
+ if (null != name && !name.isEmpty()) {
|
|
|
+ List<String> words = Segment.getWords(name);
|
|
|
+ for (String word : words) {
|
|
|
+ if (null != word && word.length() > 1) {
|
|
|
+ String key = String.format("%s@name@%s", prefix, word);
|
|
|
+ featMap.put(key, 1.0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void getCreativeCrossFeature(String prefix, Map<String, String> creativeInfo, Map<String, String> rankInfo, Map<String, Double> featMap) {
|
|
|
getTwoVideoCrossFeature(prefix, creativeSimAttrs, creativeInfo, rankInfo, featMap);
|
|
|
}
|
|
|
|