Package TEES :: Package ExampleBuilders :: Package FeatureBuilders :: Module MultiEdgeFeatureBuilder :: Class MultiEdgeFeatureBuilder
[hide private]

Class MultiEdgeFeatureBuilder

source code

FeatureBuilder.FeatureBuilder --+
                                |
                               MultiEdgeFeatureBuilder

This feature builder generates features describing a pair of word tokens connected by one or more dependencies. Most of the features it produces are built on the shortest undirected path of dependencies between the two tokens.

Instance Methods [hide private]
 
__init__(self, featureSet, style=None) source code
 
getEdgeType(self, edge) source code
 
definePredictedValueRange(self, sentences, elementName) source code
 
setFeatureVector(self, features=None, entity1=None, entity2=None, resetCache=True)
When the feature builder builds features, they are put to this feature vector.
source code
 
buildPredictedValueFeatures(self, element, tag)
Edge examples are usually predicted on top of predicted entities.
source code
 
buildEntityFeatures(self, sentenceGraph)
Build features for the two entities of the current example.
source code
 
buildPathLengthFeatures(self, pathTokens)
Simple numeric features about the length of the path
source code
 
buildSentenceFeatures(self, sentenceGraph) source code
 
buildTerminusTokenFeatures(self, pathTokens, sentenceGraph)
Token features for the first and last tokens of the path
source code
 
buildWalkPaths(self, pathTokens, walks, sentenceGraph) source code
 
buildPathGrams(self, length, pathTokens, sentenceGraph)
Goes through all the possible walks and builds features for subsections of "length" edges.
source code
 
addType(self, token, sentenceGraph, prefix='annType_') source code
 
buildPathEdgeFeatures(self, pathTokens, sentenceGraph) source code
 
buildSingleElementFeatures(self, pathTokens, sentenceGraph) source code
 
buildTerminusFeatures(self, token, ignoreEdges, prefix, sentenceGraph) source code

Inherited from FeatureBuilder.FeatureBuilder: getEntityType, getPOSSuperType, getTokenAnnotatedType, getTokenFeatures, normalizeFeatureVector, setFeature, setTag

Method Details [hide private]

__init__(self, featureSet, style=None)
(Constructor)

source code 
Parameters:
  • featureSet (IdSet) - feature ids
Overrides: FeatureBuilder.FeatureBuilder.__init__

setFeatureVector(self, features=None, entity1=None, entity2=None, resetCache=True)

source code 

When the feature builder builds features, they are put to this feature vector.

Parameters:
  • features (dictionary) - a reference to the feature vector
  • entity1 (cElementTree.Element) - an entity used by trigger or edge feature builders
  • entity2 (cElementTree.Element) - an entity used by trigger or edge feature builders
  • resetCache (boolean) - Some intermediate features are cached to speed up example generation. This cache should be cleared when moving to another example.
Overrides: FeatureBuilder.FeatureBuilder.setFeatureVector

buildPredictedValueFeatures(self, element, tag)

source code 

Edge examples are usually predicted on top of predicted entities. The entities' confidence scores can be used as features for edge detection. For these features to be used, the model must also have been trained on data that contains prediction confidence scores.

buildEntityFeatures(self, sentenceGraph)

source code 

Build features for the two entities of the current example. These features are labeled as "e1" or "e2", so entity order is meaningful.