Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| MaltParser 1.5
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.maltparser.ml.lib
Class FeatureMap

    java.lang.Object
      org.maltparser.ml.lib.FeatureMap

All Implemented Interfaces:
  Serializable

    public class FeatureMap

extends Object
implements Serializable

The purpose of the feature map is to map MaltParser's column based features together with the symbol code from the symbol table to unique indices suitable for liblinear and libsvm. A feature column position are combined together with the symbol code in a 64-bit key (Long), where 16 bits are reserved for the position and 48 bits are reserved for the symbol code.

Author:
  Johan Hall
See Also:
  Serialized Form

Constructor Summary
`FeatureMap()` Creates a feature map and sets the feature counter to 1

Method Summary
`int` | `addIndex(int featurePosition, int code)` Adds a mapping from a combination of the position in the column-based feature vector and the symbol code to an index value suitable for liblinear and libsvm.
`int` | `addIndex(int featurePosition, int code1, int code2)`
`int` | `getFeatureCounter()`
`int` | `getIndex(int featurePosition, int code)` Return
`int` | `getIndex(int featurePosition, int code1, int code2)`
`int` | `size()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### FeatureMap

    public FeatureMap()

  Creates a feature map and sets the feature counter to 1

Method Detail

### addIndex

    public int addIndex(int featurePosition,
                        int code)

  Adds a mapping from a combination of the position in the column-based feature vector and the symbol code to an index value suitable for liblinear and libsvm.

  Parameters:
    `featurePosition` - a position in the column-based feature vector
    `code` - a symbol code
  Returns:
    the index value

### getIndex

    public int getIndex(int featurePosition,
                        int code)

  Return

  Parameters:
    `featurePosition` - the position in the column-based feature vector
    `code` - the symbol code suitable for liblinear and libsvm
  Returns:
    the index value if it exists, otherwise -1

### addIndex

    public int addIndex(int featurePosition,
                        int code1,
                        int code2)

### getIndex

    public int getIndex(int featurePosition,
                        int code1,
                        int code2)

### size

    public int size()

  Returns:
    the size of the map

### getFeatureCounter

    public int getFeatureCounter()

  Returns:
    the current value of the feature counter.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| MaltParser 1.5
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2007-2011 Johan Hall, Jens Nilsson and Joakim Nivre.