/// <summary>
        /// Creates events for the provided sample.
        /// </summary>
        /// <param name="sample">The sample the sample for which training <see cref="T:Event"/>s are be created.</param>
        /// <returns>The events enumerator.</returns>
        protected override IEnumerator <Event> CreateEvents(NameSample sample)
        {
            if (sample.ClearAdaptiveData)
            {
                contextGenerator.ClearAdaptiveData();
            }

            var tokens   = new string[sample.Sentence.Length];
            var outcomes = codec.Encode(sample.Names, tokens.Length);

            additionalContextFeatureGenerator.SetCurrentContext(sample.AdditionalContext);

            for (int i = 0; i < sample.Sentence.Length; i++)
            {
                tokens[i] = sample.Sentence[i];
            }

            return(GenerateEvents(tokens, outcomes, contextGenerator).GetEnumerator());
        }
Example #2
0
 /// <summary>
 /// Forgets all adaptive data which was collected during previous calls to one of the find methods.
 /// </summary>
 /// <remarks>This method is typical called at the end of a document.</remarks>
 public void ClearAdaptiveData()
 {
     contextGenerator.ClearAdaptiveData();
 }