Skip to content

Commit

Permalink
Changed type of vocabulary to set[str]
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulKlint committed Nov 26, 2024
1 parent 6a30a3b commit 37851d2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/analysis/typepal/StringSimilarity.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ test bool lev9() = lev("march", "may") == 3;
alias WordSim = tuple[str word, int sim];

@synopsis{Compute list of words from vocabulary, that are similar to give word w with at most maxDistance edits}
list[str] similarWords(str w, list[str] vocabulary, int maxDistance)
list[str] similarWords(str w, set[str] vocabulary, int maxDistance)
= sort({ <v, d> | str v <- vocabulary, d := lev(w, v), d <= maxDistance },
bool (WordSim x, WordSim y){ return x.sim < y.sim;}).word;

@synopsis{Find in TModel tm, names similar to Use u. Max edit distance comes from TypePal Configuration.}
list[str] similarNames(Use u, TModel tm){
w = getOrgId(u);
idRoles = u.idRoles;
vocabulary = [ d.orgId | d <- tm.defines, d.idRole in idRoles, isContainedIn(u.occ, d.scope) ];
vocabulary = { d.orgId | d <- tm.defines, d.idRole in idRoles, isContainedIn(u.occ, d.scope) };
return similarWords(w, vocabulary, tm.config.cutoffForNameSimilarity);
}

0 comments on commit 37851d2

Please sign in to comment.