<<

Capturing Regional Variation with Distributed Place Representations and Geographic Retrofitting

Dirk Hovy Christoph Purschke Bocconi University University of [email protected] [email protected]

Abstract 2017a,b) and help personalize applications and search. are one of the main drivers of lan- However, regional variation involves a com- guage variation, a major challenge for natural plex set of grammatical, lexical, and phonologi- language processing tools. In most languages, cal features, all of them continuously changing. dialects exist along a continuum, and are com- monly discretized by combining the extent of Consequently, dialects are not static discrete en- several preselected linguistic variables. How- tities, but exist along a continuum in most lan- ever, the selection of these variables is theory- guages. Variational and dialectology driven and itself insensitive to change. We use typically discretize this continuum by using a set Doc2Vec on a corpus of 16.8M anonymous of preselected features (Trudgill, 2000), often in- online posts in the German-speaking area to cluding outdated vocabulary. The resulting di- learn continuous document representations of alect areas are highly accurate, but extremely time- cities. These representations capture contin- uous regional linguistic distinctions, and can consuming to construct and inflexible (the largest serve as input to downstream NLP tasks sen- and to date most comprehensive evaluation of Ger- sitive to regional variation. By incorporating man dialects, the Wenker-Atlas (Rabanus et al., geographic information via retrofitting and ag- 2010) is almost 150 years old and took decades to glomerative clustering with structure, we re- complete). Work in dialectometry has shown that cover areas at various levels of gran- computational methods, such as clustering (Ner- ularity. Evaluating these clusters against an bonne and Heeringa, 1997; Prokic´ and Nerbonne, existing dialect map, we achieve a match of 2008; Szmrecsanyi, 2008, inter alia) and dimen- up to 0.77 V-score (harmonic mean of clus- ter completeness and homogeneity). Our re- sionality reduction (Nerbonne et al., 1999; Shack- sults show that representation learning with leton Jr, 2005) can instead be used to identify di- retrofitting offers a robust general method to mensions of variation in manually constructed dis- automatically expose dialectal differences and crete feature vectors. However, the success of such regional variation at a finer granularity than approaches depends on precise prior knowledge of was previously possible. variation features (Lameli, 2013). Distributed representations, as unsupervised 1 Introduction methods, can complement these methods by cap- People actively use dialects to mark their re- turing similarities between words and documents gional origin (Shoemark et al., 2017a,b), making (here: cities) along various latent dimensions, in- them one of the main drivers of language varia- cluding syntactic, semantic, and pragmatic as- tion. Accounting for this variation is a challenge pects. These representations are therefore more for NLP systems (see for example the failed at- compact, less susceptible to data sparsity than la- tempts of people with accents trying to use dia- tent variable models, and allow us to represent logue systems. Accounting for variation can sig- a large number of possible clusters than feature- nificantly improve performance in machine trans- based representations (cf. Luong et al.(2013)). lation (Mirkin and Meunier, 2015; Östling and These properties also allow us to measure similar- Tiedemann, 2017), geolocation (Rahimi et al., ities on a continuous scale, which makes represen-

4383 Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 4383–4394 Brussels, , October 31 - November 4, 2018. c 2018 Association for Computational Linguistics tation learning especially useful for the study of Contributions In this paper, we make the fol- regional language variation along several linguis- lowing contributions to linguistic insights, perfor- tic dimensions. mance improvements, and algorithmic contribu- We use a corpus of 16.8 million anonymous tions. We show: German online posts, cast cities as document la- bels, and induce document embeddings for these 1. how Doc2Vec can be used to learn distributed cities via Doc2Vec (Le and Mikolov, 2014). We representations of cities that capture contin- first show that the resulting city embeddings cap- uous regional linguistic variation. The ap- ture regional linguistic variation at a more fine- proach is general and can be applied to other grained, continuous regional distinction than pre- languages and data sets; vious approaches (Bamman et al., 2014; Östling 2. that the city representations capture enough and Tiedemann, 2017), which operated at a state distinction to produce competitive results in 1 or language level. We also show that the embed- geolocation, even this was not the main fo- dings can serve as input to a geolocation task, out- cus; performing a bag-of-words model, and producing competitive results. 3. that retrofitting can be used to incorporate However, such representations are susceptible geographic information into the embeddings, to linguistic data bias, ignore geographic factors, extending the original algorithm’s applica- and are hard to evaluate with respect to their fit tions; with existing linguistic distinctions. We address 4. that the clusterings match with a sociolin- these problems by including geographic informa- guistic dialect map (Lameli, 2013), measur- tion via retrofitting (Faruqui et al., 2015; Hovy ing their homogeneity, completeness, and and Fornaciari, 2018): we use administrative re- their harmonic mean (V-measure), and reach gion boundaries to modify the city embeddings, a V-measure of 0.77, beating an informed and evaluate the resulting vectors in a clustering baseline; approach to discover larger dialect regions. In contrast to most dialectometric approaches We publicly release the data, code, and map files (Nerbonne et al., 1999; Prokic´ and Nerbonne, for future research at https://github.com/Bocconi- 2008), and in line with common NLP practice NLPLab. (Doyle, 2014; Grieve, 2016; Huang et al., 2016; 2 Data Rahimi et al., 2017a), we also evaluate the clus- tered dialect areas quantitatively. Rather than 2.1 Source testing the geographic extent of individual words We use data from the social media app Jodel,2 against known dialect areas (Doyle, 2014), we a mobile chat application that lets people anony- compare the match of entire geographic regions to mously talk to other users within a 10km-radius a recent German dialect map (Lameli, 2013). We around them. The app was first published in 2014, use cluster evaluation metrics to measure how well and has seen substantial growth since its begin- our clusters match the known dialect regions. ning. It has several million users in the German- The results show that our method automatically speaking area (GSA), and is expanding to , captures existing (manually determined) dialect Italy, , , and lately the United distinctions well, and even goes beyond them in States. Users can post and answer to posts within that it also allows for a more fine-grained qual- the radius around their own current location. All itative analysis. Our research shows that repre- users are anonymous. Answers to an initial post sentation learning is well suited to the study of are organized in threads. The vast majority of language variation, and demonstrates the poten- posts in Jodel are written in , but tial of incorporating non-linguistic information via since it is conceptually spoken langauge (Koch retrofitting. For an application of our methodol- and Oesterreicher, 1985; Eisenstein, 2013), re- ogy to a larger Twitter data set over multiple lan- gional and dialectal forms are common, especially guages, see (Hovy et al., In Preparation). in , , and rural areas in South- ern . The data therefore reflects current 1Han et al.(2014) has used city-level representations, but have not applied them to the identification of dialect areas. 2https://jodel.com/

4384 developments in language dynamics to mark re- ter representations. While both POS-tagging and gionality (Purschke, 2018). NER can introduce noise, they are more flexible We used a publicly available API to collect and exhaustive than pre-defined word lists.6 Fi- data between April and June 2017 from 123 ini- nally, we concatenate collocations based on the tial locations: 79 German cities with a popula- PMI of the adjacent words in the cleaned corpus. tion over 100k people, all 17 major cities in Aus- The average instance length is about 40 words af- tria (“Mittel- und Oberzentren”), and 27 cities in ter cleaning. Switzerland (the 26 cantonal capitals plus Lugano 2.3 Data Statement in the very south of the Italian-speaking area). Due to the 10km radius, posts from other nearby cities The corpus was selected to represent informal, ev- get collected as well. We include these additional eryday online speech across the German-speaking cities if they have more than 200 threads, thereby area in Europe, and to capture regional distinc- growing the total number of locations.3 Ulti- tions. The data was acquired via the publicly avail- mately, this results in 408 cities (333 in Germany, able API. The language is mainly standard Ger- 27 in Austria, 48 in Switzerland). The resulting lo- man, but with a substantial amount of dialectal en- cations are spread relatively evenly across the en- tries, mainly from southern German varieties, as tire GSA, albeit with some gaps in parts of Ger- well as some French and Italian, which could not many with low population density. In total, we be removed without losing dialect. The platform is collect 2.3 million threads, or 16.8 million posts. anonymous, but mainly used by young people, as We treat each thread as a document in our rep- indicated by a prevalence of college-related topics. resentation learning setup, labeled with the name It contains spontaneous, written, asynchronous in- of the city in which the thread took place. teractions in a chat platform organized by threads. Anonymous reference to prior interlocutors is pos- 2.2 Preprocessing sible. The app is mainly used to discuss everyday We preprocess the data to minimize vocabulary topics, entertainment, flirting, venting, and infor- size, while maintaining regional discriminative mal surveys. power. We lowercase the input and restrict our- 3 Methodology selves to content words, based on the part-of- speech (nouns, verbs, adjectives, adverbs, and 3.1 Representation Learning proper names), using the spacy4 tagger. Prior studies showed that many regionally- distributed content words are topically driven (Eisenstein et al., 2010; Salehi et al., 2017). Peo- ple talk more about their own region than about others, so the most indicative words include place names (the own city, or specific places within that city), and other local culture terms, such as sports teams. We try to minimize the effect of such re- gional topics, by excluding all named entities, as well as the names of all cities in our list, to instead focus on dialectal lexical variation. We use NLTK5 to remove German stop words, Figure 1: Doc2vec model example for window size 4. and to lemmatize the words. While this step re- moves the inflectional patterns found in German, To learn both word and city representations, which could have regional differences, we fo- we use the Doc2Vec implementation of para- cus here on lexical differences, and lemmatization 6Note that stopwords and place names are more reliably greatly reduces vocabulary size, leading to bet- detected in their standard form than in regional variants of abbreviations, meaning the standard forms are more reliably 3 The number of threads differs widely even between excluded if posts are written in High German, than if posts cities, ranging from dozens to over 40k in cities like Munich, are written in dialect. This may lead to higher coherence for Vienna, or Berlin. regions with a higher amount of non-standard tokens (as in 4https://spacy.io/ Switzerland), thereby actually supporting our goal of detect- 5http://www.nltk.org/ ing regional variation.

4385 graph2vec (Le and Mikolov, 2014) in gensim.7 The model is conceptually similar to word2vec (Mikolov et al., 2013), but also learns document label representations (in our case city names), em- bedded in the same space as the words. We use distributed bag-of-words (DBOW) training. The model parameters are fitted by predicting ran- domly sampled context words from a city vector. The objective is to maximize the log probability of the prediction,

N X y = arg max log log(p(wi|k)) W i=1 where k is a city, and W = wi...N a sequence of N randomly sampled words from the thread (see Figure1 for a schematic representation). During training, semantically similar words end up closer together in vector space, as do words “similar” to a particular city, and cities that are lin- guistically similar to each other. Due to the nature of our task, we unfortunately Figure 2: Gradient color map of first three components of city embeddings, interpreted as RGB, for all cities do not have gold data (i.e., verified cluster labels) above 200 threads. Color reflects linguistic similarity. to tune parameters.We therefore follow the set- tings described in (Lau and Baldwin, 2016) for the parameters, and set the vector dimensions to 300, into medium gray. This transformation translates window size to 15, minimum frequency to 10, neg- city representations into color values that preserve ative samples to 5, downsampling to 0.00001, and linguistic similarities. Similar hues correspond to run for 10 iterations. similar representations, and therefore, by exten- 3.2 Visualization sion, linguistic similarity. In order to examine whether the city embeddings NMF tries to find a decomposition of a given capture the continuous nature of dialects, we visu- i-by-k matrix W into d components by a i-by-d alize them. If our assumption holds, we expect to row-representation V and a d-by-k column repre- see gradual continuous change between cities and sentation H. In our case, d = 3. Since we are only regions. interested in a reduced representation of the cities, We use non-negative matrix factorization V , we discard H. (NMF) on the 300-dimensional city representation The result is indeed a continuous color gradi- matrix to find the first three principal components, ent over the cities over 200 threads, see Figure2. normalize them each to values 0.0–1.0 and inter- The circle size for every city indicates the relative pret those as RGB values.8 I.e., we assume the number of threads per location. first principal component signals the amount of In order to get reliable statistics, we restrict our- red, the second component the amount of green, selves to cities with more than 200 observed con- and the third component the amount of blue. This versations (about 2.1M conversations: 1.82M in triple can be translated into a single color value. Germany, 173k in Austria, and 146k in Switzer- E.g., 0.5 red, 0.5 green, and 0.5 blue translates land). Including cities with fewer conversations adds more data points, but induces noise, as many 7https://radimrehurek.com/gensim/ models/doc2vec.html of those representations are based on too little 8Note that instead learning 3-dimensional embeddings data, resulting in inaccurate vectors. would not amount to the same, as those are likely not equiv- Even without in-depth linguistic analysis, we alent of the three first principal components, and thus not as useful. 300 dimensions capture other degrees of variation, in- can already see differences between Switzerland creasing the chance to capture meaningful latent dimensions. (green color tones) and the rest of the GSA. Within

4386 Figure 3: Clustering solutions of retrofit city embeddings for entire GSA with 3, 5, and 8 clusters. Colors denote clusters, assigned randomly.

Switzerland, we see a distinction between the Ger- Since the city representations are indirectly man (lighter green) and the French-speaking area based on the words used in the respective cities, around Lausanne and Geneva (darker tones). On the clustering essentially captures regional simi- the other hand, we find a continuous transition larity in vocabulary. If the clusters we find in our from red over purple to bluish colors in Ger- data match existing dialect distinctions, this pro- many and Austria. These gradients largely cor- vides a compelling argument for the applicability respond to the dimensions North→South(East): of our methodology. red→blue and West→East: intense tones →pale 3.4 Including geographic knowledge tones. These dimensions mirror the well-known strong linguistic connection between the southeast While we capture regional variation by means of of Germany and Austria, and between most cities linguistic similarities here, it does include a geo- in the north of Germany. graphic component as well. The embeddings we learn do not include this component, though. This 3.3 Clustering can produce undesirable clustering results. Large The visualization in the last section already sug- cities, due to their “melting-pot” function, often gests that we capture the German dialect contin- use similar language, so their representations are uum, and the existence of larger dialect areas. close in embedding space. This is an example However, in order to evaluate against existing di- of Galton’s problem (Naroll, 1961): Munich and alect maps, we need to discretize the continuous Berlin are not linguistically similar because they representation. We use hierarchical agglomerative belong to the same dialect, but due to some out- clustering (Ward Jr, 1963) with Ward linkage, Eu- side factor (in this case, shared vocabulary through clidean affinity, and structure to discover dialect migration). areas. We compare the agglomerative clustering To address geography, we experiment with results to a k-means approach. two measures: clustering with structure, and Agglomerative clustering starts with each city retrofitting (Faruqui et al., 2015; Hovy and For- in its own cluster, and recursively merges pairs naciari, 2018). into larger clusters, until we have reached the re- Structure To introduce geographic structure quired number. Pairs are chosen to minimize the into clustering, we use a connectivity matrix over increase in linkage distance (for Ward linkage, this the inverse distance between cities (i.e., geograph- measure is the new cluster’s variance). We use ically close cities have a higher number), which is cities with 50–199 threads (66 cities) to tune the used as weight during the merging. This weight clustering parameters (linkage function and affin- makes close geographic neighbors more likely to ity), and report results obtained on cities with more be merged before distant cities are. than 200 threads. Note, though, that this geographic component

4387 does not predetermine the clustering outcome: ge- ographically close cities that are linguistically dif- ferent still end up in separate clusters, as we will see. The Spearman ρ correlation between the geo- graphic distance and the cosine-similarity of cities is positive, but does not fully explain the simi- larities (Austria 0.40, Germany 0.42, Switzerland 0.72). The stronger correlation for Switzerland suggests a localized effect of regional varieties. Geographic structure in clustering does, however, provide speedups, regional stability, and more sta- ble clustering solutions than unstructured cluster- ing. We will see this in comparison to k-means. Retrofitting Faruqui et al.(2015) introduced retrofitting of vectors based on external knowl- edge. We take the idea proposed for word vec- tors and semantic resources and extend it follow- ing Hovy and Fornaciari(2018) to apply it to city representations and membership in geographic re- Figure 4: German dialect Regions after Lameli(2013). gions. We construct a set Ω with tuples of cities Shaded areas denote dialect overlap. (ci, cj) such that there exists a region R where ci ∈ R and cj ∈ R. We use the NUTS2 regions 2-cluster solution separates Switzerland vs. ev- (Nomenclature of Territorial Units for Statistics, a erything else), and further clusters first separate EuroStats geocoding standard) to determine R. In out more southern German varieties before dis- Germany, NUTS2 has 39 regions, corresponding tinguishing the northern varieties. This is in line to government regions. with sociolinguistic findings (Plewnia and Rothe, To include the geographic knowledge, we 2012) about ubiquity of dialect use (more common retrofit the existing city embeddings C. The goal in the south, therefore more varied regions, re- is to make the representations of cities that are in flected in our clustering). Due to space constraints, the same region more similar to each other than we have to omit further clustering stages, but find to cities in other regions, resulting in a retrofit em- linguistically plausible solutions beyond the ones beddings matrix Cˆ. For a retrofit city vector cˆi, the shown here. For an in-depth qualitative analysis update equation is of the different clustering solutions and the socio- P cˆj demographic and linguistic factors, see Purschke cˆ = αc + β j:(i,j)∈Ω i i N and Hovy(In Preparation). where cˆi is the original city vector, and α and β Dialect match We use the map of German di- are tradeoff parameters to control the influence alects and their regions by Lameli(2013) (see Fig- of the geographic vs. the linguistic information. ure4) and its 14 large-scale areas 9 as gold stan- See Faruqui et al.(2015) and Hovy and Fornaciari dard to measure how well the various clustering- (2018) for more details. solutions correspond to the dialect boundaries. 4 Evaluation This map is based on empirical quantitative analy- sis of German dialects, albeit based on data from In order to evaluate our methodology, we measure the 19th century, and therefore naturally on differ- both its ability to match German dialect distinc- ent domains and media than our study. tions, and the performance of the learned embed- Note that we can only assess the cities within dings in a downstream geolocation task. modern-day Germany (clusters formed in Austria Figure3 provides examples of different cluster- or Switzerland are not covered). We therefore re- ing solutions after retrofitting. Note that colors run the clusterings on the subset of German cities, are assigned randomly and do not correspond to so results differ slightly from the clusters induced the linguistic similarity from Figure2. Switzer- land immediately forms a separate cluster (the 9Some areas partially overlap with each other.

4388 ORIGINAL RETROFIT K-MEANS AGGLOMERATIVE K-MEANS AGGLOMERATIVE # V-score H C V-score H C V-score H C V-score H C 2 0.41 0.27 0.89 0.41 0.27 0.83 0.43 0.28 0.94 0.44 0.28 0.95 3 0.53 0.39 0.84 0.46 0.33 0.73 0.57 0.42 0.87 0.54 0.40 0.85 4 0.61 0.49 0.80 0.59 0.48 0.76 0.66 0.53 0.86 0.68 0.56 0.88 5 0.61 0.50 0.79 0.63 0.54 0.74 0.69 0.59 0.83 0.71 0.62 0.84 6 0.65 0.56 0.76 0.64 0.58 0.72 0.72 0.64 0.82 0.72 0.64 0.82 7 0.64 0.57 0.74 0.66 0.61 0.72 0.72 0.65 0.80 0.69 0.64 0.76 8 0.62 0.56 0.70 0.66 0.61 0.71 0.70 0.67 0.74 0.73 0.70 0.76 9 0.70 0.65 0.76 0.70 0.68 0.72 0.70 0.67 0.73 0.73 0.70 0.75 10 0.68 0.66 0.70 0.70 0.68 0.72 0.71 0.70 0.72 0.74 0.72 0.75 11 0.69 0.67 0.71 0.72 0.71 0.72 0.74 0.75 0.74 0.74 0.74 0.74 12 0.66 0.65 0.67 0.70 0.72 0.68 0.71 0.72 0.69 0.75 0.78 0.72 13 0.67 0.68 0.66 0.70 0.73 0.67 0.73 0.75 0.71 0.74 0.78 0.70 14 0.67 0.68 0.66 0.69 0.73 0.65 0.71 0.76 0.66 0.74 0.79 0.70 15 0.66 0.68 0.64 0.71 0.77 0.66 0.74 0.80 0.70 0.76 0.82 0.70 16 0.67 0.71 0.64 0.71 0.78 0.66 0.73 0.80 0.67 0.77 0.85 0.71 17 0.67 0.70 0.63 0.70 0.78 0.64 0.73 0.81 0.67 0.76 0.85 0.68 18 0.65 0.68 0.62 0.70 0.78 0.64 0.74 0.83 0.66 0.75 0.85 0.66 19 0.64 0.68 0.59 0.70 0.79 0.63 0.72 0.82 0.64 0.75 0.87 0.67 20 0.65 0.71 0.59 0.69 0.80 0.61 0.74 0.85 0.66 0.75 0.87 0.66

Table 1: Evaluation of the fit of various cluster solutions against the reference dialect map Lameli(2013). k-means results averaged over 5 runs. Agglomerative clustering with structure. Retrofitting on NUTS2 regions. Baseline: 0.74 V-score, 0.93 homogeneity, 0.62 completeness. on the entire GSA. then collect threads with at least 100 words from We report homogeneity (whether a cluster con- these cities for each country (11,240 threads from tains only data points from a single region) and Austria, 137,081 from Germany, and 18,590 from completeness (how many data points of a NUTS Switzerland). Each thread is a training instance, region are in the same cluster), as well as their har- i.e., we have 166,911 instances. We use the monic mean, the V-score. This corresponds to pre- Doc2Vec model from before to induce a document cision/recall/F1 scores used in classification. Note representation for each instance and use the vector that we will not be able to faithfully reconstruct as input to a logistic regression model that predicts Lameli’s distinctions, since Lameli’s map contains the city name. overlapping regions, whose data points therefore For testing, we sample 5,000 threads from the already violate perfect homogeneity. same cities (maintaining the same proportional The outline of dialect regions in Lameli’s map distribution and word count constraint), but from is based on the NUTS2 regions, so we compare all a separate data set, collected two months after the clustering solutions to an informed baseline that original sample. We again use the Doc2Vec model assigns each city the NUTS2 region it is located in. to induce representations, and evaluate the classi- Except for regions in dialect overlaps, each NUTS fier on this data. region is completely contained in one dialect re- We measure accuracy, accuracy at 161km (100 gion, so the baseline can achieve almost perfect miles), and the median distance between pre- homogeneity. diction and target. We compare the model Downstream task geolocation For the geoloca- with Doc2Vec representations to a bag-of-words tion task, we randomly select 100 cities with at (BOW) model with the same parameters. Since least 200 threads from each country (7 in Aus- the representation here is based on words, we can tria, 82 in Germany, 11 in Switzerland). We not apply retrofitting. As baseline, we report the

4389 most-frequent city prediction. distance around 100km, and an accuracy@161 of 5 Results 0.54, see cf. Rahimi et al.(2017b)) and decidedly outperform the BOW model and most-frequent- Dialect match Table1 shows the results of clus- city baseline on all measures. tering solutions up to 20 clusters for both retrofit and original embeddings. Irrespective of the clus- 6 Analysis tering approach, retrofit representations perform markedly better. Homogeneity increases substantially the more clusters we induce (in the limit, each data point be- comes a single cluster, resulting in perfect homo- geneity), whereas completeness decreases slightly with more clusters (they increase the likelihood that a region is split up into several clusters). We achieve the best V-score, 0.77, with 16 clusters. Averaged k-means (over 5 runs) is much less consistent, due to random initialization, but pre- sumably also because it cannot incorporate the ge- ographic information. For few clusters, its perfor- mance is better than agglomerative clustering, but Figure 5: Visualization of city representation for Wien as the number of clusters increases (and the ge- (Vienna) and its 10 nearest word neighbors in two di- ographic distribution of the cities becomes more mensions. The closest seven words are all Austrian di- intricate), k-means stops improving. alect words The baseline achieves almost perfect homo- geneity, as expected (the only outliers are NUTS Because both words and cities are represented regions in overlap areas). Completeness is lower in the same embeddings space (at least before than almost all clustering solutions, though. The retrofitting), we can compare the vectors of cities V-score, 0.74, is therefore lower than the best clus- to each other (asking: which cities are linguisti- tering solution. cally most similar to each other, which is what Both the cluster evaluation metrics and the vi- we have done above) and words to cities (asking: sual correspondence suggest that our method cap- which words are most similar to/indicative of a tures regional variation at a lexical level well. city). The latter allows us to get a qualitative sense of how descriptive the words are for each city. Figure5 shows an example of word and city MODEL ↑ACC ↑ACC@161 ↓MED.DIST. similarity for the city representation of Vienna. baseline 0.03 0.31 269.33 We can also use the cluster centroid of several BOW 0.21 0.50 156.17 city vectors to represent entire regions. The new D2V 0.26 0.52 145.16 vector no longer represents a real location, but is akin to the theoretic linguistic center of a dialect Table 2: Geolocation performance for city embed- region. We can then find the most similar words dings and bag-of-word vectors on held-out data set. to this centroid. For the solution with 3 clusters Baseline predicts most frequent city from training data. (cf. Figure3), we get the solutions in Table3. As expected, the regional prototypes do not overlap, Downstream Evaluation: Geolocation Table but feature dialectal expressions in the south, and 2 shows the results of the geolocation down- general standard German expressions in the north. stream task. Despite the fact that the representa- Again, for an in-depth qualitative analysis and tion learning setup was not designed for this task discussion of the socio-linguistic correlations, see and excluded all the most informative words for Purschke and Hovy(In Preparation). it (Salehi et al., 2017), the induced embeddings capture enough pertinent regional differences to 7 Related Work achieve reasonable performance (albeit slightly Dialectometric studies, exploring quantitative sta- below state of the art, which typically has a median tistical models for regional variation, range from

4390 CLUSTER PROTOTYPES TRANSLATION Switzerland esch, ond, vell, gaht, wüki, nöd, is, and, many, goes, really, not, besch, emmer, nor, au nöd (you) are, always, just, also not ja gut, erstmal, sieht, drauf, well yes, first, sees, onto, maybe, vielleicht, mehr, gut, sehen, more, good, see, already, idea schonmal, Ahnung Southern Germany & Austria afoch, voi, nd, i a, oda, möppes, easy, full, and, me too, or, girl nimma, is a, mei, gscheid (SLANG), no more, is also, well, smart

Table 3: Prototypical words (10 nearest neighbors) for each of 3 clusters. work on dialect data in Dutch (Nerbonne and Rahimi et al.(2017a) and Rahimi et al.(2017b) Heeringa, 1997; Prokic´ and Nerbonne, 2008; have shown how neural models can exploit re- Wieling et al., 2011, inter alia) and British English gional lexical variation for geolocation, while (Szmrecsanyi, 2008), to Twitter-based approaches also enabling dialectological insights, whereas our for American dialect distinctions (Grieve et al., goals are exactly reversed. Östling and Tiedemann 2011; Huang et al., 2016) and the regional differ- (2017) have shown how distributed representa- entiation of African American Vernacular English tions of entire national languages capture typolog- (Jones, 2015). While these papers rely on existing ical similarities that improve translation quality. dialect maps for comparison, they rarely quantita- Most of these papers focus on downstream perfor- tively evaluate against them, as we do. mance that accounts for regional variation, rather Recently, NLP has seen increased interest in than on explicitly modeling variation. We include computational sociolinguistics (Nguyen et al., a downstream performance, but also evaluate the 2016). These works examine the correlation cluster composition quantitatively. of socio-economic attributes with linguistic fea- 8 Conclusion tures, including regional distribution of lexical and We use representation learning, structured clus- phonological differences (Eisenstein et al., 2010; tering, and geographic retrofitting on city embed- Doyle, 2014; Bamman et al., 2014), syntactic vari- dings to study regional linguistic variation in Ger- ation (Johannsen et al., 2015), diachronic variation man. Our approach captures gradual linguistic dif- (Danescu-Niculescu-Mizil et al., 2013; Kulkarni ferences, and matches an existing German dialect et al., 2015; Hamilton et al., 2016), and correla- map, achieving a V-score of 0.77. The learned tion with socio-demographic attributes (Eisenstein city embeddings also capture enough regional dis- et al., 2011; Eisenstein, 2015). Other have further tinction serve as input to a downstream geoloca- explored regional variation on social media, and tion task, outperforming a BOW baseline and pro- showed the prevalence of regional lexical variants ducing competitive results. Our findings indicate (Hovy et al., 2015; Hovy and Johannsen, 2016; that city embeddings capture regional linguistic Donoso and Sánchez, 2017). Several works in- variation, which can be further enriched with ge- clude quantitative comparisons to measure the em- ographic information via retrofitting. They also pirical fit of their findings (Peirsman et al., 2010; suggest that traditional ideas of regionality persist Han et al., 2014; Huang et al., 2016; Grieve, 2016; online. Our methodology is general enough to be Kulkarni et al., 2016), albeit not on entire existing applied to other languages that lack dialect maps dialect maps. (e.g., Switzerland), and to other tasks studying re- The use of representation learning is new and gional variation. We publicly release our data and relatively limited, especially given its prevalence code. in other areas of NLP. Bamman et al.(2014) have shown how regional meaning differences can be Acknowledgements learned from Twitter via distributed word repre- We would like to thank the anonymous reviewers sentations between US states, but not for individ- of this paper and Barbara Plank, who helped to ual cities. More recently, Kulkarni et al.(2016); strengthen and clarify our findings.

4391 References of the 54th Meeting of the Association for Compu- tational Linguistics David Bamman, Chris Dyer, and Noah A. Smith. 2014. , pages 1489–1501. Association Distributed Representations of Geographically Situ- for Computational Linguistics. ated Language. In Proceedings of the 52nd Annual Bo Han, Paul Cook, and Timothy Baldwin. 2014. Text- Meeting of the Association for Computational Lin- based Twitter user geolocation prediction. Journal guistics, pages 828–834. Proceedings of ACL. of Artificial Intelligence Research, 49:451–500. Cristian Danescu-Niculescu-Mizil, Robert West, Dan Dirk Hovy and Tommaso Fornaciari. 2018. Increas- Jurafsky, Jure Leskovec, and Christopher Potts. ing In-Class Similarity by Retrofitting Embeddings 2013. No country for old members: User lifecy- with Demographic Information. In Proceedings of cle and linguistic change in online communities. In the 2018 conference on Empirical Methods in Natu- Proceedings of the 22nd international conference on ral Language Processing. World Wide Web, pages 307–318. ACM.

Gonzalo Donoso and David Sánchez. 2017. Dialecto- Dirk Hovy and Anders Johannsen. 2016. Exploring metric analysis of language variation in Twitter. Var- Language Variation Across Europe–A Web-based Pro- Dial 2017, page 16. Tool for Computational Sociolinguistics. In ceedings of LREC. Gabriel Doyle. 2014. Mapping Dialectal Variation by Querying Social Media. In EACL, pages 98–106. Dirk Hovy, Anders Johannsen, and Anders Søgaard. 2015. User review-sites as a source for large-scale Jacob Eisenstein. 2013. What to do about bad language sociolinguistic studies. In Proceedings of WWW. on the Internet. In Proceedings of the 2013 confer- ence of the North American Chapter of the associa- Dirk Hovy, Afhsin Rahimi, Tim Baldwin, and Julian tion for computational linguistics: Human language Brooke. In Preparation. Visualizing Regional Lan- technologies, pages 359–369. guage Variation Across Europe on Twitter. In Stan- ley D. Brunn and Roland Kehrein, editors, Hand- Jacob Eisenstein. 2015. Systematic patterning book of the Changing World Language Map. Dor- in phonologically-motivated orthographic variation. drecht: Springer. Journal of Sociolinguistics, 19(2):161–188. Yuan Huang, Diansheng Guo, Alice Kasakoff, and Jack Jacob Eisenstein, Brendan O’Connor, Noah A Smith, Grieve. 2016. Understanding US regional linguistic and Eric P Xing. 2010. A latent variable model for variation with Twitter data analysis. Computers, En- geographic lexical variation. In Proceedings of the vironment and Urban Systems, 59:244–255. 2010 Conference on Empirical Methods in Natural Language Processing, pages 1277–1287. Associa- Anders Johannsen, Dirk Hovy, and Anders Søgaard. tion for Computational Linguistics. 2015. Cross-lingual syntactic variation over age and gender. In Proceedings of CoNLL. Jacob Eisenstein, Noah A Smith, and Eric P Xing. 2011. Discovering sociolinguistic associations with Taylor Jones. 2015. Toward a description of African structured sparsity. In Proceedings of the 49th An- American Vernacular English dialect regions using nual Meeting of the Association for Computational “Black Twitter”. American Speech, 90(4):403–440. Linguistics: Human Language Technologies-Volume 1, pages 1365–1374. Association for Computational Peter Koch and Wulf Oesterreicher. 1985. Sprache Linguistics. der Nähe-Sprache der Distanz. Mündlichkeit und Schriftlichkeit im Spannungsfeld von Sprachtheorie Manaal Faruqui, Jesse Dodge, Sujay Kumar Jauhar, und Sprachgeschichte. Romanistisches Jahrbuch, Chris Dyer, Eduard Hovy, and Noah A Smith. 2015. 36:15–43. Retrofitting Word Vectors to Semantic Lexicons. In Proceedings of the 2015 Conference of the North Vivek Kulkarni, Rami Al-Rfou, Bryan Perozzi, and American Chapter of the Association for Computa- Steven Skiena. 2015. Statistically significant de- tional Linguistics: Human Language Technologies, tection of linguistic change. In Proceedings of the pages 1606–1615. 24th International Conference on World Wide Web, pages 625–635. International World Wide Web Con- Jack Grieve. 2016. Regional variation in written Amer- ferences Steering Committee. ican English. Cambridge University Press. Vivek Kulkarni, Bryan Perozzi, and Steven Skiena. Jack Grieve, Dirk Speelman, and Dirk Geeraerts. 2011. 2016. Freshman or Fresher? Quantifying the Geo- A statistical method for the identification and ag- graphic Variation of Language in Online Social Me- gregation of regional linguistic variation. Language dia. In ICWSM, pages 615–618. Variation and Change, 23(2):193–221. Alfred Lameli. 2013. Strukturen im Sprachraum: William L Hamilton, Jure Leskovec, and Dan Jurafsky. Analysen zur arealtypologischen Komplexität der 2016. Diachronic Word Embeddings Reveal Sta- Dialekte in Deutschland, volume 54. Walter de tistical Laws of Semantic Change. In Proceedings Gruyter.

4392 Jey Han Lau and Timothy Baldwin. 2016. An Em- Jelena Prokic´ and John Nerbonne. 2008. Recognising pirical Evaluation of doc2vec with Practical Insights groups among dialects. International journal of hu- into Document Embedding Generation. page 78. manities and arts computing, 2(1-2):153–172. Quoc Le and Tomas Mikolov. 2014. Distributed repre- Christoph Purschke. 2018. Language regard and cul- sentations of sentences and documents. In Proceed- tural practice: Variation, evaluation, and change in ings of the 31st International Conference on Ma- the German regional languages. In Betsy Evans, Er- chine Learning (ICML-14), pages 1188–1196. ica Benson, and James Stanford, editors, Language regard: Methods, variation, and change, pages 245– Thang Luong, Richard Socher, and Christopher Man- 261. Cambridge University Press, Cambridge. ning. 2013. Better word representations with recur- sive neural networks for morphology. In Proceed- Christoph Purschke and Dirk Hovy. In Preparation. ings of the Seventeenth Conference on Computa- Lörres, Möppes, and the Swiss. (Re)Discovering tional Natural Language Learning, pages 104–113. Regional Patterns in Anonymous Social Media Data. Journal of Linguistic Geography. Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg S Cor- rado, and Jeff Dean. 2013. Distributed representa- Stefan Rabanus, Roland Kehrein, and Alfred Lameli. tions of words and phrases and their compositional- 2010. Creating digital editions of historical maps. ity. In Advances in neural information processing Language and space, 2:375–385. systems, pages 3111–3119. Afshin Rahimi, Timothy Baldwin, and Trevor Cohn. Shachar Mirkin and Jean-Luc Meunier. 2015. Person- 2017a. Continuous representation of location for alized machine translation: Predicting translational geolocation and lexical dialectology using mixture preferences. In Proceedings of the Conference on density networks. In Empirical Methods in Natu- Empirical Methods in Natural Language Processing ral Language Processing. Association for Computa- (EMNLP), Lisbon, . Association for Com- tional Linguistics. putational Linguistics. Afshin Rahimi, Trevor Cohn, and Timothy Baldwin. Raoul Naroll. 1961. Two solutions to Galton’s prob- 2017b. A neural model for user geolocation and lem. Philosophy of Science, 28(1):15–39. lexical dialectology. In Proceedings of the 55th Annual Meeting of the Association for Computa- John Nerbonne and Wilbert Heeringa. 1997. Measur- tional Linguistics and the 7th International Joint ing dialect distance phonetically. In Proceedings of Conference on Natural Language Processing of the the Third Meeting of the ACL Special Interest Group Asian Federation of Natural Language Processing in Computational Phonology (SIGPHON-97), pages (ACL2017). Association for Computational Linguis- 11–18. tics (ACL2017). John Nerbonne, Wilbert Heeringa, and Peter Kleiweg. Bahar Salehi, Dirk Hovy, Eduard Hovy, and Anders 1999. Edit distance and dialect proximity. Time Søgaard. 2017. Huntsville, hospitals, and hockey Warps, String Edits and Macromolecules: The the- teams: Names can reveal your location. In Proceed- ory and practice of sequence comparison, 15. ings of the 3rd Workshop on Noisy User-generated Text, pages 116–121. Dong Nguyen, A Seza Dogruöz,˘ Carolyn P Rosé, and Franciska de Jong. 2016. Computational sociolin- Robert G Shackleton Jr. 2005. English-American guistics: A survey. Computational linguistics. speech relationships: A quantitative approach. Jour- nal of English Linguistics, 33(2):99–160. Robert Östling and Jörg Tiedemann. 2017. Continuous multilinguality with language vectors. In Proceed- Philippa Shoemark, James Kirby, and Sharon Goldwa- ings of the 15th Conference of the European Chap- ter. 2017a. Topic and audience effects on distinc- ter of the Association for Computational Linguistics: tively Scottish vocabulary usage in Twitter data. In Volume 2, Short Papers, pages 644–649, Valencia, Proceedings of VarDial Workshop. Association for Spain. Association for Computational Linguistics. Computational Linguistics. Yves Peirsman, Dirk Geeraerts, and Dirk Speelman. Philippa Shoemark, Debnil Sur, Luke Shrimpton, Iain 2010. The automatic identification of lexical varia- Murray, and Sharon Goldwater. 2017b. Aye or naw, tion between language varieties. Natural Language whit dae ye hink? Scottish independence and lin- Engineering, 16(4):469–491. guistic identity on social media. In Proceedings of EACL. Association for Computational Linguistics. Albrecht Plewnia and Astrid Rothe. 2012. Sprache – Einstellungen – Regionalität. In Ludwig M. Benedikt Szmrecsanyi. 2008. Corpus-based dialec- Eichinger, Albrecht Plewnia, Christiane Schoel, tometry: aggregate morphosyntactic variability in Dagmar Stahlberg, and Gerhard Stickel, editors, British English dialects. International Journal of Sprache und Einstellungen. Spracheinstellungen aus Humanities and Arts Computing, 2(1-2):279–296. sprachwissenschaftlicher und sozialpsychologischer Perspektive. Mit einer Sprachstandserhebung zum Peter Trudgill. 2000. Sociolinguistics: An introduction Deutschen. to language and society. Penguin UK.

4393 Joe H Ward Jr. 1963. Hierarchical grouping to opti- mize an objective function. Journal of the American statistical association, 58(301):236–244. Martijn Wieling, John Nerbonne, and R Harald Baayen. 2011. Quantitative social dialectology: Ex- plaining linguistic variation geographically and so- cially. PloS one, 6(9):e23613.

4394