예제 #1
0
        /// <summary>
        /// 向文档中添加一个分句。
        /// </summary>
        /// <param name="sen">要添加的分句</param>
        /// <remarks>
        /// 如果分句与文档设定的字符编码不符,将会对其执行编码转换。
        /// </remarks>
        public void AddSentence(Sentence sen)
        {
            if (sen == null)
                throw new ArgumentNullException("sen");
            if (((IEncodingConvertible)sen).Encoding != this.Encoding)
                ((IEncodingConvertible)sen).ChangeEncoding(this.Encoding);

            sen.Context = this;
            _sentences.Add(sen);
        }
예제 #2
0
 private void createSentenceIfNull()
 {
     if (_sentence == null)
     {
         _sentence = new Sentence(String.Empty, _encoding);
         _lastCharSentenceIndex = -1;
     }
 }
예제 #3
0
 /// <summary>
 /// 从文档中删除一个分句。
 /// </summary>
 /// <param name="sen">要删除的分句</param>
 public void RemoveSentence(Sentence sen)
 {
     _sentences.Remove(sen);
     sen.Context = null;
 }
예제 #4
0
            public void EndSentence()
            {
                if (_sentence != null)
                {
                    CurrentDocument.AddSentence(_sentence);
                    _sentence = null;
                }

                GotPeriod = false;
            }