/// <summary> /// Creates a new event array based on the outcomes predicted by the specified parameters for the specified sequence. /// </summary> /// <param name="sequence">The sequence to be evaluated.</param> /// <param name="model">The model.</param> /// <returns>The event array.</returns> public Event[] UpdateContext(Sequence sequence, AbstractModel model) { var tagger = new NameFinderME( new TokenNameFinderModel("x-unspecified", model, new Dictionary <string, object>(), null)); var sentence = sequence.GetSource <NameSample>().Sentence; var tags = seqCodec.Encode(tagger.Find(sentence), sentence.Length); return(NameFinderEventStream.GenerateEvents(sentence, tags, pcg).ToArray()); }
/// <summary> /// Creates a new event array based on the outcomes predicted by the specified parameters for the specified sequence. /// </summary> /// <param name="sequence">The sequence to be evaluated.</param> /// <param name="model">The model.</param> /// <returns>The event array.</returns> public Event[] UpdateContext(Sequence sequence, AbstractModel model) { var tagger = new POSTaggerME(new POSModel("x-unspecified", model, null, new POSTaggerFactory())); var sample = sequence.GetSource <POSSample>(); var tags = tagger.Tag(sample.Sentence); return(POSSampleEventStream.GenerateEvents( sample.Sentence, tags, Array.ConvertAll(sample.AdditionalContext, input => (object)input), contextGenerator).ToArray()); }
/// <summary> /// Creates a new event array based on the outcomes predicted by the specified parameters for the specified sequence. /// </summary> /// <param name="sequence">The sequence to be evaluated.</param> /// <param name="model">The model.</param> /// <returns>The event array.</returns> public Event[] UpdateContext(Sequence sequence, AbstractModel model) { var tagger = new NameFinderME( new TokenNameFinderModel("x-unspecified", model, new Dictionary<string, object>(), null)); var sentence = sequence.GetSource<NameSample>().Sentence; var tags = seqCodec.Encode(tagger.Find(sentence), sentence.Length); return NameFinderEventStream.GenerateEvents(sentence, tags, pcg).ToArray(); }
/// <summary> /// Creates a new event array based on the outcomes predicted by the specified parameters for the specified sequence. /// </summary> /// <param name="sequence">The sequence to be evaluated.</param> /// <param name="model">The model.</param> /// <returns>The event array.</returns> public Event[] UpdateContext(Sequence sequence, AbstractModel model) { var tagger = new POSTaggerME(new POSModel("x-unspecified", model, null, new POSTaggerFactory())); var sample = sequence.GetSource<POSSample>(); var tags = tagger.Tag(sample.Sentence); return POSSampleEventStream.GenerateEvents( sample.Sentence, tags, Array.ConvertAll(sample.AdditionalContext, input => (object) input), contextGenerator).ToArray(); }