Skip to content

Commit

Permalink
Merge a6218d0 into 84dc3f9
Browse files Browse the repository at this point in the history
  • Loading branch information
AymanDF committed May 26, 2016
2 parents 84dc3f9 + a6218d0 commit ed70f95
Show file tree
Hide file tree
Showing 2 changed files with 276 additions and 274 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;

import weka.classifiers.Classifier;
import weka.core.Instances;
Expand Down Expand Up @@ -45,12 +46,12 @@ public LinkRelevance[] classify(PaginaURL page) throws LinkClassifierException {

int count = 0;

for (String urlStr : urlWords.keySet()) {
for (Map.Entry<String, Instance> entry : urlWords.entrySet()) {

URL url = new URL(urlStr);
URL url = new URL(entry.getKey());
double relevance = -1;
if(!page.getURL().getHost().equals(url.getHost())){
Instance instance = urlWords.get(urlStr);
Instance instance = entry.getValue();
double[] values = instance.getValues();
weka.core.Instance instanceWeka = new weka.core.Instance(1, values);
instanceWeka.setDataset(instances);
Expand Down Expand Up @@ -87,11 +88,11 @@ public LinkRelevance classify(LinkNeighborhood ln) throws LinkClassifierExceptio
try{
HashMap<String, Instance> urlWords = wrapper.extractLinks(ln, attributes);

for (String url : urlWords.keySet()) {
for (Map.Entry<String, Instance> entry : urlWords.entrySet()) {
double relevance = -1;
if(isRootPage(url)){
if(isRootPage(entry.getKey())){
if(classifier != null){
Instance instance = (Instance)urlWords.get(url);
Instance instance = (Instance) entry.getValue();
double[] values = instance.getValues();
weka.core.Instance instanceWeka = new weka.core.Instance(1, values);
instanceWeka.setDataset(instances);
Expand All @@ -104,7 +105,7 @@ public LinkRelevance classify(LinkNeighborhood ln) throws LinkClassifierExceptio
relevance = LinkRelevance.DEFAULT_AUTH_RELEVANCE+1;
}
}
linkRel = new LinkRelevance(new URL(url),relevance);
linkRel = new LinkRelevance(new URL(entry.getKey()),relevance);
}
} catch (MalformedURLException ex) {
ex.printStackTrace();
Expand Down
Loading

0 comments on commit ed70f95

Please sign in to comment.