- class composes.composition.weighted_additive.WeightedAdditive(alpha=None, beta=None)¶
Implements weighted additive compositional model:
\(\vec{p} = \alpha \vec{u} + \beta \vec{v}\)where \(\vec{p}\) is the vector of the composed phrase and \(\vec{u}, \vec{v}\) are the vectors of the components
When \(\alpha=\beta=0.5\) the model performs simple vector addition.
- class composes.composition.multiplicative.Multiplicative¶
Implements the component-wise multiplication compositional model:
\(\vec{p} = \vec{u} \cdot \vec{v}\)where \(\vec{p}\) is the vector of the composed phrase and \(\vec{u}, \vec{v}\) are the vectors of the components.
\(\vec{u} \cdot \vec{v} = (u_1v_1,...,u_nv_n)\)
- class composes.composition.lexical_function.LexicalFunction(**kwargs)¶
Implements the lexical function compositional model.
\(\vec{p} = U \vec{v}\)where \(\vec{p}\) is the vector of the composed phrase, \(U\) is the matrix representation of the first component (the lexical function) and \(\vec{v}\) is the vector representation of the second component
- class composes.composition.full_additive.FullAdditive(**kwargs)¶
Implements the full additive compositional model:
\(\vec{p} = A \vec{u} + B \vec{v}\)where \(\vec{p}\) is the vector of the composed phrase, \(\vec{u}, \vec{v}\), the vectors of the components and \(A\), \(B\) are two matrices.
- class composes.composition.dilation.Dilation(lambda_=None)¶
Implements the dilation compositional model:
\(\vec{p} = (\vec{u} \cdot \vec{u}) \vec{v} + (\lambda - 1) (\vec{u} \cdot \vec{v}) \vec{u}\)where \(\vec{p}\) is the vector of the composed phrase, \(\vec{u}, \vec{v}\) the vectors of the components and \(\lambda\) is a scalar.