예제 #1
0
        /// <summary>
        /// checks for overlapping NERs
        /// </summary>
        /// <param name="ner"></param>
        /// <returns></returns>
        public bool Overlaps(RecognizedEntity ner)
        {
            string overlapper = null;
            string overlapped = null;

            if (IsNamedEntity)
            {
                overlapper = this?.RecognizedValue?.ToString();
                overlapped = ner?.RecognizedValue?.ToString();
            }
            if (IsMeasure)
            {
                overlapper = this?.RecognizedName?.ToString();
                overlapped = ner?.RecognizedName?.ToString();
            }

            if (String.IsNullOrEmpty(overlapper) || String.IsNullOrEmpty(overlapped))
            {
                return(false);
            }

            return(this.Index <= ner.Index &&
                   this.Index + overlapper.Length >= ner.Index + overlapped.Length &&
                   overlapper.Contains(overlapped));
        }
예제 #2
0
 public bool IsSameDimension(RecognizedEntity ner)
 {
     return(String.Compare(this.Entity.DomainName, ner.Entity.DomainName, true) == 0);
 }