Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Token" /> class with the specified sentence, span and lexeme.
        /// </summary>
        /// <param name="sentence">The sentence.</param>
        /// <param name="span">The span.</param>
        /// <param name="lexeme">The lexeme.</param>
        /// <exception cref="System.ArgumentNullException">
        /// <paramref name="sentence"/>
        /// or
        /// <paramref name="span"/>
        /// </exception>
        public Token(Sentence sentence, Span span, string lexeme) {
            if (sentence == null)
                throw new ArgumentNullException("sentence");

            if (span == null)
                throw new ArgumentNullException("span");

            Sentence = sentence;
            Start = span.Start;
            End = span.End;
            Lexeme = lexeme;
            Probability = span.Probability;
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Entity"/> class.
        /// </summary>
        /// <param name="span">The span.</param>
        /// <param name="sentence">The sentence.</param>
        /// <exception cref="System.ArgumentNullException">
        /// <paramref name="span"/>
        /// or
        /// <paramref name="sentence"/>
        /// </exception>
        public Entity(Span span, Sentence sentence) {
            if (span == null)
                throw new ArgumentNullException("span");

            if (sentence == null)
                throw new ArgumentNullException("sentence");

            CoveredText = span.GetCoveredText(sentence.Tokens);

            for (var i = 0; i < span.Start; i++)
                Start += sentence.Tokens[i].Length + 1;

            Span = span;
        }
Пример #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Chunk"/> class.
 /// </summary>
 /// <param name="sentence">The sentence.</param>
 /// <param name="span">The chunk span.</param>
 public Chunk(Sentence sentence, Span span) {
     HeadIndex = -1;
     Span = span;
     this.sentence = sentence;
 }
Пример #4
0
 /// <summary>
 /// Creates an token object.
 /// </summary>
 /// <param name="sentence">The sentence.</param>
 /// <param name="span">The token span.</param>
 /// <param name="lexeme">The lexeme.</param>
 /// <returns>The created <see cref="IToken" /> object.</returns>
 public Token CreateToken(Sentence sentence, Span span, string lexeme) {
     return new Token(sentence, span, lexeme) {
         WordNet = WordNet
     };
 }
Пример #5
0
 /// <summary>
 /// Creates an entity object.
 /// </summary>
 /// <param name="sentence">The sentence where the entity is present.</param>
 /// <param name="span">The entity span.</param>
 /// <returns>The new <see cref="IEntity"/> object.</returns>
 public Entity CreateEntity(Sentence sentence, Span span) {
     return new Entity(span, sentence);
 }
Пример #6
0
        /// <summary>
        /// Creates the <see cref="IChunk"/> object.
        /// </summary>
        /// <param name="sentence">The sentence.</param>
        /// <param name="span">The chunk span.</param>
        /// <returns>The <see cref="IChunk"/> representation.</returns>
        public Chunk CreateChunk(Sentence sentence, Span span) {
            if (sentence == null)
                throw new ArgumentNullException("sentence");

            if (span == null)
                throw new ArgumentNullException("span");

            return new Chunk(sentence, span);
        }
Пример #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Token"/> with the given parameters.
        /// </summary>
        /// <param name="sentence">The sentence.</param>
        /// <param name="start">The start.</param>
        /// <param name="end">The end.</param>
        /// <param name="lexeme">The lexeme.</param>
        /// <param name="lemmas">The lemmas.</param>
        /// <param name="tag">The tag.</param>
        /// <param name="features">The features.</param>
        /// <exception cref="System.ArgumentNullException">
        /// <paramref name="sentence"/>
        /// </exception>
        public Token(Sentence sentence, int start, int end, string lexeme, string[] lemmas, string tag, string features) {
            if (sentence == null)
                throw new ArgumentNullException("sentence");

            Sentence = sentence;
            Start = start;
            End = end;
            Lexeme = lexeme;
            Lemmas = lemmas;
            POSTag = tag;
            Features = features;
        }
Пример #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Token"/> using the 
 /// <paramref name="start"/> - <paramref name="end"/> positions and the <paramref name="lexeme"/>.
 /// </summary>
 /// <param name="sentence">The sentence.</param>
 /// <param name="start">The start.</param>
 /// <param name="end">The end.</param>
 /// <param name="lexeme">The lexeme.</param>
 public Token(Sentence sentence, int start, int end, string lexeme)
     : this(sentence, start, end, lexeme, null, null, null) {
     
 }