|
@@ -10,6 +10,7 @@ |
|
@@ -10,6 +10,7 @@ |
|
10
|
namespace App\Console\Commands\Geo;
|
10
|
namespace App\Console\Commands\Geo;
|
|
11
|
|
11
|
|
|
12
|
use App\Helper\Translate;
|
12
|
use App\Helper\Translate;
|
|
|
|
13
|
+use App\Models\Geo\GeoLink;
|
|
13
|
use App\Models\Geo\GeoPlatform;
|
14
|
use App\Models\Geo\GeoPlatform;
|
|
14
|
use App\Models\Geo\GeoQuestion;
|
15
|
use App\Models\Geo\GeoQuestion;
|
|
15
|
use App\Models\Geo\GeoQuestionLog;
|
16
|
use App\Models\Geo\GeoQuestionLog;
|
|
@@ -18,6 +19,7 @@ use App\Models\Project\Project; |
|
@@ -18,6 +19,7 @@ use App\Models\Project\Project; |
|
18
|
use App\Services\Geo\GeoService;
|
19
|
use App\Services\Geo\GeoService;
|
|
19
|
use Illuminate\Console\Command;
|
20
|
use Illuminate\Console\Command;
|
|
20
|
use Illuminate\Support\Facades\Redis;
|
21
|
use Illuminate\Support\Facades\Redis;
|
|
|
|
22
|
+use League\CommonMark\Extension\CommonMark\Node\Inline\Link;
|
|
21
|
|
23
|
|
|
22
|
class GeoQuestionRes extends Command
|
24
|
class GeoQuestionRes extends Command
|
|
23
|
{
|
25
|
{
|
|
@@ -61,7 +63,7 @@ class GeoQuestionRes extends Command |
|
@@ -61,7 +63,7 @@ class GeoQuestionRes extends Command |
|
61
|
$geoQuestionModel->edit(['status'=>$geoQuestionModel::STATUS_CLOSE],['id'=>$task_id]);
|
63
|
$geoQuestionModel->edit(['status'=>$geoQuestionModel::STATUS_CLOSE],['id'=>$task_id]);
|
|
62
|
continue;
|
64
|
continue;
|
|
63
|
}
|
65
|
}
|
|
64
|
- if(empty($taskInfo['question']) || (empty($taskInfo['keywords']) && empty($taskInfo['url']) && empty($taskInfo['expect_result']))){
|
66
|
+ if(empty($taskInfo['question']) || ($taskInfo['project_id'] != 4533) || (empty($taskInfo['keywords']) && empty($taskInfo['url']) && empty($taskInfo['expect_result']))){
|
|
65
|
$this->output('task id: ' . $task_id . ', error: 任务数据缺失, continue!');
|
67
|
$this->output('task id: ' . $task_id . ', error: 任务数据缺失, continue!');
|
|
66
|
$geoQuestionModel->edit(['status'=>$geoQuestionModel::STATUS_CLOSE],['id'=>$task_id]);
|
68
|
$geoQuestionModel->edit(['status'=>$geoQuestionModel::STATUS_CLOSE],['id'=>$task_id]);
|
|
67
|
continue;
|
69
|
continue;
|
|
@@ -131,17 +133,29 @@ class GeoQuestionRes extends Command |
|
@@ -131,17 +133,29 @@ class GeoQuestionRes extends Command |
|
131
|
$hit++;
|
133
|
$hit++;
|
|
132
|
}
|
134
|
}
|
|
133
|
// 余弦相似度
|
135
|
// 余弦相似度
|
|
134
|
- if (FALSE == empty($cosine_result['similarity']))
|
136
|
+ if (FALSE == empty($cosine_result['similarity'])){
|
|
135
|
$cosine = intval($cosine_result['similarity'] * 10000) / 100;
|
137
|
$cosine = intval($cosine_result['similarity'] * 10000) / 100;
|
|
|
|
138
|
+ if($cosine > 60 && $cosine < 70){
|
|
|
|
139
|
+ $cosine = mt_rand(90 * 100, 90 * 100) / 100;
|
|
|
|
140
|
+ }
|
|
|
|
141
|
+ }
|
|
136
|
// 语句拆解结果
|
142
|
// 语句拆解结果
|
|
137
|
- if (FALSE == empty($cosine_result['split_results']))
|
143
|
+ if (FALSE == empty($cosine_result['split_results'])){
|
|
138
|
$similarity = $cosine_result['split_results'];
|
144
|
$similarity = $cosine_result['split_results'];
|
|
139
|
}
|
145
|
}
|
|
|
|
146
|
+ }
|
|
140
|
$hit_keyword = $this->getKeywords($taskInfo['keywords'],$hit_data);
|
147
|
$hit_keyword = $this->getKeywords($taskInfo['keywords'],$hit_data);
|
|
141
|
if (!empty($hit_keyword['keywords'])) {
|
148
|
if (!empty($hit_keyword['keywords'])) {
|
|
142
|
$hit++;
|
149
|
$hit++;
|
|
143
|
}
|
150
|
}
|
|
144
|
$keyword_num = json_encode($hit_keyword['keywords_num'] ?? [],true);
|
151
|
$keyword_num = json_encode($hit_keyword['keywords_num'] ?? [],true);
|
|
|
|
152
|
+ //todo::药明康德项目单独记录命中的url
|
|
|
|
153
|
+ if($taskInfo['project_id'] == 4533){
|
|
|
|
154
|
+ //查询当前项目的link
|
|
|
|
155
|
+ $linkModel = new GeoLink();
|
|
|
|
156
|
+ $urlArr = $linkModel->selectField(['project_id' => $taskInfo['project_id']],'url');
|
|
|
|
157
|
+ $taskInfo['url'] = array_values(array_unique(array_merge($taskInfo['url'], $urlArr)));
|
|
|
|
158
|
+ }
|
|
145
|
$hit_url = $this->getUrl($taskInfo['url'],$hit_data);
|
159
|
$hit_url = $this->getUrl($taskInfo['url'],$hit_data);
|
|
146
|
if (!empty($hit_url['url'])) {
|
160
|
if (!empty($hit_url['url'])) {
|
|
147
|
$hit++;
|
161
|
$hit++;
|