# Compositional Distributional Semantics with Syntactic Dependencies and Sectional Preferences
## 3 A Dependency-Based Compositional Strategy for Meaning Construction
### System's Configuration  
#### 4.2.1 DepFunc  
Considering the dependency-based compositional strategy defined above in Section 3, the system called _DepFunc_ was updated and set up for the multilingual semantic task introduced in the previous subsection (The system is available at [[https://github.com/gamallo/DepFunc](https://github.com/gamallo/DepFunc)]([https://github.com/gamallo/DepFunc](https://github.com/gamallo/DepFunc)) (accessed on 15 June 2021)). The first version of DepFunc was fully described in [12]. Although the dependency-based strategy is designed to work with any type of phrase and sentence, in practice our system only adapts to linguistic constructions with a fixed and predefined syntactic structure. DepFunc builds static and count-based word vectors by computing word occurrences in lexico-syntactic contexts. This is performed by making use of the multilingual dependency parser DepPattern [27] and the count-based strategy described in [28], where only the most relevant lexico-syntactic contexts are selected. With DepFunc it is also possible to construct vectors by inverting what is considered object and context, resulting in vectors of lexico-syntactic units (e.g., _company_ in the subject position), whose dimensions are the words (seen as contexts) that appear in those syntactic positions. In a recent work [29], we used as static vectors word embeddings built with _word2 vec_, configured with CBOW algorithm, window of 5 tokens, negative-sampling parameter of 15, and 300 dimensions [30]. However, the final compositional vectors derived from these word embeddings yielded worse results on several semantic tasks than syntax-based count-based vectors. This is why we decided to use the latter vectors with DepFunc in the current experiments. Static vectors were built from the English, Spanish, and Portuguese wikipedias (dump files of November 2019 ([[https://dumps.wikimedia.org/enwiki/](https://dumps.wikimedia.org/enwiki/)]([https://dumps.wikimedia.org/enwiki/](https://dumps.wikimedia.org/enwiki/))) (accessed on 15 June 2021)), containing over 2500 M, 1000 M, and 700 M words, respectively. Several configurations of the dependency-based compositional approach have been implemented in DepFunc. First, we distinguish between the distributional models of lemmas from those based on lexico-syntactic contexts:  
**lemma**: vectors are made of lemmas (objects) in lexico-syntactic positions (dimensions)
**lemma + rel**: vectors are made of lexico-syntactic positions (objects) occurring with lemmas (dimensions)  
Then, considering the direction of the compositional process, we can build several compositional vectors representing the meaning of the noun-verb-noun expression. Given the expression _the company fired the employee_, the following compositional vectors representing different points of view of the composite expression can be built:  
**left-to-right head**: This builds the compositional vector of the verb head _fire_, as a result of being contextualized first by the selectional preferences imposed by the nominal subject _company_ and then by the selectional preferences of the direct object _employee_. **left-to-right dep-obj**: This builds the compositional vector of the direct object _employee_, as a result of being contextualized by the preferences imposed by _fire_ previously combined with the subject _company_. **left-to-right sentence**: The addition of the two previous left-to-right values (head and dep). **right-to-left head**: This builds the compositional vector of the verb head _fire_, as a result of being contextualized first by the selectional preferences imposed by the direct object _employee_ and then by the selectional preferences of the subject _company_. **right-to-left dep-subj**: This builds the compositional vector of the subject _company_, as a result of being contextualized by the preferences imposed by _fire_ previously combined with the direct object _employee_. **right-to-left sentence**: The addition of the two previous right-to-left values (head and dep).