|
@@ -869,24 +869,29 @@ public class RankStrategyBy683 extends RankStrategyBasic {
|
|
|
private Map<String, String> featureBucket(Map<String, String> featureMap) {
|
|
|
Map<String, String> newFeatureMap = new ConcurrentHashMap<>(featureMap.size());
|
|
|
for (Map.Entry<String, String> entry : featureMap.entrySet()) {
|
|
|
- String name = entry.getKey();
|
|
|
- if (this.sparseFeatureSet.contains(name)) {
|
|
|
- if (entry.getValue() != null) {
|
|
|
- newFeatureMap.put(name, entry.getValue());
|
|
|
+ try {
|
|
|
+ String name = entry.getKey();
|
|
|
+ if (this.sparseFeatureSet.contains(name)) {
|
|
|
+ if (entry.getValue() != null) {
|
|
|
+ newFeatureMap.put(name, entry.getValue());
|
|
|
+ }
|
|
|
+ continue;
|
|
|
}
|
|
|
- continue;
|
|
|
- }
|
|
|
- double score = Double.parseDouble(entry.getValue());
|
|
|
- // 注意:0值、不在分桶文件中的特征,会被过滤掉。
|
|
|
- if (score > 1E-8) {
|
|
|
- if (this.bucketsMap.containsKey(name) && this.bucketsLen.containsKey(name)) {
|
|
|
- double[] buckets = this.bucketsMap.get(name);
|
|
|
- double bucketNum = this.bucketsLen.get(name);
|
|
|
- Double scoreNew = 1.0 / bucketNum * (ExtractorUtils.findInsertPosition(buckets, score) + 1.0);
|
|
|
- newFeatureMap.put(name, String.valueOf(scoreNew));
|
|
|
- } else {
|
|
|
- newFeatureMap.put(name, String.valueOf(score));
|
|
|
+
|
|
|
+ double score = Double.parseDouble(entry.getValue());
|
|
|
+ // 注意:0值、不在分桶文件中的特征,会被过滤掉。
|
|
|
+ if (score > 1E-8) {
|
|
|
+ if (this.bucketsMap.containsKey(name) && this.bucketsLen.containsKey(name)) {
|
|
|
+ double[] buckets = this.bucketsMap.get(name);
|
|
|
+ double bucketNum = this.bucketsLen.get(name);
|
|
|
+ Double scoreNew = 1.0 / bucketNum * (ExtractorUtils.findInsertPosition(buckets, score) + 1.0);
|
|
|
+ newFeatureMap.put(name, String.valueOf(scoreNew));
|
|
|
+ } else {
|
|
|
+ newFeatureMap.put(name, String.valueOf(score));
|
|
|
+ }
|
|
|
}
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("featureBucket error: ", e);
|
|
|
}
|
|
|
}
|
|
|
return newFeatureMap;
|