|
@@ -44,7 +44,9 @@ using Hotline.Share.Enums.FlowEngine;
|
|
using Hotline.Authentications;
|
|
using Hotline.Authentications;
|
|
using MediatR;
|
|
using MediatR;
|
|
using Hotline.Share.Mq;
|
|
using Hotline.Share.Mq;
|
|
|
|
+using JiebaNet.Segmenter;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
+using WordInfo = PanGu.WordInfo;
|
|
|
|
|
|
namespace Hotline.Application.Orders;
|
|
namespace Hotline.Application.Orders;
|
|
|
|
|
|
@@ -329,34 +331,39 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
if (word is { WordType: WordType.SimplifiedChinese, Word.Length: > 1 })
|
|
if (word is { WordType: WordType.SimplifiedChinese, Word.Length: > 1 })
|
|
words.Add(splitWords.ElementAt(i).Word);
|
|
words.Add(splitWords.ElementAt(i).Word);
|
|
}
|
|
}
|
|
|
|
+ //var a = words;
|
|
if (words.Any())
|
|
if (words.Any())
|
|
{
|
|
{
|
|
var vector = await _repositoryts.SearchAsync(orderId, cancellationToken);
|
|
var vector = await _repositoryts.SearchAsync(orderId, cancellationToken);
|
|
if (vector != null && vector.Any()) await _repositoryts.UpdateVectorAsync(orderId, words, cancellationToken);
|
|
if (vector != null && vector.Any()) await _repositoryts.UpdateVectorAsync(orderId, words, cancellationToken);
|
|
else await _repositoryts.AddVectorAsync(orderId, time, words, cancellationToken);
|
|
else await _repositoryts.AddVectorAsync(orderId, time, 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);
|
|
|
|
- //}
|
|
|
|
- }
|
|
|
|
|
|
+ //var segmenter = new JiebaSegmenter();
|
|
|
|
+ //var segments1 = segmenter.Cut(inputStr, cutAll: true);
|
|
|
|
+ //var b = segments1;
|
|
|
|
+ //var c = 1;
|
|
|
|
+ //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)
|
|
{
|
|
{
|