Skip to content

Commit

Permalink
stable version of tfidf + rule based algorithms
Browse files Browse the repository at this point in the history
  • Loading branch information
Quim committed Dec 4, 2019
1 parent 8270f4e commit 896bf91
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,23 @@ public DependencyType getDependencyType() {
return dependencyType;
}

@Override
public boolean equals(Object o) {

if (o instanceof Dependency){
Dependency dep = (Dependency) o;
return (dep.getFrom().equals(this.from) && dep.getTo().equals(this.to) && dep.getDependencyType().equals(this.dependencyType));
}

return false;
}

@Override
public int hashCode() {
int hash = 7;
hash = 17 * hash + (this.to != null ? this.to.hashCode() : 0) + (this.from != null ? this.from.hashCode() : 0) +
(this.dependencyType != null ? this.dependencyType.hashCode() : 0);
return hash;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -215,17 +215,17 @@ public void matching(String keywords, String reqId, String requirement, boolean
for (int j = 0; j < ontClasses.size(); j++) {
lemmas = classesLemmas.get(j);
if (keywords.split(" ").length >= lemmas.length && extractNGram(keywords, lemmas, syny,thr,wordEmbedding)) {
System.out.println("A MATCH WAS MADE BETWEEN:");
System.out.println("REQUIREMENT KEYWORDS: "+keywords);
System.out.println("ONTOLOGY NAME: "+lemmas.toString());
System.out.println("Requirement " + reqId + " contains class " + String.join(" ", lemmas));
//System.out.println("REQUIREMENT KEYWORDS: "+keywords);
//System.out.println("ONTOLOGY NAME: "+lemmas.toString());

classes.add(ontClasses.get(j));
}
}

// Requirement instantiation within the ontology
for (OntClass cls : classes) {
System.out.println("A MATCH WAS MADE");
//System.out.println("A MATCH WAS MADE");
Individual individual = this.model.createIndividual(this.source + ":" + reqId + "_" + cls.getLocalName(),
cls);
DatatypeProperty req = this.model.getDatatypeProperty(this.source + "#requirement");
Expand Down Expand Up @@ -307,7 +307,7 @@ public List<Dependency> ontConflictDetection() {
if (!f.equals(t)) {
Dependency newDep = new Dependency(f, t, Status.PROPOSED,
DependencyType.valueOf((String) dep.get(0).toString().toUpperCase()));
dependencies.add(newDep);
if (!dependencies.contains(newDep)) dependencies.add(newDep);
}
}
}
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/ExcludedWords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,6 @@ every
ere
each
et
etc
elsewhere
else
ex
Expand Down

0 comments on commit 896bf91

Please sign in to comment.