finish the Predict API by putting the predict result in pipeline
This commit is contained in:
parent
fa2aaac3e6
commit
6e7f060c7d
|
|
@ -187,6 +187,19 @@ namespace BotSharp.Core.Engines.CRFsuite
|
||||||
|
|
||||||
var entities = new List<NlpEntity>();
|
var entities = new List<NlpEntity>();
|
||||||
//
|
//
|
||||||
|
string[] entityProbabilityPairs = output.Split("\r");
|
||||||
|
for (int i = 0 ; i < entityProbabilityPairs.Length ; i++)
|
||||||
|
{
|
||||||
|
string entityProbabilityPair = entityProbabilityPairs[i];
|
||||||
|
string entity = entityProbabilityPair.Split(":")[0];
|
||||||
|
decimal probability = decimal.Parse(entityProbabilityPair.Split(":")[1]);
|
||||||
|
NlpEntity nlpentity = new NlpEntity();
|
||||||
|
nlpentity.Entity = entity;
|
||||||
|
nlpentity.Value = tokens[0][i].Text;
|
||||||
|
nlpentity.Confidence = probability;
|
||||||
|
entities.Add(nlpentity);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
data["entities"] = JObject.FromObject(entities);
|
data["entities"] = JObject.FromObject(entities);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue