|
@@ -36,6 +36,8 @@ using Hotline.Repository.SqlSugar.System;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Hotline.Share.Dtos.Bi;
|
|
using Hotline.Share.Dtos.Bi;
|
|
using System.Net;
|
|
using System.Net;
|
|
|
|
+using PanGu;
|
|
|
|
+using Hotline.Users;
|
|
|
|
|
|
namespace Hotline.Application.Orders;
|
|
namespace Hotline.Application.Orders;
|
|
|
|
|
|
@@ -290,27 +292,38 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
public async Task OrderParticiple(string inputStr, string orderId, CancellationToken cancellationToken)
|
|
public async Task OrderParticiple(string inputStr, string orderId, CancellationToken cancellationToken)
|
|
{
|
|
{
|
|
- var words = await _orderWrodRepository.Queryable().Where(x => x.IsEnable == 1 && x.Classify.Contains("普通标签")).Select(x => x.Tag).ToListAsync(cancellationToken);
|
|
|
|
- var res = new List<string>();
|
|
|
|
- if (words.Any()) res = ParticipleTool.SegMMDouble(inputStr, ref words);
|
|
|
|
- var participles = await _orderWrodRepository.Queryable().In(x => x.Tag, res).ToListAsync(cancellationToken);
|
|
|
|
- if (participles.Any())
|
|
|
|
|
|
+ var seg = new Segment();
|
|
|
|
+ ICollection<WordInfo> splitWords = seg.DoSegment(inputStr);
|
|
|
|
+ var words = new List<string>();
|
|
|
|
+ for (int i = 0; i < splitWords.Count; i++)
|
|
{
|
|
{
|
|
- //关键词
|
|
|
|
- var tags = participles.Select(x => x.Tag).ToList();
|
|
|
|
- var tagsStr = string.Join(",", tags);
|
|
|
|
- await _orderRepository.Updateable().SetColumns(x => x.TagNames == tagsStr).Where(x => x.Id == orderId).ExecuteCommandAsync(cancellationToken);
|
|
|
|
- List<string> synonyms = participles.Select(x => x.Synonym).ToList();
|
|
|
|
- if (synonyms.Any())
|
|
|
|
- {
|
|
|
|
- var synonymsStr = string.Join(",", synonyms);
|
|
|
|
- synonyms = synonymsStr.Split(",").Distinct().ToList();
|
|
|
|
- tags.AddRange(synonyms);
|
|
|
|
- }
|
|
|
|
- var vector = await _orderRepository.Queryable().Where(x => x.Id == orderId).ToListAsync(cancellationToken);
|
|
|
|
- if (vector.Any()) await _repositoryts.UpdateVectorAsync(orderId, tags, cancellationToken);
|
|
|
|
- else await _repositoryts.AddVectorAsync(orderId, DateTime.Now, tags, cancellationToken);
|
|
|
|
- }
|
|
|
|
|
|
+ words.Add(splitWords.ElementAt(i).Word);
|
|
|
|
+ }
|
|
|
|
+ var vector = await _orderRepository.Queryable().Where(x => x.Id == orderId).ToListAsync(cancellationToken);
|
|
|
|
+ if (vector.Any()) await _repositoryts.UpdateVectorAsync(orderId, words, cancellationToken);
|
|
|
|
+ else await _repositoryts.AddVectorAsync(orderId, DateTime.Now, words, cancellationToken);
|
|
|
|
+
|
|
|
|
+ //var words = await _orderWrodRepository.Queryable().Where(x => x.IsEnable == 1 && x.Classify.Contains("普通标签")).Select(x => x.Tag).ToListAsync(cancellationToken);
|
|
|
|
+ //var res = new List<string>();
|
|
|
|
+ //if (words.Any()) res = ParticipleTool.SegMMDouble(inputStr, ref words);
|
|
|
|
+ //var participles = await _orderWrodRepository.Queryable().In(x => x.Tag, res).ToListAsync(cancellationToken);
|
|
|
|
+ //if (participles.Any())
|
|
|
|
+ //{
|
|
|
|
+ // //关键词
|
|
|
|
+ // var tags = participles.Select(x => x.Tag).ToList();
|
|
|
|
+ // var tagsStr = string.Join(",", tags);
|
|
|
|
+ // await _orderRepository.Updateable().SetColumns(x => x.TagNames == tagsStr).Where(x => x.Id == orderId).ExecuteCommandAsync(cancellationToken);
|
|
|
|
+ // List<string> synonyms = participles.Select(x => x.Synonym).ToList();
|
|
|
|
+ // if (synonyms.Any())
|
|
|
|
+ // {
|
|
|
|
+ // var synonymsStr = string.Join(",", synonyms);
|
|
|
|
+ // synonyms = synonymsStr.Split(",").Distinct().ToList();
|
|
|
|
+ // tags.AddRange(synonyms);
|
|
|
|
+ // }
|
|
|
|
+ // var vector = await _orderRepository.Queryable().Where(x => x.Id == orderId).ToListAsync(cancellationToken);
|
|
|
|
+ // if (vector.Any()) await _repositoryts.UpdateVectorAsync(orderId, tags, cancellationToken);
|
|
|
|
+ // else await _repositoryts.AddVectorAsync(orderId, DateTime.Now, tags, cancellationToken);
|
|
|
|
+ //}
|
|
}
|
|
}
|
|
|
|
|
|
public async Task OrderSensitiveParticiple(string inputStr, string orderId, CancellationToken cancellationToken)
|
|
public async Task OrderSensitiveParticiple(string inputStr, string orderId, CancellationToken cancellationToken)
|