Examples of IntPair


Examples of edu.ucla.sspace.util.primitive.IntPair

    private Collection<Multigraph<T,E>> enumerateSimpleGraphs(
            Multigraph<T,E> input, List<IntPair> connected,
            int curPair, Multigraph<T,E> toCopy) {
       
        List<Multigraph<T,E>> simpleGraphs = new LinkedList<Multigraph<T,E>>();
        IntPair p = connected.get(curPair);
        // Get the set of edges between the current vertex pair
        Set<E> edges = input.getEdges(p.x, p.y);
        // Pick one of the edges and generate a graph from the remaining pairs
        for (E e : edges) {
            // Make a copy of the input graph and add this edge to the graph
View Full Code Here

Examples of eu.stratosphere.pact.runtime.test.util.types.IntPair

    FixedLengthRecordSorter<IntPair> sorter = newSortBuffer(memory);
    RandomIntPairGenerator generator = new RandomIntPairGenerator(SEED);
   
//    long startTime = System.currentTimeMillis();
    // write the records
    IntPair record = new IntPair();
    int num = -1;
    do {
      generator.next(record);
      num++;
    }
    while (sorter.write(record) && num < 3354624);
//    System.out.println("WRITE TIME " + (System.currentTimeMillis() - startTime));
   
    // re-read the records
    generator.reset();
    IntPair readTarget = new IntPair();
   
//    startTime = System.currentTimeMillis();
    int i = 0;
    while (i < num) {
      generator.next(record);
      readTarget = sorter.getRecord(readTarget, i++);
     
      int rk = readTarget.getKey();
      int gk = record.getKey();
     
      int rv = readTarget.getValue();
      int gv = record.getValue();
     
      if (gk != rk) {
        Assert.fail("The re-read key is wrong " + i);
      }
View Full Code Here

Examples of fig.basic.IntPair

    for(int i = 0; i < nerTags.size(); ++i) {
      String currTag = nerTags.get(i);
      if(currTag.equals("O")) {
        if(!prevTag.equals("O")) {
          res.add(new IntPair(start,i));
          start=-1;
        }
      }
      else { //currNe is not "O"
        if(!currTag.equals(prevTag)) {
          if(!prevTag.equals("O")) {
            res.add(new IntPair(start,i));
          }
          start=i;
        }
      }
      prevTag = currTag;
    }
    if(start!=-1)
      res.add(new IntPair(start,nerTags.size()));
    return res;
  }
View Full Code Here

Examples of fig.basic.IntPair

        if(!LanguageUtils.isProperNoun(prevTag))
          start=i;
      }
      else { //curr tag is not proper noun
        if(LanguageUtils.isProperNoun(prevTag)) {
          res.add(new IntPair(start,i));
          start=-1;
        }
      }
      prevTag = currTag;
    }
    if(start!=-1)
      res.add(new IntPair(start,posTags.size()));
    return res;
  }
View Full Code Here

Examples of fig.basic.IntPair

  public Map<String,IntPair> getLemmaSpans() {
    if(lemmaSpans==null) {
      lemmaSpans = new HashMap<String,IntPair>();
      for(int i = 0; i < numTokens()-1; ++i) {
        for(int j = i+1; j < numTokens(); ++j)
          lemmaSpans.put(lemmaPhrase(i, j),new IntPair(i,j));
      }
    }
    return lemmaSpans;
  }
View Full Code Here

Examples of fig.basic.IntPair

      UnaryFormulaInfo uInfo =  fbFormulasInfo.getUnaryInfo(type1Formula);
      if(uInfo!=null) {
        for(String description: uInfo.descriptions) {
          if(validDescription(description)) {
            List<String> descriptionTokens = Arrays.asList(description.split("\\s+"));
            IntPair unarySpan = getUnarySpan(lInfo); //where should we match the description
            if(ParaphraseUtils.matchLists(lInfo.tokens.subList(unarySpan.first, unarySpan.second), descriptionTokens) ||
                ParaphraseUtils.matchLists(lInfo.lemmaTokens.subList(unarySpan.first, unarySpan.second), descriptionTokens)) {
              FormulaGenerationInfo fInfo =
                  new FormulaGenerationInfo(inFgInfo.bInfo, inFgInfo.injectedInfo, inFgInfo.entityInfo1, inFgInfo.entityInfo2, uInfo,
                      inFgInfo.isCount,inFgInfo.isInject,true);
View Full Code Here

Examples of fig.basic.IntPair

    return res;
  }

  private IntPair getUnarySpan(LanguageInfo languageInfo) {
    if(!(languageInfo.lemmaTokens.get(0).equals("what") || languageInfo.lemmaTokens.get(0).equals("which")))
      return new IntPair();
    int start=1, end=1;
    for(; end < languageInfo.numTokens(); ++end) {
      if(languageInfo.posTags.get(end).startsWith("V"))
        break;
    }
    return new IntPair(start,end);
  }
View Full Code Here

Examples of fig.basic.IntPair

  private void findInjectedTimeEntities(LanguageInfo lInfo, IntPair excludedSpan,
      List<EntityInfo> res) {
    for(int i = 0; i < lInfo.tokens.size(); i++) {
      if(lInfo.isNumberAndDate(i)) {
        IntPair span = new IntPair(i,i+1);
        if(ParaphraseUtils.intervalIntersect(span, excludedSpan))
          continue;
        String token = lInfo.tokens.get(i);
        if(DateValue.parseDateValue(token).year!=-1) {
          EntityInfo entityInfo = new EntityInfo(token, new ValueFormula<DateValue>(DateValue.parseDateValue(token)),0,span);
View Full Code Here

Examples of fig.basic.IntPair

          LogInfo.logs("Retrieving: entry=%s",entityDesc);
        List<EntityLexicalEntry> entries = getEntityEntries(entityDesc);
        if(entries.isEmpty())
          entries = getEntityEntries(entityLemmas);
        for(EntityLexicalEntry entry: entries) {
          res.add(Pair.newPair(new IntPair(i, j), entry));
        }
      }
    }
  }
View Full Code Here

Examples of fig.basic.IntPair

    if(res.isEmpty()) {
      for(int i = 0; i < lInfo.numTokens(); i++) {
        if(LanguageUtils.isEntity(lInfo, i)) {
          List<EntityLexicalEntry> entries = getEntityEntries(lInfo.tokens.get(i));
          for(EntityLexicalEntry entry: entries)
            res.add(Pair.newPair(new IntPair(i,i+1), entry));
        }
      }
    }
    //if can't try all content words
    if(res.isEmpty()) {
      for(int i = 0; i < lInfo.numTokens(); i++) {
        if(LanguageUtils.isContentWord(lInfo.getCanonicalPos(i))) {
          List<EntityLexicalEntry> entries = getEntityEntries(lInfo.tokens.get(i));
          for(EntityLexicalEntry entry: entries)
            res.add(Pair.newPair(new IntPair(i,i+1), entry));
        }
      }
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.