Allow multiple classifications.

This commit is contained in:
botsharp2018 2018-09-08 20:51:16 -05:00
parent 5c3d3fea64
commit 378bd43f09
4 changed files with 7 additions and 4 deletions

View file

@ -45,7 +45,7 @@ namespace BotSharp.NLP.UnitTest
testData.ForEach(td =>
{
var classes = classifier.Classify(td);
if(td.Label == classes[0].Item1)
if(td.Labels[0] == classes[0].Item1)
{
correct++;
}

View file

@ -38,7 +38,7 @@ namespace BotSharp.NLP.Classify
{
_classifier.Train(sentences.Select(x => new LabeledFeatureSet
{
Label = x.Label,
Label = x.Labels[0],
Features = GetFeatures(x.Words)
}).ToList(), _options);
}

View file

@ -26,7 +26,7 @@ namespace BotSharp.NLP.Corpus
{
sentences.Add(new Sentence
{
Label = lable,
Labels = new List<string> { lable },
Text = line
});
}

View file

@ -9,7 +9,10 @@ namespace BotSharp.NLP
{
public List<Token> Words { get; set; }
public String Label { get; set; }
/// <summary>
/// Allow multiple classification
/// </summary>
public List<String> Labels { get; set; }
public String Text { get; set; }
}