BotSharp/BotSharp.NLP/Classify/WordFeatureExtractor.cs
2018-09-09 22:56:32 -05:00

24 lines
682 B
C#

using System;
using System.Collections.Generic;
using System.Text;
using BotSharp.Algorithm.Features;
using BotSharp.NLP.Tokenize;
namespace BotSharp.NLP.Classify
{
public class WordFeatureExtractor : ITextFeatureExtractor
{
public List<Feature> GetFeatures(List<Token> words)
{
string text = words[0].Text;
var features = new List<Feature>();
features.Add(new Feature("alwayson", "True"));
features.Add(new Feature("startswith", text[0].ToString().ToLower()));
features.Add(new Feature("endswith", text[text.Length - 1].ToString().ToLower()));
return features;
}
}
}