private void addRelation(String object, String attribute) {
        double val;
        int row, col;

        object = object.toLowerCase();
        attribute = attribute.toLowerCase();

        // get row in matrix
        if( objectTable.containsKey(object) ) {
            // if the object already exists in matrix, find its index
            row = objectTable.get(object);
        } else {
            // otherwise give the object a new index number
            row = Integer.valueOf(objectCounter.getAndIncrement());
            // insert new object/index pair into lookup table
            objectTable.put( object, row );
            System.out.println(object + " " + row);
        }

        // get column in matrix
        if( attributeTable.containsKey(attribute) ) {
            col = attributeTable.get(attribute);
        } else {
            col = Integer.valueOf(attributeCounter.getAndIncrement());
            attributeTable.put( attribute, col );
        }

        // update entry in matrix which records how many times the
        // object/attribute pair has been seen
        if( row < syntacticCooccurrence.rows() && 
            col < syntacticCooccurrence.columns()) {
            // if there's already an entry for the object and attribute, get the
            // current value for the pair of words
            val = syntacticCooccurrence.get(row, col);
            // increment the current value by one and store in matrix
            syntacticCooccurrence.set(row, col, val+1);
        } else {
            // otherwise set the row, col value to 1
            syntacticCooccurrence.set(row, col, 1.0);
        }
    }
private void addRelation ( String object , String attribute ) { double val ; int row , col ; object = object . toLowerCase ( ) ; attribute = attribute . toLowerCase ( ) ; if ( objectTable . containsKey ( object ) ) { row = objectTable . get ( object ) ; } else { row = Integer . valueOf ( objectCounter . getAndIncrement ( ) ) ; objectTable . put ( object , row ) ; System . out . println ( object + " " + row ) ; } if ( attributeTable . containsKey ( attribute ) ) { col = attributeTable . get ( attribute ) ; } else { col = Integer . valueOf ( attributeCounter . getAndIncrement ( ) ) ; attributeTable . put ( attribute , col ) ; } if ( row < syntacticCooccurrence . rows ( ) && col < syntacticCooccurrence . columns ( ) ) { val = syntacticCooccurrence . get ( row , col ) ; syntacticCooccurrence . set ( row , col , val + 1 ) ; } else { syntacticCooccurrence . set ( row , col , 1.0 ) ; } }
Adds a relation pair to the matrix