/// <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); }
private void createSentenceIfNull() { if (_sentence == null) { _sentence = new Sentence(String.Empty, _encoding); _lastCharSentenceIndex = -1; } }
/// <summary> /// 从文档中删除一个分句。 /// </summary> /// <param name="sen">要删除的分句</param> public void RemoveSentence(Sentence sen) { _sentences.Remove(sen); sen.Context = null; }
public void EndSentence() { if (_sentence != null) { CurrentDocument.AddSentence(_sentence); _sentence = null; } GotPeriod = false; }