public KBPInput(Span subjectSpan, Span objectSpan, NERTag subjectType, NERTag objectType, Sentence sentence) { this.subjectSpan = subjectSpan; this.objectSpan = objectSpan; this.subjectType = subjectType; this.objectType = objectType; this.sentence = sentence; }
/// <summary>Returns whether two entity types could plausibly have a relation hold between them.</summary> /// <remarks> /// Returns whether two entity types could plausibly have a relation hold between them. /// That is, is there a known relation type that would hold between these two entity types. /// </remarks> /// <param name="entityType">The NER tag of the entity.</param> /// <param name="slotValueType">The NER tag of the slot value.</param> /// <returns>True if there is a plausible relation which could occur between these two types.</returns> public static bool PlausiblyHasRelation(NERTag entityType, NERTag slotValueType) { foreach (RelationType rel in RelationType.Values) { if (rel.entityType == entityType && rel.validNamedEntityLabels.Contains(slotValueType)) { return true; } } return false; }
internal RelationType(string canonicalName, bool isOriginalRelation, int queryLimit, NERTag type, RelationType.Cardinality cardinality, NERTag[] validNamedEntityLabels, string[] validPOSPrefixes, double priorProbability) { // Inverse types this.canonicalName = canonicalName; this.isOriginalRelation = isOriginalRelation; this.queryLimit = queryLimit; this.entityType = type; this.cardinality = cardinality; this.validNamedEntityLabels = new HashSet<NERTag>(validNamedEntityLabels); this.validPOSPrefixes = new HashSet<string>(validPOSPrefixes); this.priorProbability = priorProbability; }