public OpinionMiningTuple(SubjectEssence subject, ObjectEssence @object, XElement sentence , int sentenceNumber, FilterBySynonyms filterBySynonyms, ICoreferenceInfo coreferenceInfo) { var tempSentence = Initialize(subject, sentence, sentenceNumber, filterBySynonyms, coreferenceInfo); @object.ThrowIfNull("object"); #region [.coreference-info.] var tuple = coreferenceInfo.TryGetMaster(@object.Entity); #endregion #region [.Find Object-entity & mark him as-inquiry.] var objectEntityInCopy = tempSentence.DescendantsAndSelf().FirstOrDefault(d => ObjectEntityEqualityComparer.Instance.Equals(d, @object.AnaphoriaAndEntityTuple.Entity)); if (objectEntityInCopy == null) { throw (new ArgumentException("Object-Entity not found in his Sentence. " + ("object.Entity: " + @object.AnaphoriaAndEntityTuple.Entity.ToString().InSingleQuote() + ", sentence: " + sentence.ToString().InSingleQuote()).InBrackets())); } objectEntityInCopy.MarkAsInquiry(); var objectAnaphoriaInCopy = default(XElement); if (@object.AnaphoriaAndEntityTuple.Anaphoria != null) { objectAnaphoriaInCopy = tempSentence.DescendantsAndSelf().FirstOrDefault(d => ObjectEntityEqualityComparer.Instance.Equals(d, @object.AnaphoriaAndEntityTuple.Anaphoria)); if (objectAnaphoriaInCopy == null) { throw (new ArgumentException("Object-Anaphoria-Entity not found in his Sentence. " + ("object.Entity: " + @object.AnaphoriaAndEntityTuple.Anaphoria.ToString().InSingleQuote() + ", sentence: " + sentence.ToString().InSingleQuote()).InBrackets())); } } @object = new ObjectEssence(new SubjectAndAnaphoriaEntityTuple(objectEntityInCopy, objectAnaphoriaInCopy), @object.IsSubjectIndeed); SentenceText = tempSentence.ToString(); tempSentence = null; #endregion Object = @object; #region [.coreference-info.] Object.TrySetValueWithCoreferenceInfo(tuple); #endregion }
private XElement Initialize(SubjectEssence subject, XElement sentence , int sentenceNumber, FilterBySynonyms filterBySynonyms, ICoreferenceInfo coreferenceInfo) { subject.ThrowIfNull("subject"); sentence.ThrowIfNull("sentence"); Subject = subject; Subject.TrySetValueWithCoreferenceInfo(coreferenceInfo); SentenceNumber = sentenceNumber; FilterBySynonyms = filterBySynonyms; var tempSentence = new XElement(sentence); #region [.Remove all ISSUBJECT-attribute from other than Subject.Entity elements.] if (!Subject.IsAuthor) { tempSentence.RemoveOtherSubjectAttributes(Subject.AnaphoriaAndEntityTuple.Entity, ObjectEntityEqualityComparer.Instance.Equals); } #endregion _Sentence = tempSentence; SentenceText = tempSentence.ToString(); return(tempSentence); }
public SubjectEssence(SubjectEssence subjectEssence, string verbValue) : base(subjectEssence.AnaphoriaAndEntityTuple) { Verb = null; Initialize(verbValue); }
public OpinionMiningTuple(SubjectEssence subject, XElement sentence , int sentenceNumber, FilterBySynonyms filterBySynonyms, ICoreferenceInfo coreferenceInfo) { Initialize(subject, sentence, sentenceNumber, filterBySynonyms, coreferenceInfo); }
static SubjectEssence() { Author = new SubjectEssence(); }