/// <summary> /// Returns the top k chunk sequences for the specified sentence with the specified pos-tags. /// </summary> /// <param name="tokens">The tokens of the sentence.</param> /// <param name="tags">The pos-tags for the specified sentence.</param> /// <returns>The top k chunk sequences for the specified sentence.</returns> public Sequence[] TopKSequences(string[] tokens, string[] tags) { return(model.BestSequences( DefaultBeamSize, tokens, new object[] { tags }, contextGenerator, sequenceValidator)); }
/// <summary> /// Returns at most the specified number of taggings for the specified sentence. /// </summary> /// <param name="numTaggings">The number of tagging to be returned.</param> /// <param name="sentence">An array of tokens which make up a sentence.</param> /// <returns>At most the specified number of taggings for the specified sentence.</returns> public string[][] Tag(int numTaggings, string[] sentence) { var bestSequences = model.BestSequences(numTaggings, sentence, null, ContextGenerator, SequenceValidator); var tags = new string[bestSequences.Length][]; for (int i = 0; i < tags.Length; i++) { tags[i] = bestSequences[i].Outcomes.ToArray(); } return(tags); }
/// <summary> /// Returns the top k sequences for the specified tokens with the specified pos-tags. /// </summary> /// <param name="tokens">The tokens of the tokens.</param> /// <param name="tags">The pos-tags for the specified tokens.</param> /// <returns>The top k sequences for the specified tokens.</returns> /// <exception cref="ArgumentNullException"><paramref name="tokens" /> or <paramref name="tags" /></exception> /// <exception cref="ArgumentException">The arguments must have the same length.</exception> public Sequence[] TopKSequences(string[] tokens, string[] tags) { if (tokens == null) { throw new ArgumentNullException(nameof(tokens)); } if (tags == null) { throw new ArgumentNullException(nameof(tags)); } if (tokens.Length != tags.Length) { throw new ArgumentException("The arguments must have the same length."); } return(model.BestSequences(DefaultBeamSize, tokens, new object[] { tags }, contextGenerator, sequenceValidator)); }