Exemplo n.º 1
0
        /// <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());
        }
Exemplo n.º 2
0
        /// <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());
        }
Exemplo n.º 3
0
 /// <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, string>(), null));
      *
      * String[] sentence = sequence.GetSource<NameSample>().Sentence;
      *
      * String[] tags = seqCodec.Encode(tagger.Find(sentence), sentence.Length);
      * Event[] events = new Event[sentence.length];
      *
      * NameFinderEventStream.GenerateEvents(sentence,tags,pcg).toArray(events);
      *
      * return events;
      */
     throw new NotImplementedException();
 }
Exemplo n.º 4
0
        /// <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();
        }
Exemplo n.º 5
0
 public Event[] UpdateContext(Sequence sequence, AbstractModel model)
 {
     // TODO: Should be implemented for Perceptron sequence learning ...
     return(null);
 }
Exemplo n.º 6
0
 /// <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>
 /// <remarks>Always return null.</remarks>
 public Event[] UpdateContext(Sequence sequence, AbstractModel model) {
     // TODO: Should be implemented for Perceptron sequence learning ...
     return null;
 }
        /// <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();
        }