All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gr.demokritos.iit.conceptualIndex.structs.DistributionGraph Maven / Gradle / Ivy

Go to download

The JINSECT toolkit is a Java-based toolkit and library that supports and demonstrates the use of n-gram graphs within Natural Language Processing applications, ranging from summarization and summary evaluation to text classification and indexing.

The newest version!
/*
 * DistributionGraph.java
 *
 * Created on 24 Ιούλιος 2006, 5:41 μμ
 *
 */

package gr.demokritos.iit.conceptualIndex.structs;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import gr.demokritos.iit.jinsect.structs.UniqueVertexGraph;
import java.io.IOException;
import java.io.Serializable;
import salvo.jesus.graph.Edge;
import salvo.jesus.graph.Vertex;
import salvo.jesus.graph.WeightedEdge;
import salvo.jesus.graph.WeightedEdgeImpl;

/** A graph with weighted edges mapped to distributions.
 *
 * @author ggianna
 */
public class DistributionGraph extends UniqueVertexGraph implements Serializable {
    /** The mapping between edges and distributions.
     */
    public HashMap EdgeDistros;
  
    private void writeObject(java.io.ObjectOutputStream out)
      throws IOException {
        // Write edge info
        out.writeInt(this.getEdgeSet().size()); // Output edge count
        Iterator iIter = this.getEdgeSet().iterator();
        while (iIter.hasNext()) {
            WeightedEdge eCur = (WeightedEdge)iIter.next();
            out.writeObject(eCur.getVertexA());
            out.writeObject(eCur.getVertexB());
            out.writeDouble(eCur.getWeight());
        }
        // Output edge distros
        out.writeObject(EdgeDistros);
    }

    private void readObject(java.io.ObjectInputStream in)
      throws IOException, ClassNotFoundException {
        // Get edge count
        int iEdgeCnt = in.readInt();
        // Get edge info
        for (int iCnt=0; iCnt" + sB + "(Distro: " + getEdgeDistro(e).toString() + ")\n");
        }
        
        return sRes;
    }
    
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy