/// <summary> /// Determines what kind of match this term might be to this table /// </summary> /// <param name="term">The term.</param> /// <returns></returns> public weightTableMatchResultEnum isMatchBySemantics(IWeightTableTerm term) { weightTableMatchResultEnum output = weightTableMatchResultEnum.none; if (terms.ContainsKey(term.nominalForm)) { return(weightTableMatchResultEnum.hostTermName_and_needleTermName); } foreach (var t in this) { if (t.isMatch(term)) { // <--------------------- nije potpuna implementacija --- jer mozda bude i hostTermInstance_and_needleTermInstance return(weightTableMatchResultEnum.hostTermInstance_and_needleTermName); } } var allForms = term.GetAllForms(); foreach (string form in allForms) { if (terms.ContainsKey(form)) { return(weightTableMatchResultEnum.hostTermName_and_needleTermInstance); } } return(output); }
/// <summary> /// Determines what kind of match this term might be to this table /// </summary> /// <param name="term">The term.</param> /// <returns></returns> public weightTableMatchResultEnum isMatchBySemantics(IWeightTableTerm term) { weightTableMatchResultEnum output = weightTableMatchResultEnum.none; if (ContainsKey(term.nominalForm)) { return(weightTableMatchResultEnum.hostTermName_and_needleTermName); } var cterm = GetIfExists(term.nominalForm, true); if (cterm != null) { return(weightTableMatchResultEnum.hostTermInstance_and_needleTermName); } var allForms = term.GetAllForms(); foreach (string form in allForms) { if (ContainsKey(form)) { return(weightTableMatchResultEnum.hostTermName_and_needleTermInstance); } } foreach (string form in allForms) { cterm = GetIfExists(form, true); if (cterm != null) { return(weightTableMatchResultEnum.hostTermInstance_and_needleTermName); } } return(output); }
public bool isMatch(IWeightTableTerm term) { weightTableMatchResultEnum mres = isMatchBySemantics(term); return(mres.HasFlag(weightTableMatchResultEnum.isMatch)); }