当前位置: 首页>>代码示例>>Java>>正文


Java IntDoubleEntry类代码示例

本文整理汇总了Java中edu.jhu.prim.map.IntDoubleEntry的典型用法代码示例。如果您正苦于以下问题:Java IntDoubleEntry类的具体用法?Java IntDoubleEntry怎么用?Java IntDoubleEntry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IntDoubleEntry类属于edu.jhu.prim.map包,在下文中一共展示了IntDoubleEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testGetPerWordFeats

import edu.jhu.prim.map.IntDoubleEntry; //导入依赖的package包/类
@Test
public void testGetPerWordFeats() throws Exception {
    CoNLL09Sentence csent = AnnoSentenceTest.getDogConll09Sentence();
    AnnoSentence sent = csent.toAnnoSentence(true);
    RoleVar rv = new RoleVar(VarType.PREDICTED, 3, "rv", QLists.getList("arg0", "arg1", "arg2"), 2, 0);
    sent.setClusters(QLists.getList("010101", "01", "101010", "010101"));
    
    FeatureNames alphabet = new FeatureNames();
    SrlWordFeaturesPrm prm = new SrlWordFeaturesPrm();
    prm.srlEmbFeatType = SrlWordFeatType.HEAD_TYPE_LOC;
    SrlWordFeatures fe = new SrlWordFeatures(prm, sent, alphabet);
    List<FeatureVector> featsList = fe.getFeatures(rv);
    
    assertEquals(sent.size(), featsList.size());
    String fs = "";
    for (int i=0; i<featsList.size(); i++) {
        //for (int k=0; k<featsListSystem.out.println()
        FeatureVector feats = featsList.get(i);
        fs += "FeatureVector: " + i + "\n";
        for (IntDoubleEntry e : feats) {
            fs += alphabet.lookupObject(e.index()) + "=" + e.get() + ", \n";
        }
        fs += "\n";
    }
    System.out.println(fs);
    assertEquals(expectedFs, fs);
}
 
开发者ID:mgormley,项目名称:pacaya-nlp,代码行数:28,代码来源:SrlWordFeaturesTest.java

示例2: testGetPerWordFeats

import edu.jhu.prim.map.IntDoubleEntry; //导入依赖的package包/类
@Test
public void testGetPerWordFeats() throws Exception {
    AnnoSentence sent = RelationMungerTest.getSentWithRelationsAndNer();
    sent.setParents(new int[]{-1, 0, 1, 2, 3, 4});
    Pair<NerMention, NerMention> pair = sent.getNePairs().get(0);
    RelVar rv = new RelVar(VarType.PREDICTED, "rv", pair.get1(), pair.get2(), 
            QLists.getList("OWNER", "NEAR", "ART"));
    
    FeatureNames alphabet = new FeatureNames();
    RelWordFeaturesPrm prm = new RelWordFeaturesPrm();
    prm.embFeatType = EmbFeatType.HEAD_TYPE_LOC;
    prm.entityTypeRepl = null;
    RelWordFeatures fe = new RelWordFeatures(prm, sent, alphabet);
    List<FeatureVector> featsList = fe.getFeatures(rv);
    
    assertEquals(sent.size(), featsList.size());
    String fs = "";
    for (int i=0; i<featsList.size(); i++) {
        //for (int k=0; k<featsListSystem.out.println()
        FeatureVector feats = featsList.get(i);
        fs += "FeatureVector: " + i + "\n";
        for (IntDoubleEntry e : feats) {
            fs += alphabet.lookupObject(e.index()) + "=" + e.get() + ", \n";
        }
        fs += "\n";
    }
    System.out.println(fs);
    assertEquals(expectedFs, fs);
}
 
开发者ID:mgormley,项目名称:pacaya-nlp,代码行数:30,代码来源:RelWordFeaturesTest.java

示例3: next

import edu.jhu.prim.map.IntDoubleEntry; //导入依赖的package包/类
public IntDoubleEntry next() {
    entry.update(cursor);
    
    cursor++;
    while(cursor < row.length && row[cursor] == 0) {
        cursor++;
    }

    return entry;
}
 
开发者ID:mgormley,项目名称:prim,代码行数:11,代码来源:DenseDoubleMatrix.java

示例4: testIterator

import edu.jhu.prim.map.IntDoubleEntry; //导入依赖的package包/类
@Test
public void testIterator() {
    IntDoubleUnsortedVector v2 = new IntDoubleUnsortedVector();
    
    v2.set(1, toDouble(11));
    v2.set(3, toDouble(33));
    v2.set(4, toDouble(0));
    v2.set(5, toDouble(55));

    IntDoubleEntry e;
    Iterator<IntDoubleEntry> iter = v2.iterator();
    assertTrue(iter.hasNext());
    e = iter.next();
    assertEquals(1, toInt(e.index()));
    assertEquals(11, toInt(e.get()));

    assertTrue(iter.hasNext());
    e = iter.next();
    assertEquals(3, toInt(e.index()));
    assertEquals(33, toInt(e.get()));

    // TODO: Zeros are never explicitly added.
    //        assertTrue(iter.hasNext());
    //        e = iter.next();
    //        assertEquals(4, toInt(e.index()));
    //        assertEquals(0, toInt(e.get()));

    assertTrue(iter.hasNext());
    e = iter.next();
    assertEquals(5, toInt(e.index()));
    assertEquals(55, toInt(e.get()));

    assertFalse(iter.hasNext());                
}
 
开发者ID:mgormley,项目名称:prim,代码行数:35,代码来源:IntDoubleUnsortedVectorTest.java

示例5: testIteratorNoCompact

import edu.jhu.prim.map.IntDoubleEntry; //导入依赖的package包/类
@Test
public void testIteratorNoCompact() {
    IntDoubleUnsortedVector v2 = new IntDoubleUnsortedVector();        
    v2.add(1, toDouble(11));
    v2.add(2, toDouble(22));
    v2.add(1, toDouble(111));

    IntDoubleEntry e;
    Iterator<IntDoubleEntry> iter = v2.iteratorNoCompact();
    
    assertTrue(iter.hasNext());
    e = iter.next();
    assertEquals(1, toInt(e.index()));
    assertEquals(11, toInt(e.get()));

    assertTrue(iter.hasNext());
    e = iter.next();
    assertEquals(2, toInt(e.index()));
    assertEquals(22, toInt(e.get()));
    
    assertTrue(iter.hasNext());
    e = iter.next();
    assertEquals(1, toInt(e.index()));
    assertEquals(111, toInt(e.get()));

    assertFalse(iter.hasNext());
}
 
开发者ID:mgormley,项目名称:prim,代码行数:28,代码来源:IntDoubleUnsortedVectorTest.java

示例6: testIterator

import edu.jhu.prim.map.IntDoubleEntry; //导入依赖的package包/类
@Test
public void testIterator() {
    IntDoubleSortedVector v2 = new IntDoubleSortedVector();
    
    v2.set(1, toDouble(11));
    v2.set(3, toDouble(33));
    v2.set(4, toDouble(0));
    v2.set(5, toDouble(55));

    IntDoubleEntry e;
    Iterator<IntDoubleEntry> iter = v2.iterator();
    assertTrue(iter.hasNext());
    e = iter.next();
    assertEquals(1, toInt(e.index()));
    assertEquals(11, toInt(e.get()));

    assertTrue(iter.hasNext());
    e = iter.next();
    assertEquals(3, toInt(e.index()));
    assertEquals(33, toInt(e.get()));

    assertTrue(iter.hasNext());
    e = iter.next();
    assertEquals(4, toInt(e.index()));
    assertEquals(0, toInt(e.get()));

    assertTrue(iter.hasNext());
    e = iter.next();
    assertEquals(5, toInt(e.index()));
    assertEquals(55, toInt(e.get()));

    assertFalse(iter.hasNext());                
}
 
开发者ID:mgormley,项目名称:prim,代码行数:34,代码来源:IntDoubleSortedVectorTest.java

示例7: getStateNames

import edu.jhu.prim.map.IntDoubleEntry; //导入依赖的package包/类
public List<String> getStateNames() {
    List<String> names = new ArrayList<String>();
    for (LogLinearExDesc desc : descList) {
        StringBuilder sb = new StringBuilder();
        for (IntDoubleEntry entry : desc.getFeatures()) {
            sb.append(entry.index());
            sb.append(":");
        }
        names.add(sb.toString());
    }
    return names;
}
 
开发者ID:mgormley,项目名称:pacaya,代码行数:13,代码来源:LogLinearEDs.java

示例8: getRowEntries

import edu.jhu.prim.map.IntDoubleEntry; //导入依赖的package包/类
public Iterable<IntDoubleEntry> getRowEntries(int row) {
    return rows[row];
}
 
开发者ID:mgormley,项目名称:prim,代码行数:4,代码来源:SparseRowDoubleMatrix.java

示例9: getRowEntries

import edu.jhu.prim.map.IntDoubleEntry; //导入依赖的package包/类
public Iterable<IntDoubleEntry> getRowEntries(int row) {
    throw new RuntimeException("not implemented");
}
 
开发者ID:mgormley,项目名称:prim,代码行数:4,代码来源:SparseColDoubleMatrix.java

示例10: getColEntries

import edu.jhu.prim.map.IntDoubleEntry; //导入依赖的package包/类
public Iterable<IntDoubleEntry> getColEntries(int col) {
    return cols[col];
}
 
开发者ID:mgormley,项目名称:prim,代码行数:4,代码来源:SparseColDoubleMatrix.java

示例11: getRowEntries

import edu.jhu.prim.map.IntDoubleEntry; //导入依赖的package包/类
@Override
public Iterable<IntDoubleEntry> getRowEntries(int row) {
    throw new RuntimeException();
}
 
开发者ID:mgormley,项目名称:prim,代码行数:5,代码来源:TransposeView.java

示例12: getRowEntries

import edu.jhu.prim.map.IntDoubleEntry; //导入依赖的package包/类
@Override
public Iterable<IntDoubleEntry> getRowEntries(int row) {
    return new DenseDoubleVectorIterator(matrix[row]);
}
 
开发者ID:mgormley,项目名称:prim,代码行数:5,代码来源:DenseDoubleMatrix.java

示例13: iterator

import edu.jhu.prim.map.IntDoubleEntry; //导入依赖的package包/类
@Override
public Iterator<IntDoubleEntry> iterator() {
    return this;
}
 
开发者ID:mgormley,项目名称:prim,代码行数:5,代码来源:DenseDoubleMatrix.java

示例14: iterator

import edu.jhu.prim.map.IntDoubleEntry; //导入依赖的package包/类
@Override
public Iterator<IntDoubleEntry> iterator() {
    compact();
    return new IntDoubleIterator();
}
 
开发者ID:mgormley,项目名称:prim,代码行数:6,代码来源:IntDoubleUnsortedVector.java

示例15: iteratorNoCompact

import edu.jhu.prim.map.IntDoubleEntry; //导入依赖的package包/类
public Iterator<IntDoubleEntry> iteratorNoCompact() {
    return new IntDoubleIterator();
}
 
开发者ID:mgormley,项目名称:prim,代码行数:4,代码来源:IntDoubleUnsortedVector.java


注:本文中的edu.jhu.prim.map.IntDoubleEntry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。