The mapping of lexical meanings to wordforms is a major feature of natural languages. While usage pressures might assign short words to frequent meanings (Zipf's law of abbreviation), the need for a productive and open-ended vocabulary, local constraints on sequences of symbols, and various other factors all shape the lexicons of the world's languages. Despite their importance in shaping lexical structure, the relative contributions of these factors have not been fully quantified. Taking a coding-theoretic view of the lexicon and making use of a novel generative statistical model, we define upper bounds for the compressibility of the lexicon under various constraints. Examining corpora from 7 typologically diverse languages, we use those upper bounds to quantify the lexicon's optimality and to explore the relative costs of major constraints on natural codes. We find that (com-positional) morphology and graphotactics can sufficiently account for most of the complexity of natural codesas measured by code length. Communication through language can be modeled under Shannon's classic communication framework (Shannon, 1948). Under this perspective, linguistic utterances are codes which need to be decoded by a receiver (listener) who is interested in the message (meaning) they encode. Famously, Zipf (1949) posited that language users shape these codes so to accommodate the principle of least effort . The most widely discussed and investigated empirical evidence for this feature is the so-called law of abbreviation , an ostensive negative correlation between word frequency and word length (Zipf, 1935; Bentz and Ferrer-i-Cancho, 2016). Communication effort decreases by encoding frequent messages in shorter words. This correlation, however, is characteristically modest. There are many instances of short low-frequency words, like wen and jib in English, 1 and long frequent words, like happiness and anything . While the lexicon might be shaped by economy of expression, it is clearly not fully optimized for it. There are multiplepossibly competingreasons why this could be the case. First of all, the sequence of speech sounds, signs, or orthographic characters that serve as building blocks in a language comply with specific rules. These are referred to as phonotactics (in the case of speech sounds) and graphotactics (in written language). 2 On top of these constraints, the lexicons of many languages of the world re-use subparts of words; these sub-parts can be productively composed to produce new meaningswhich is referred to as morphological composition . This largely determines the family of wordforms associated with a given basic meaningfor instance, given the wordform health and its meaning, the nominal morphology of English readily provides 1 These mean, respectively, a benign tumor on the skin and a triangular sail on a boat. 2 All languages impose these constraints on their wordforms, which might be leveraged for production and learnability (Vitevitch and Luce, 1999; Boersma, 1998). the forms for many of its derived meanings, including healthy , unhealthy , healthier , etc. Beyond these well-attested constraints, it might be argued that the negative correlation between the length of a word and its frequency is not the locus of optimization given the economy of expression pressure. Instead, wordforms might be efficiently encoding meanings based on their contextual surprise rather than frequency (Piantadosi et al., 2011). Finally, there is no reason to expect lexicons to be fully optimized for the economy of expressionthis factor might steer languages in a given direction, but there is certainly room for non-compliance. Languages are, after all, not engineered systems but cultural artifacts. In this paper, we examine how marginally non-optimal the lexicon is by taking the vantage point of the law of abbreviation. We develop a method to quantify the role of different linguistic constraints on determining wordforms, and we produce estimates on how compressible the lexicon could be in their absence (including morphology and phono-tactics/graphotactics). We thus define an upper bound for the compressibility of a lexicon optimized purely for word length efficiency. As stated above, our notion of optimality is derived from Zipf's principle of least effort in the form of the law of abbreviation (Zipf, 1949; Mandelbrot, 1953; Ferrer-i-Cancho et al., 2020). However, this is by no means the only theory under which wordforms are optimized for encoding their messages. One influential hypothesis is that languages optimize for uniform information density (Fenk and Fenk, 1980; Aylett and Turk, 2004; Levy and Jaeger, 2007)roughly keeping the amount of information conveyed in a unit of time constant. In an information-theoretic setting, this would be equivalent to maximizing the use of a noisy channel between the speaker and an audiencekeeping the transmission rate close to the channel capacity. Under this view, it is not necessarily the case that words should be as short as possible. Rather, words that are infrequent or typically less predictable in context should be longer and take more time to produceperhaps because the increased duration makes them more robust to noise. Consistent with this perspective, it has been shown that, in production, words with higher information content take longer to pronounce (Bell et al., 2003; Jurafsky et al., 2001; Gahl, 2008). Additionally, words which are typically predictable in context are shorter than words which are less predictable in context (Piantadosi et al., 2011). On another note, a purely coding-theoretically efficient language could make the lexical codes context dependent (Piantadosi et al., 2012), since context often disambiguates words (Dautriche et al., 2018; Pimentel et al., 2020a). Additionally, the meaning or message being conveyed by a given word might bias its form. Within languages, there seems to be a pressure for more semantically similar words to also be more phonologically similar (Monaghan et al., 2014; Dingemanse et al., 2015; Dautriche et al., 2017; Pimentel et al., 2019). Across languages, words for the same referents exhibit detectable patterns in term of their phonological makeup (Blasi et al., 2016), phonotactics (Pi-mentel et al., 2021b), as well as word length (Lewis and Frank, 2016)this is driven by semantic features such as size, quality or complexity. Finally, there is a cross-linguistic tendency for lexicons to place higher surprisal in word-initial segments (van Son and Pols, 2003a,b; King and Wedel, 2020; Pimentel et al., 2021a) making words more constrained in their choice of final segments. These aspects of language might also collide with a purely Zipfian conception of lexicon optimality. In this work, however, we consider optimality exclusively in the Zipfian sense of compressibility, and we ask how far natural language lexicons are from accommodating to this paradigm. We build a number of models that differ in relation to whether they accommodate to the law of abbreviation, to compositional morphology and to graphotactics. The comparison among these systems allows us to explore the extent to which each part of the linguistic system contributes to the overall cost of the linguistic code. It should be noted, though, that the consequences of unmodeled sources of structure in the lexicon (such as persistent sound-meaning associations or the adaptation of the code to surprisal effects) will forcibly be confounded with the overall lack of fit between our models and the data. The morphological cost i.e. the cost of morphology to a code's lengthis associated with the fact that, across many languages, words are often constructed of meaningful sub-parts that are productively reused across the lexicon. Practically, this means that the wordforms of different meanings might not be independent if they overlap in a particular dimension that is captured by the morphology of the language. For instance, most wordforms that express two or more referents of a kind share a word-final suffix -s in English ( towers , cats , ideas , etc). We treat this cost by considering optimal codes where the basic unit in the lexicon is not the word but sub-pieces, as determined by the unsupervised morphological parser Morfessor (Creutz and Lagus, 2007; Smit et al., 2014). 3 Under this regime, a word like unmatched is parsed into the tokens un , match , and ed . The graphotactic cost concurrently imposes a set of additional constraints, determining which sequences of grapheme segments can constitute a valid wordform in a given language. While the main driver of these lexical constraints is actually phonotacticswhich imposes rules dictating the possible phoneme sequenceswe focus on graphotactics because our object of study is written language corpora. The degree to which phonotactics and graphotactics mirror each other vary substantially across languages; thus, in this work (which uses corpora from Wikipedia) we make our claims about language in the written modality and leave it to future work to generalize this work to the phonological domain. This could be done by applying the same method to phonemic representations of words. This paper treats the lexicon , which we define as a set of pairs: L = { ( m n , w n ) } Nn =1 . In general, this set will be infinite; m n refers to a lexical meaning , taken from an abstract set M , and w n refers to a wordform , taken from   , the Kleene closure of a grapheme alphabet  . 4 When the exact index is unnecessary in context, we will drop the subscripted n ; and we make use of uppercase letters to refer to random variables (e.g. M or W ) where necessary. We will write meanings in typewriter font, e.g. cat , and wordforms in italics: cat (English), kissa (Finnish). Viewing the lexicon from a coding-theoretic perspective, we consider the mapping from meaning to form as a code : C : M    . Every language comes endowed with a natural code C nat , which 3 We also present results using the additional sub-word tokenizers: byte pair encoding (Gage, 1994; Sennrich et al., 2016) and word piece (Schuster and Nakajima, 2012). See Bostrom and Durrett (2020) for a discussion of the tradeoffs of these schemes, in terms of performance and compressibility. 4 This alphabet is augmented with an end-of-word symbol. is the observed mapping from lexical meanings to forms. As an example, consider the meaning cat and its Finnish form: we have C nat ( cat ) = kissa . The topic of interest in this paper is the efficiency of language's natural codes. The space of meanings and lexical ambiguity. The space of meanings M is non-trivial to define, but could be operationalized as R d , which is infinite, continuous and uncountable (Pilehvar and Camacho-Collados, 2020). Meanwhile, the space of wordforms   is also infinite, but discrete and countable. As such, many meanings m n must be mapped to the same form, resulting in lexical ambiguity. See Pimentel et al. 2020a for a longer discussion on these operationalizations. In this work, though, we do not engage with such ambiguity, considering M as an abstract set of meanings, each of which defined by a distinct wordformi.e. the code C nat is a bijection. A consequence of this strategy is that we take the space of meanings to be infinite, but discrete and countable; we only distinguish as many meanings as there are words, therefore, we end up with a countable number of meanings. Additionally, by considering a distinct meaning m n for each wordform w n in the lexicon, we only consider codes with as much lexical ambiguity as in the original language. 5 3.1 Words as Meanings The unigram distribution represents the frequency of each wordform in a text, i.e. the probability of a token without conditioning on context p ( W = kissa ) . In this work, though, we assume the unigram distribution is a distribution over M , e.g. p ( M = cat ) this way we can analyze how changing the code C would affect its efficiency. As stated above, though, we take C nat to be a bijection. Such an assumption implies there is a deterministic function from wordforms to meanings in a specific lexicon C  1 nat ( w ) = m . Probabilistically speaking, we write p ( M = m | W = w ) = 1 (cid:110) m = C  1 nat ( w ) (cid:111) (1) p ( W = w | M = m } = 1 (cid:110) w = C nat ( m ) (cid:111) (2) 5 Lexical ambiguity allows the mapping of multiple meanings to the same wordform and, in doing so, it enables the preferential re-use of short words (Piantadosi et al., 2012). Thus, the mapping of multiple meanings to the same form could be a source of efficiency in the lexicon (Fenk-Oczlon and Fenk, 2008; Ferrer-i-Cancho and Vitevitch, 2018; Casas et al., 2019; Trott and Bergen, 2020; Xu et al., 2020). Nonetheless, we do not treat it explicitly here. This mapping implies p ( M = m n ) = (cid:88) w    p ( M = m n , W = w ) (3) = p ( W = w n ) Given this equality, we can reduce the problem of estimating the unigram distribution over meanings p ( m ) to the one over wordforms p ( w ) . 3.2 Code-length and optimality As stated above, we assume the unigram distribution to be a distribution over M . We now define the cost of a code as its expected length: cost( C ) = (cid:88) m M p ( m ) | C ( m ) | (4) A smaller cost, then, implies a more efficient code. The famous source-coding theorem of Shannon (1948) gives us a theoretical limit on coding cost: H( M )  cost( C (cid:63) ) < H( M ) + 1 (5) where we define C (cid:63) to be the most efficient code, and where H( M ) is the entropy of distribution p : H( M ) = (cid:88) m M p ( m ) log |  | 1 p ( m ) (6) According to the source-coding theorem, if we know the true distribution p over lexical meanings, then we know how to optimally code them. This turns the problem of estimating the efficiency of the lexicon into the one of estimating the entropy of an unknown discrete distribution p , a well-defined task with a pool of previous work (Miller, 1955; Antos and Kontoyiannis, 2001; Paninski, 2003; Archer et al., 2014). Because the distributions over wordforms and meanings are equivalent, we estimate the entropy H( M ) using wordforms: H( M ) = H( W ) = (cid:88) w    p ( w ) log |  | 1 p ( w ) (7) 3.3 Finite and Infinite Support This section reviews a few technical results as regards the construction of codes from a probability distribution. If p had finite supporti.e. there were a finite set of possible meanings or wordformsa simple Huffman encoding (Huffman, 1952) would give us an optimal code for our lexicon. However, this is not the case p ( w ) has support on all of   so we might need a more complex strategy to get such a code. Linder et al. (1997) proved the existence of an optimal encoding for a distribution with infinite support, given that it has finite entropy. Proposition 1. If distribution p ( w ) has finite entropy, i.e. H( W ) <  , then there exists an optimal encoding for it such that: cost( C (cid:63) ) < H( M ) + 1 . Proof. See Linder et al. (1997). Luckily, under a weak assumption, this is the case for a well-trained language model. Definition 1. Language model p ( w ) is  -smooth if for all histories h    we have p ( EoW | h )   . 6 This fairly weak assumption states that partial wordforms have a lowerbound on their probability of ending. As such, there is an upperbound on the probability of a wordform which decreases exponentially with its length. Armed with this assumption, we can now show that any  -smooth language model has a finite entropy. Proof. See App. C. Safe-guarded by Propositions 1 and 2, we now train a model to capture the unigram distribution. We will then use this model to estimate the code-length of an optimal lexicon. Zipf's (1935) law states that the frequency of a word in a corpus is inversely proportional to its rank, resulting in a power-law distribution where a small subset of the words dominate the corpus. As such, navely training a character-level model on a language's tokens (i.e. predicting non-contextual wordforms with their natural corpus frequencies) would be unlikely to capture morphological regularities (Goldwater et al., 2011). Furthermore, it would burden the model to learn a mostly arbitrary assignment between form and frequency. As an example, the English verb make is much more common than the nouns cake and lake , even if graphotactically they may be equally probable. A closer inspection of English shows that most frequent words tend to come from closed lexical classes including articles, pronouns, prepositions, and auxiliaries, such as the , of , it and be (Sinclair, 1999). These words tend to be short and manifest fossilized graphotactics (and phonotactics) as well 6 Under this assumption our language model is also consistent, as defined by Welleck et al. (2020)sequences with infinite length have asymptotically zero probability mass. as a more abundant prevalence of otherwise rare segments, such as the voiced and voiceless dental fricatives (orthographically expressed with th ). These rare segments would be overrepresented in such a nave training regime, making it hard for the character-level model to correctly represent the language's graphotactics. In order to address the problem of skewed frequencies, we use a novel neuralization of Goldwater et al.'s (2011) two-stage model to capture the unigram distribution. This model consists of two components: a wordform generator and a token frequency adaptor . The generator is a character-level model which produces wordforms, for which we use an LSTM; 7 this model should place similar probability mass on graphotactically good wordforms, such as make , cake , and lake . Meanwhile, the adaptor sets the frequency with which these wordforms will appear as tokens. Following Goldwater et al., we base our adaptor on the PitmanYor Chinese restaurant process (PYCRP; Pitman and Yor, 1997), which allows the adaptor to model a power-law distribution; this model is then responsible for capturing the fact that make is a more frequent token than cake , and lake . The generative process of our two-stage model is presented graphically in Fig. 2. Our generator is a character-level LSTM language model, which generates a potentially infinite number of i.i.d. wordforms { (cid:96) k } Kk =1 . Independently, the PYCRP adaptor assigns each observed token in a dataset to a cluster { z n } Nn =1 . In the literature, the value of z n is the table assignmment of the n th token. These clusters are then used as lookup indices to the wordforms, producing the observed word tokens { w n } Nn =1 where w n = (cid:96) z n . In general N (cid:29) K , so tokens with the same wordform are grouped in few clusters. In this way, the adaptor sets the frequency with which wordforms appear as tokens in a corpus by defining each cluster's probability. Generating Wordforms. As mentioned above, wordforms are sampled i.i.d. from a distribution p  over strings defined by the generator. Specifically, this distribution over forms is defined as follows: p  ( (cid:96) ) = | (cid:96) | (cid:89) t =1 p  ( (cid:96) t | (cid:96) <t ) (8) 7 LSTMs have been shown to be able to model phonotactics well by Pimentel et al. (2020b), and so we expect them to also work well with graphotactics. where (cid:96) is a vector of characters forming a word and (cid:96) t is its t th character. 8 Each of these characters is encoded with a lookup vector, producing representations e t  R d 1 where d 1 is the embedding size. These embeddings are then used as input to an LSTM (Hochreiter and Schmidhuber, 1997), producing the representations h t  R d 2 , where d 2 is the size of the LSTM's hidden layer. The LSTM output is further used to obtain the distribution over potential characters: p  ( (cid:96) t | (cid:96) <t ) = softmax( W h t + b ) (9) In this equation, both W  R |  | d 2 and b  R |  | are learnable parameters and the zero vector is used as the initial hidden state h 0 . The distribution p  , representing the generator, is then used to generate the set of wordforms { (cid:96) k } Kk =1 , which is expected to represent the graphotactics and morphology of the language. Notedly, these wordforms do not explicitly capture any notion of token frequency. 9 Adapting Word Frequencies. The adaptor is responsible for modeling the word frequencies, and it has no explicit notion of the wordforms themselves. The PYCRP assigns each token n to a cluster z n . Each cluster z n , in turn, has an associated wordform (cid:96) z n , sampled from the generator. Consequently, all instances in a cluster share the same wordform. The probability of an instance n being assigned to cluster z n is defined as follows: p ( Z n = z n | z <n ) (10)  (cid:40) c ( z n ) <n  a 1  z n  K <n (old cluster) a  K <n + b z n = K <n + 1 (new cluster) 8 We note two subscripts are used here: k refers to the k th wordform, while t indexes the t th character in the wordform. In this equation, K <n is the current number of populated clusters; while c ( z n ) <n is the number of instances currently assigned to cluster z n . The PYCRP has two hyperparameters: 0  a < 1 and b  0 . The parameter a controls the rate in which the clusters grow (Teh, 2006), while b controls an initial preference for dispersion. Together, these ensure the formation of a long-tailconcocting a power-law distribution for the cluster frequencies. This property allows a cluster with wordform make , for example, to have an exponentially larger frequency than its graphotactic neighbor cake . Modeling Word Tokens. Finally, given the set of wordforms and the cluster assignments, defining the form associated with a token is deterministic. Since each cluster only contains instances of one wordform, the form of a token is defined looking up the label of the cluster it was assigned to (cid:96) z n : p ( W n = w n | z n , (cid:96) ) = 1 { w n = (cid:96) z n } (11) This way, the adaptor captures the frequency information of the words in the corpuswhereas the generator can focus on learning the language's graphotactics and morphology. Model training. Unfortunately, we cannot directly infer the parameters of our model with a closed form solution. We thus use a solution akin to expectation maximization (Wei and Tanner, 1990): We freeze our LSTM generator while learning the PYCRP parameters, and vice versa . The PYCRP is trained using Gibbs sampling. For each token, we fix all cluster assignments z  n except for one z n . This cluster is then re-sampled from the marginal p ( Z n = z n | z  n , (cid:96) , w n ) , where we have access to w n since it is an observed variable. During this optimization small clusters may vanish, and new clusters z n = K + 1 (previously with no samples) may be created. This procedure, thus, may also produce new sets of wordforms { (cid:96) k } K (cid:48) k =1 , composed of the populated clusters' labels (where K (cid:48) is the new number of clusters). We assume the distribution of these wordformswhich have dampened frequenciesto be more balanced than in the original full set of word tokens. The LSTM is trained using stochastic gradient descent, minimizing the cross-entropy of precisely this set of cluster's wordforms. As such, it is expected to be a more representative model of a language's graphotactics; the irregular common words are less dominant in this training set. We give a longer explanation of our model training procedure, together with the used hyperparameters, in App. Despite its slightly odd formulation, the two-stage model has an intuitive interpretation. Once we have learned (and fixed) its parameters, we obtain the marginal probability of a wordform as: p ( w ) = (12) c w  smoothing factor (cid:122) (cid:125)(cid:124) (cid:123) n w  a | z | + b (cid:124) (cid:123)(cid:122) (cid:125) smoothed unigram frequencies + ( a  K + b ) | z | + b (cid:124) (cid:123)(cid:122) (cid:125) interpolation weight  p  ( w ) (cid:124) (cid:123)(cid:122) (cid:125) LSTM In this equation, c w is the count of tokens with form w in the training set, while n w is the number of distinct clusters with this same form. The model interpolates between a smoothed unigram corpus frequency and the probability an LSTM gives the analyzed wordform. This interpolation enables the model to place a non-zero probability mass on all possible wordformsthus modeling an open vocabulary and having infinite supportwhile also placing a large probability mass on frequent wordforms. Furthermore, the smoothing factors per word type, together with the interpolation weight, are holistically learned by the PYCRP model using the training set. 10 5 Experimental Setup 5.1 Evaluation The value in which we are interested in this work is the expected cost of a code, given in eq. (4). We can easily estimate this value for a natural code by using its sample estimate: cost( C nat )  1 NN (cid:88) n =1 | C nat ( m n ) | = 1 NN (cid:88) n =1 | w n | (13) For an optimal code, we can upperbound it using the entropy of the distribution, while the entropy itself can be upperbounded by the cross-entropy of a model on it. We can compute this upperbound with a sample estimate of the cross-entropy: cost( C (cid:63) )  H( W ) + 1  H  ( W ) + 1 (14) (cid:46) 1 NN (cid:88) n =1 log |  | 1 p  ( w n ) + 1 10 Our model consistently produced lower cross-entropies (on held out tokens) to the ones of an LSTM baseline na  vely trained on a language's tokens. Shannon (1948) code's lengths directly: cost( C (cid:63) ) (cid:46) 1 NN (cid:88) n =1 (cid:24) log |  | 1 p  ( w n ) (cid:25) (15) where (cid:100)(cid:101) is the ceiling operation. As mentioned in  2, we use Morfessor (Smit et al., 2014) to tokenize our corpus into morphological units. Morfessor is a method for finding morphological segmentations from raw text data. As an unsupervised model, Morfessor is inherently noisy, but we take it as a proxy for a language's morphological segmentation. To compare the robustness of our results across different unsupervised segmentation algorithms, though, we also run our experiments using byte pair encoding (BPE; Gage, 1994; Sennrich et al., 2016) and WordPieces (Schuster and Nakajima, 2012). We train Morfessor on all pre-tokenized sentences in our language-specific Wikipedia corpus (described in  5.4). With this pre-trained model in hand, we tokenize all words in our training, development and test sets. We get a set of morpheme tokens { u n,j } J n j =1 for each word w n , where this word is split into J n morphological units. We can now get the optimal length of a morphologically constrained code. With this in mind, we first train a fresh version of our two-stage model on the full set of morphological unit tokensi.e. { u n,j | n  N, j  J n } , as opposed to the set of full word tokens, { w n } Nn =1 . We estimate the length of this code with the following equation: cost( C morph ) = (cid:88) m M p ( m ) (cid:12)(cid:12) C morph ( m ) (cid:12)(cid:12) (16) (cid:46) 1 NN (cid:88) n =1 J n (cid:88) j =1 (cid:24) log |  | 1 p  ( u n,j ) (cid:25) Note that this cost estimate is still the average code-length per word token, as such we take the expectation over the meanings distribution. Each word's code-length, though, is now defined as the sum of the length of each of its constituent morphemes. The second linguistic constraint we would like to impose on our codes is graphotactic well-formednessi.e. we wish our code to be composed only by sequences of characters that comply with the regularities observed in the language, such as e.g. vowel harmony, syllable structure, or word-initial and word-final constraints. We use our generator LSTM for this. As mentioned before, this model is trained on wordforms with dampened frequencieswe thus expect it to learn a language's graphotactic patterns above a minimum quality threshold. We use this character-level model to sample (without replacement) as many unique wordforms as there are word types in that language (see Tab. 3 in App. A). 11 We assign each of these sampled wordforms w (cid:48) n , ordered by word length, to one of the languages meanings m n , inversely ordered by unigram probability, i.e. C graph ( m n ) = w (cid:48) n thus generating an optimally Zipfian frequencylength correlation. With these assignments, we estimate the cost of a graphotactically constrained code: cost( C graph )  1 NN (cid:88) n =1 | w (cid:48) n | (17) Analogously, with the generator trained on morpheme units we get an optimal code under both morphological and graphotactic constraints. We use Wikipedia data in our experiments. The data is preprocessed by first splitting it into sentences and then into tokens using SpaCy's language-specific sentencizer and tokenizer (Hon-nibal et al., 2020). After this, all punctuation is removed and the words are lower-cased. We subsample (without replacement) one million sentences of each language for our experiments, due to computational constraints. We then use an 80-10-10 split for our training, validation and test sets. We choose typologically diverse languages for our experiments, each from a different language family: English, Finnish, Hebrew, Indonesian, Tamil, Turkish and Yoruba. 12 These languages vary in their graphotactic tendencies and morphological 11 Unfortunately, our LSTMs use a softmax non-linearity to assign probabilities and, as such, can't produce zeros. Furthermore, due to the compositional nature of wordform probabilities (see eq. (8)), short implausible forms may have larger probability mass than long plausible ones. To mitigate this effect, when sampling wordforms we impose a minimum threshold of 0 . 01 on each transition probability p ( (cid:96) t | (cid:96) <t ) . 12 Dataset statistics are presented in App. A. Figure 3: Bar plots of the code lengths under different constraints. complexity. In order to improve our data quality, we hand-defined an alphabet for each language and filter sentences with them, only considering sentences consisting exclusively of valid characters. 13 5.5 Summary In this paper we consider the following codes: Optimal. An information-theoretically optimal code under our two-stage model, estimated as defined by eq. (15). This is our most compressed code and does not include either morphlogical or graphotactic contraints. Morph. A morphologically constrained code, as defined by eq. (16). Graph. A code constrained by graphotactics, as defined by eq. (17). Morph+Graph. A code constrained by both morphology and graphotactics; defined by eq. (18). Natural. The natural codeequivalent to the average token length and defined by eq. (13). This is the code length actually observed in our corpora. Zipfian. A code estimated by re-pairing wordforms with meanings based on their frequencies; we then compute eq. (13) in this new code. This would be equivalent to the natural code length if lexicons had a perfect word lengthfrequency correlation (i.e., a Spearman's rank correlation of 1). Shuffle. A code estimated by randomly repairing wordforms with meanings and computing eq. (13) in this new code. This would be equivalent to the natural code length if Zipf's law of abbreviation did not exist, i.e. lexicons had no word lengthfrequency correlation. The average length for each considered code is presented in Fig. 3 and Tab. 1. As expected, we find that the average code length across natural languages is shorter than the shuffle condition and longer than the optimal condition. Interestingly, the codes produced by the other conditions investigated here also have the same identical order across all analyzed languages. Adding morphological constraints on the code incurs no more than one extra character over the optimal conditionexcept for Finnish, for which the cost of morphology is slightly above one character. Notably, the use of unsupervised morphological segmentation may introduce some noise into our measurements. Consistently with our expectations, though, Yoruba (a morphologically poor language) pays the smallest cost for its morphology, while Finnish (a morphologically rich one) pays the largest. BPE and WordPiece systematically produce shorter codes than Morfessor. This is sensible, since the first two would keep most frequent wordforms intact, generating a unique code for each of them. This would lead to codes in which the morphological productivity of frequent and infrequent words differ, amplifying frequency effects encountered in natural languages (Lieberman et al., 2007). The graphotactic condition yields systematically longer codes than the morphological one, although here there are important differences between languages: English, Hebrew and Indonesian have similar code lengths for both code constraints; in the other languages the graphotactic code is substantially longer than the morphological one. In all cases, the natural code is longer than the one with both graphotactic and morphological constraintssuggesting languages are not opti-Morph Morph + Graph Language Optimal Morfessor BPE WordPieces Graph Morfessor BPE WordPieces Zipfian Natural Shuffle English 3.09 3.82 3.34 3.31 4.39 5.34 4.67 4.70 3.93 6.11 8.91 Finnish 3.89 5.13 4.94 4.95 7.37 7.55 7.60 7.65 6.59 8.72 10.97 Hebrew 3.52 4.38 3.98 3.99 4.82 5.19 4.95 4.88 4.50 5.79 6.97 Indonesian 3.31 4.08 3.67 3.66 4.63 5.08 5.02 4.95 4.25 7.06 8.30 Tamil 3.38 4.15 4.07 4.01 7.52 8.01 8.16 8.22 6.41 9.21 11.48 Turkish 3.52 4.28 4.12 4.03 5.67 6.31 5.98 5.93 5.31 7.52 9.09 Yoruba 2.84 3.18 3.00 2.97 4.63 4.85 4.69 4.61 4.24 5.34 7.10 Table 1: The average code lengths under the different coding schemes. mally compressed, even when accounting for these constraints. That said, all of the natural languages are considerably more compressed than a lexicon produced by randomly reassigning wordforms. In this paper, we introduced a model-based strategy to assess the relative contribution of different constraints on word (code) length at large. In particular, we evaluated how much natural languages differ from systems optimized for Zipf's law of abbreviation. Our proposed model improves upon an old method used to consider the efficiency of the lexicon: random typing models (Miller, 1957; Moscoso del Prado, 2013; Ferrer-i-Cancho et al., 2020). Miller introduced the idea of monkeys typing randomly on a keyboard and analyzed the properties of its resulting language. The monkeys' text, however, has no morphological or graphotactic constraints (but see Caplan et al., 2020) and does not follow a language's unigram distribution (Howes, 1968). As such, it cannot directly encode the same meanings or messages as the original language. Our results show that, while natural languages do tend to map frequent messages to shorter words, the magnitude of this effect varies widely across our set of diverse languages. Notably, the distance between natural languages and the optimal codes is Figure 5: Fraction of code length accounted for by the combined morphology and graphotactics model larger than the distance between natural languages and their corresponding shuffled code (see Fig. 4). In other words, natural codes are closer to not being optimized (in the Zipfian sense) than to being maximally compressed. That said, our morphological and graphotactic baselines, when combined, yield codes that display mean code lengths that are (in most cases) closer to the natural code than to the optimal (see Fig. 5). If our models are indeed able to capture the true patterns in our data, then this means that (composi-tional) morphology and graphotactics, along with the law of abbreviation, are sufficient to account for most of the length of natural codesas observed in real languages. Graphotactic (primarily) and morphological constraints are enough to derive a code with a similar complexity to that of natural languages, which suggests the other factors discussed above (associated with, e.g., surprisal and non-arbitrary form-meaning mappings) likely play a more modest role in pushing natural languages away from the optimal Zipfian code. The optimality of the lexicon occupies a major place in the scientific study of the structure and functional evolution of languages (Bentz and Ferrer-i-Cancho, 2016; Gibson et al., 2019; Mahowald et al., 2020). We hope that the method presented herewhich allows for a more precise quantification of the (non-)optimality of lexicons will be used to further the goal of understanding why languages are structured in the ways that they are, while offering insight into the functional tradeoffs that underlie language variation and change. This paper concerns itself with investigating lexi-cons' optimality under the perspective of Zipf's Law of Abbreviation. As we focus on computational linguistic experiments, we see no clear ethical concerns here. Nonetheless, we note that Wikipedia (from where we collect data) is not a fully representative source of a language's data the biases in the data will likely also be present in our results. Damian E. Blasi acknowledges funding from the Branco Weiss Fellowship, administered by the ETH Zurich. Damian E. Blasi's research was also executed within the framework of the HSE University Basic Research Program and funded by the Russian Academic Excellence Project 5-100'.
abstain abstain abstain objective objective result abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain method objective method abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain method abstain abstain abstain abstain abstain abstain method abstain abstain method method abstain method abstain abstain abstain method abstain abstain abstain abstain method abstain abstain abstain abstain abstain abstain method method method abstain method method abstain other abstain abstain method method method method abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain method method abstain abstain abstain abstain abstain method abstain abstain abstain abstain method abstain method method method abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain other abstain abstain abstain abstain abstain abstain abstain other abstain abstain method abstain abstain method abstain abstain method abstain abstain method abstain other abstain abstain abstain abstain abstain method method abstain method abstain method abstain method method method abstain abstain method abstain abstain abstain method abstain abstain method method method abstain abstain abstain method method method abstain abstain method abstain abstain abstain abstain abstain method method abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain method abstain abstain abstain abstain abstain abstain abstain result abstain abstain abstain abstain abstain abstain abstain abstain other abstain abstain objective objective abstain abstain abstain abstain result abstain abstain result result abstain abstain objective abstain abstain abstain other other