Package edu.umd.cloud9.collection.wikipedia

Examples of edu.umd.cloud9.collection.wikipedia.WikipediaPage$Link


      }
    }

    public void map(Writable docnoKey, Indexable page, OutputCollector<PairOfInts, WikiDocInfo> output, Reporter reporter) throws IOException {
      int docno = ((IntWritable)docnoKey).get();
      WikipediaPage p = (WikipediaPage) page;
      String lang = p.getLanguage();
      ArrayListOfIntsWritable similarDocnos;

      // we only load the mapping once, during the first map() call of a mapper.
      // this works b/c all input kv pairs of a given mapper will have same lang id (reason explained above)
      if(pwsimMapping.isEmpty()){
        loadPairs(pwsimMapping, lang, mJob, reporter);
        sLogger.debug(pwsimMapping.size());
      }
     
      // if no similar docs for docno, return
      if(pwsimMapping.containsKey(docno)){
        similarDocnos = pwsimMapping.get(docno);  
      }else{
        return;
      }

      ArrayListWritable<Text> sentences;
      ArrayListWritable<HMapSFW> vectors = new ArrayListWritable<HMapSFW>();
      ArrayListOfIntsWritable sentLengths = new ArrayListOfIntsWritable();
      try {
        if(lang.equals("en")){
          // identify sentences in document, filter out ones below MinSentLength threshold
          // convert each sentence into a tf-idf vector, using general DF map for collection and a heuristic for avg. doc length
          // filter out sentences for which the vector has less than MinVectorTerms terms
          sentences = helper.getESentences(p.getContent(), vectors, sentLengths);   
         
        }else{
          sentences = helper.getFSentences(p.getContent(), vectors, sentLengths);
        }
        if(sentences.size() != vectors.size()) {
          throw new RuntimeException("Sentences.size != Vectors.size");
        }
      } catch (Exception e) {
View Full Code Here


                boolean handled = requestHandler.service(request, response);

                if (!handled) { throw new RuntimeException(String.format(
                        "Request was not handled: '%s' may not be a valid page name.", pageName)); }

                Link link = response.getRedirectLink();

                if (link != null)
                {
                    setupRequestFromLink(link);
                    continue;
View Full Code Here

                if (!handled)
                    throw new RuntimeException(String.format("Request for path '%s' was not handled by Tapestry.",
                            request.getPath()));

                Link link = response.getRedirectLink();

                if (link != null)
                {
                    setupRequestFromLink(link);
                    continue;
View Full Code Here

        // Page is secure but request is not, so redirect.
        // We can safely ignore the forForm parameter since secure form requests are alway done from
        // an already secured page

        Link link = componentEventLinkEncoder.createComponentEventLink(parameters, false);
       
        response.sendRedirect(link);
       
        return true;
    }
View Full Code Here

        if (!needsRedirect(parameters.getLogicalPageName()))
            return false;

        // Page is secure but request is not, so redirect.

        Link link = componentEventLinkEncoder.createPageRenderLink(parameters);

        response.sendRedirect(link);

        return true;
    }
View Full Code Here

        train_encodeRedirectURL(response, URI, ENCODED);

        replay();

        Link link = new LinkImpl(URI, true, false, response, optimizer);

        assertEquals(link.toRedirectURI(), ENCODED);

        verify();
    }
View Full Code Here

        train_optimizePath(optimizer, "/bar/" + RAW_PATH, OPTIMIZED);
        train_encodeURL(response, OPTIMIZED, ENCODED);

        replay();

        Link link = new LinkImpl("/bar/" + RAW_PATH, true, false, response, optimizer);

        assertEquals(link.toString(), ENCODED);

        verify();
    }
View Full Code Here

        RequestPathOptimizer optimizer = mockRequestPathOptimizer();
        Response response = mockResponse();

        replay();

        Link link = new LinkImpl("/foo/bar", true, false, response, optimizer);

        link.addParameter("fred", "flintstone");

        assertEquals(link.getParameterValue("fred"), "flintstone");

        verify();
    }
View Full Code Here

        train_optimizePath(optimizer, "/foo/bar", OPTIMIZED);
        train_encodeURL(response, OPTIMIZED, ENCODED);

        replay();

        Link link = new LinkImpl("/foo/bar", true, false, response, optimizer);
        link.setAnchor("wilma");

        assertSame(link.getAnchor(), "wilma");

        assertEquals(link.toURI(), ENCODED + "#" + "wilma");

        verify();
    }
View Full Code Here

        train_encodeURL(response, "/ctx/foo", ENCODED);

        replay();

        Link link = new LinkImpl("/ctx/foo", true, false, response, optimizer);

        assertEquals(link.toAbsoluteURI(), ENCODED);

        verify();
    }
View Full Code Here

TOP

Related Classes of edu.umd.cloud9.collection.wikipedia.WikipediaPage$Link

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.