本文整理汇总了C#中ITokenizer.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# ITokenizer.GetType方法的具体用法?C# ITokenizer.GetType怎么用?C# ITokenizer.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITokenizer
的用法示例。
在下文中一共展示了ITokenizer.GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MetricRun
public static void MetricRun(IReworder reworder, IReader reader, ITokenizer tok, ISparseDistance dist, int nbNeighbours, bool train, bool proba, string questionFilePath, string encyclopediaFilePath, string outFolder)
{
string encyclopediaName = Path.GetFileNameWithoutExtension(encyclopediaFilePath);
string summary = "Metric_" + reworder.GetType().Name + "_" +
reader.GetType().Name + "_" + tok.GetType().Name + "_" + dist.GetType().Name + "_" + nbNeighbours.ToString() + "_" + encyclopediaName;
Console.Write("\n" + summary);
SparseMatcher robot = new SparseMatcher(dist, reworder, reader, tok, encyclopediaFilePath);
string[] answers = robot.Answer(nbNeighbours, questionFilePath, train, proba);
if (train)
{
EvaluateAndPrintScores(questionFilePath, answers);
}
else
{
string[] ids = TextToData.ImportColumn(questionFilePath, 0);
Submissions.Write(answers, ids, outFolder + summary + ".csv");
}
Console.WriteLine();
}
示例2: DocumentCategorizerFactory
/// <summary>
/// Initializes a new instance of the <see cref="DocumentCategorizerFactory"/> with the specified tokenizer and the feature generatos.
/// </summary>
/// <param name="tokenizer">The tokenizer.</param>
/// <param name="featureGenerators">The feature generators.</param>
/// <exception cref="System.ArgumentNullException">
/// <paramref name="tokenizer"/>
/// or
/// <paramref name="featureGenerators"/>
/// </exception>
/// <exception cref="System.ArgumentException">The specified tokenizer is not registered in the type resolver.</exception>
public DocumentCategorizerFactory(ITokenizer tokenizer, IFeatureGenerator[] featureGenerators) {
if (tokenizer == null)
throw new ArgumentNullException("tokenizer");
if (featureGenerators == null)
throw new ArgumentNullException("featureGenerators");
if (!Library.TypeResolver.IsRegistered(tokenizer.GetType()))
throw new ArgumentException("The specified tokenizer is not registered in the type resolver.");
foreach (var featureGenerator in featureGenerators) {
if (featureGenerator == null)
throw new ArgumentException("The feature generators must not have any null objects.");
if (!Library.TypeResolver.IsRegistered(featureGenerator.GetType()))
throw new ArgumentException(string.Format("The feature generator type {0} is not registered in the type resolver.", featureGenerator.GetType().Name));
}
this.featureGenerators = featureGenerators;
this.tokenizer = tokenizer;
}