Elamur Research

Automatic Creation of Text Corpora for Low-Resource Languages from the Internet: The Case of Swiss German

Paper · 2020 · Lucy Linder, Michael Jungo, Jean Hennebert et al.

Summary

Swiss German is widely spoken in Switzerland, and people write it in forums, blogs and social media. Yet a researcher looking for a substantial collection of written Swiss German faces a discovery problem. There is no dedicated internet domain to search, writers spell words according to local pronunciation and convention, and a useful passage may be tucked into the comments on a page whose main text is in High German. The authors build SwissCrawl to address that problem. Their aim is to collect enough text for natural language processing while retaining the informal writing that makes the web a valuable source for low-resource languages.

The collection system searches for combinations of words drawn from existing Swiss German text, then visits the pages it finds. It extracts and cleans text, splits it into candidate sentences and estimates the language of each candidate. The language identification component is trained to distinguish Swiss German from High German and other related varieties. The crawler can keep a page that yields a single qualifying sentence, including one embedded in a discussion written largely in another language. It follows links more selectively, and sentences collected in one round can supply search words for a later round.

The released SwissCrawl corpus contains 562,524 sentences from 62K URLs across 3,472 domains. The most prominent sources include forums and social platforms, and the collection preserves much of their lower-case, colloquial and irregularly punctuated writing. A large share of the sentences received high Swiss German scores from the language identifier. Those scores guided collection and later data selection. The authors monitored sources and blocked problematic domains during crawling, while the finished corpus received no systematic human validation.

To test the corpus, the authors trained GPT-2 on Leipzig Swiss German text, on a high-confidence portion of SwissCrawl and on both together. They evaluated the resulting predictors with perplexity, a measure of how surprising the test text is under a predictor, where lower values are better. On held-out SwissCrawl text, training with SwissCrawl alone yielded 49.5 and training with both sources yielded 45.9. On the Leipzig test set, the combined training condition reached 30.5, compared with 47.6 for Leipzig alone. The gains were therefore visible on two distinct sources of Swiss German test text. The authors designed the crawler to run again as new writing appeared, although successive searches over the existing web were already returning fewer new sentences.

Deep dive: Automatic Creation of Text Corpora for Low-Resource Languages from the Internet: The Case of Swiss German

SwissCrawl collects written Swiss German from the web and tests how the resulting corpus improves prediction of Swiss German text. · about 34 minutes to read

The problem and its context

A widely used dialect continuum with little collected text

Swiss German poses a problem for text collection because its visibility in everyday life and its visibility to an automated search are very different. According to the paper, more than 60% of Switzerland’s population speaks Swiss German, which forms a continuum of Germanic dialects. It is used in settings ranging from ordinary conversation to business meetings. In writing, it had become more visible through blogs, messaging applications and social media. These are settings in which people can write as they speak locally, and conventions can vary between communities and between writers.

That variation matters at the point where a collection system has to recognize text. If a reader encounters an unfamiliar spelling in a familiar discussion, the rest of the passage helps establish what it means and which language is being used. The system in this paper frequently has to judge a much shorter unit. A spelling that looks unusual in one context may be an ordinary way of writing a local pronunciation in another. The paper identifies variation across dialects, the absence of an official writing standard and the informal settings in which people write as reasons that Swiss German resources had remained scarce in spite of the language’s widespread use in Switzerland.

The setting also affects what belongs in a corpus. A collection built around conventionally punctuated sentences would be easier to process with familiar tools. It would also favor the writers and webpages that happen to follow those conventions. The authors were interested in how Swiss German actually appeared in informal online writing, including lower-case openings, abbreviated expression and irregular punctuation. For that purpose, a rule about the appearance of a sentence can influence the linguistic character of the dataset as much as a rule about where to search.

The problem operates at several levels. A search engine has to surface a page that contains the language. The crawler then has to locate the relevant text inside the page. A boundary detector has to decide where one candidate ends and the next begins, and a language identifier has to assign each candidate to a language category. An error early in that sequence can remove a passage before any language decision is made. A system that discards comment threads during extraction, for example, gives even a very accurate language identifier no opportunity to find Swiss German there.

What researchers already had

The authors describe earlier Swiss German resources as valuable for particular research purposes. Some covered specialized material, including text from SMS and a corpus of spoken Swiss German. The Swiss German Dialect Corpus they cite contained 7,305 sentences and was used for part-of-speech tagging, the task of identifying grammatical categories in context. The paper also mentions earlier work that provided lexical material without full sentences. A resource of that kind can help establish which forms occur, while research on how words fit together in running text calls for longer units.

The largest general written resource the authors identify came from the Leipzig Corpora Collection. Its Swiss German material combined text from the Alemannic Wikipedia with crawls of the .ch domain in 2016 and 2017, for a reported total of 175,399 unique sentences. This supplied a practical starting point. The authors could use some of that text to learn which words to search for and to train a component that recognized candidate Swiss German sentences. The collection also gave them a comparison source for evaluating what the new crawl contributed.

The Leipzig approach left room for a different search. A .ch address identifies a domain that can host Swiss German, but the address itself does little to distinguish the language from other languages used in Switzerland. Swiss German can also appear on domains beyond .ch, including platforms whose addresses give little indication of the language in a particular discussion. The authors further argue that the Leipzig collection’s requirements for sentence form fit only part of the way people write Swiss German online. Extending the corpus therefore meant broadening the set of addresses and reconsidering what to retain from each address.

Why a conventional web crawl needed adapting

The paper situates SwissCrawl in the tradition of treating the web as a corpus. In the earlier approaches it describes, search terms can be drawn from moderately frequent sequences in a small starting collection. Such a sequence is an n-gram, a run of neighboring items, which in this setting can be words. The resulting queries supply starting URLs, often called seeds for the crawl. A crawler can visit those addresses and explore the links they contain, proceeding outward through successive levels in what is known as breadth-first exploration.

A language-specific top-level domain would help restrict where that search happens. A language category recognized by a search engine would help restrict what comes back. The authors had neither for Swiss German. They distinguish their use of a starting text collection for query generation from more extensive bootstrapping through rich collections of documents in the target language. In the case they studied, whole Swiss German documents were too scarce for the bootstrapping approaches they discuss. A few useful sentences could be surrounded by a great deal of other material, and recognizing that mixed page as a useful source required working below the document level.

Existing language identification software posed a related difficulty. The paper uses FastText as an example of a readily available option with Swiss German support. Its training source for that label was the Alemannic Wikipedia, which covers varieties beyond Swiss German. The authors wanted a narrower category so that an Alemannic passage from elsewhere would be less likely to enter SwissCrawl under the Swiss German label. A language identifier can perform its original task reasonably and still draw the boundary in the wrong place for a particular corpus.

Finally, the authors needed to recover scattered material. A web corpus designed around the main text of each page can remove much extraneous content and simplify later processing. In this case, comments and other secondary text could be central to the research purpose. The paper thus treats the tradeoff between precision and recall as a practical design question. Precision concerns the share of selected material that belongs in the collection. Recall concerns how much of the relevant material a system manages to retain. The authors give particular weight to recall during collection because the material they seek is relatively hard to find and easy to discard by accident. Later decisions can use the retained sentence’s language score and source to select a narrower subset.

The method, step by step

SwissCrawl divides the work between a seeder and a crawler. The seeder turns examples of Swiss German into search queries and records promising page addresses. The crawler visits addresses, extracts candidate sentences and decides whether to pursue more links. MongoDB connects the components by storing addresses and their associated information. The authors implemented the system in Python 3 and released the collection code. They organized it into runs so that they could inspect the material and adjust the process as they learned where errors and productive sources occurred.

The basic loop begins with text whose language is already reasonably well established. The first run draws on the Leipzig web corpus from 2017, after applying SwissCrawl’s own language identifier. Later runs can draw on sentences recovered earlier. Search results then provide a set of addresses from which the crawler can work, while links found during crawling extend the search beyond the addresses returned directly. This gives the system two ways to reach new pages. It can change the words used to search the web, or it can explore the neighborhood of a page already found.

How a SwissCrawl collection run works

The steps in order.

How a SwissCrawl collection run worksStep 1: Select starting sentences for query generation1. Select starting sentences for query generationStep 2: Sample characteristic words and screen candidate queries2. Sample characteristic words and screen candidate queriesStep 3: Search the web and queue new addresses3. Search the web and queue new addressesStep 4: Download pages and extract candidate sentences4. Download pages and extract candidate sentencesStep 5: Check sentence form and identify the language5. Check sentence form and identify the languageStep 6: Save qualifying text and follow selected links6. Save qualifying text and follow selected linksStep 7: Remove near-duplicates when exporting the corpus7. Remove near-duplicates when exporting the corpus

Choosing the words to search for

The seeder starts from a list of sentences. When that list comes from earlier crawls, the method takes one sentence per unique URL. This restriction applies to query generation. A productive page can still contribute many sentences to the corpus, while its vocabulary has a more limited role in determining the next round of searches. The difference matters because a discussion with many recoverable lines could otherwise exert an outsized influence on the search vocabulary simply through the amount of text it supplied.

The seeder converts candidate words to lower-case when building its frequency counts and discards words containing nonalphabetic characters. It then removes forms that occur just once and forms listed in German or English vocabularies. The authors used a German dictionary of 1.9M words and a US English list of 40K words for this screening. The procedure aims to favor search terms that recur in the starting material and are less likely to be explained by the presence of either of those other languages. Vocabulary filtering is confined to the selection of search terms. The final corpus can still contain ordinary shared words because the crawler assesses complete sentence candidates.

A seed is generated by sampling 3 words, with the sampling weighted by their frequencies in the resulting vocabulary. The sampled terms need not occur consecutively in a source sentence. This is a difference from using a frequent trigram directly. By sampling the individual words, the method can produce new combinations of forms already seen, which lets the search explore beyond the phrases most strongly repeated in the starting collection.

A candidate query is discarded if it has more than two single-letter words or if the language identifier assigns it a Swiss German probability below 95%. This check operates on a short collection of search terms. It gives the pipeline a chance to reject a combination that passed the vocabulary rules but provides weak evidence for Swiss German when taken as a whole. The 95% cutoff belongs to query construction. At the later stage where a full sentence can be retained, the crawler uses a different threshold.

The seeder submits accepted queries to Startpage, identified in the paper as a proxy for Google Search. It encloses each term in double quotation marks to prevent the search engine from correcting Swiss German spellings to High German. A correction that would ordinarily help someone find a standard spelling would remove the property that made those words useful for this search. The seeder saves the first 20 results whose URLs have never been seen. As the database grows, identifying unseen addresses can require looking further down the results for a query.

Downloading a page and recovering its text

The crawler can read starting URLs and metadata from a file or from MongoDB. Starting addresses enter the queue at depth 0. Depth records how far the crawl has moved through links from an initial address. The paper describes a usual depth limit of 3, with the option to set a different limit. A depth bound restricts how far a run travels, while other decisions determine how many different links at each depth it may pursue.

For a page it visits, the crawler fetches the HTML and converts it to UTF-8 so that different source encodings can be handled in a common representation. The implementation uses requests and BeautifulSoup in this stage. It then applies jusText to remove boilerplate, including material such as navigation and tables. Boilerplate removal matters because page furniture can recur across addresses and can contain strings that look like linguistic data when read out of context.

The authors omit the stop-word filtering step of jusText because they lack a Swiss German list for it. Stop words are common words that can be used as evidence that a block is ordinary running text. Such a test depends on having a usable inventory of frequent forms. A list for a different variety could favor blocks written in that variety and be less informative for locally spelled Swiss German. The result of extraction is a text stream that still has to be normalized and segmented before individual passages can be scored.

Normalization targets differences in encoding and representation. The system uses ftfy to repair remaining encoding problems, attempts to remove Unicode emojis, standardizes the representation of accents and punctuation such as dashes and quotation marks, and strips invisible characters. It also tries to regularize certain whitespace conventions around quotes and colons. These changes help give downstream tokenization a more consistent input. They leave the writer’s choice of words and local spellings substantially available for later use.

The distinction between encoded emoji and keyboard-made faces becomes important in the finished corpus. A Unicode symbol can be targeted as a character. A face assembled from keyboard punctuation uses characters that also perform ordinary grammatical functions or mark sentence boundaries. A normalization step that addresses the former can therefore leave examples of the latter. The paper’s discussion of segmentation errors and unusual punctuation is compatible with the earlier attempt to remove Unicode emojis.

Making sentences out of informal writing

To divide the extracted text into sentences, the authors reimplement the Moses sentence splitter in Python and adapt its assumptions. They preserve line breaks from the extracted text, treat colons and semicolons as possible boundary cues and allow a candidate sentence to start with a lower-case letter. They use the English and German lists of prefixes that suppress a break, with additions. Such a list helps a splitter recognize cases where a period belongs to an abbreviation and should leave the surrounding text together.

Allowing lower-case starts is particularly important for the source material. A forum writer can begin a new utterance after a line break without capitalizing its first word. If a splitter demands an upper-case opening to confirm a boundary, it can join that utterance to the preceding text or fail to recover it properly. Treating a newline as evidence lets the system recover some boundaries that conventional capitalization would have supplied in more formal writing. Punctuation such as a colon can also indicate a boundary in a post, although it can serve several other roles within a sentence.

The resulting segments go through a screen for plausible sentence form. The authors describe 20+ rules, many written as regular expressions, which are patterns for finding particular character sequences. The rules can set limits on the occurrences of a pattern, place a bound on word length or compare the counts of different patterns. The paper gives examples involving the number of hashtags, words longer than 30 characters and the balance between capitalized and lower-case words. These checks screen candidates before asking which language they belong to. A page fragment can contain Swiss German words while still being unsuitable as a sentence.

The paper describes its quantitative rules in prose. The capitalized-to-lowercase example can be written as follows.

C / L < 1.5

Here C counts capitalized words in the candidate and L counts lower-case words. The slash means division, and < requires the ratio to fall below the stated limit, 1.5. The paper gives the condition as an example of its screening rules and leaves the behavior for a zero denominator unspecified.

The form filter and the language check serve different purposes. A candidate may look like an ordinary sentence while being in High German. A fragment from a page widget may contain a name or a short form characteristic of Swiss German while failing the sentence rules. The two stages address those cases at different points. A candidate has to survive the form screen before it can enter the corpus on the strength of its Swiss German score.

Training the language identifier

Language identification is a text classification task in which the category assigned to an input is its language or language group. On a long, monolingual document, recurring spellings and grammatical patterns can accumulate as evidence. SwissCrawl has to make the decision on individual sentences, frequently short ones. The same kind of clue matters more when there is little surrounding text to confirm the decision. A name, a spelling irregularity or a group of short words may dominate the available evidence.

The training material comes from the Leipzig collection, with an emphasis on material obtained from the web. The authors organize it into eight classes, giving separate attention to languages that might resemble Swiss German. Swiss German, German and English have their own labels, as do Afrikaans, Dutch and Luxembourgian. A GSW LIKE class pools Bavarian, Kölsch, Limburgan, Low German, Northern Frisian and Palatine German. The authors say that they lacked enough resources to give the similar varieties classes of their own. An OTHER class covers a broader selection of languages, including French and Italian.

The class design makes the decision more specific than recognizing that a sentence looks broadly Germanic. During training, some examples teach the identifier which features support the Swiss German label. Others teach it that similar-looking forms can belong to a distinct language or variety. Pooling related varieties gives them a place in the decision even when individual classes are impractical. The resulting label records membership in the group. It provides no distinction between the individual varieties grouped there.

The authors describe 535,000 sentences distributed evenly across the eight classes. The Swiss German portion contains 66,684 sentences from the 2017 Leipzig web corpus, refined during preliminary experiments to remove obvious material in other languages. They allocate 75% of the overall data to training, 10% to choosing system parameters and 15% to the final test. Those groups have separate purposes. Training examples determine the learned classification behavior, the parameter-selection portion supports design decisions, and the test portion measures performance after those decisions have been made.

The starting point is a pretrained, cased German BERT checkpoint made available through the Transformers software. The authors apply fine-tuning, which adapts an already trained system to a particular task using examples labeled for that task. Here the adaptation makes the system assign a language class to the sort of sentence that the crawler will encounter.

The crawler discards sentence candidates with a Swiss German probability below 92%. The authors set this cutoff to favor recall. A probability returned by a classifier is its score for a candidate, and corpus users can use the recorded score to apply a stricter selection later. The collection procedure thus preserves some uncertain material while allowing the later text prediction experiment to use only sentences assigned a Swiss German probability of at least 99%.

Deciding what to save and where to go next

The crawler’s decision component can intervene at different points. Before fetching a URL, it uses metadata to decide whether to visit it. In the reported operation, visiting is restricted to new URLs. The authors designed the system so that it could also schedule repeat visits according to how much new content a page acquires over time. Such scheduling is a possibility of the design. The results describe the practice of visiting previously unseen addresses.

After processing a page, the crawler can save its results or blacklist the page. A page qualifies for retention if it contains at least one Swiss German sentence. This permissive rule allows the collection of a single useful remark or quotation on an otherwise unrelated page. The decision to follow links is stricter. The crawler generally explores a page’s outgoing links when the page produces more than two new Swiss German sentences. The authors settled on that choice after trials in which smaller returns often corresponded to quotations or false positives.

The count for link exploration concerns sentences that are new to the crawl. An address can deserve to be saved for what it contains even when it offers little evidence that nearby pages will add more material. This makes following a link a distinct decision from keeping the text already recovered. The former commits additional requests and processing, while the latter preserves a result the crawler has already paid to obtain.

Before queueing outgoing addresses, the crawler filters and sometimes rewrites them. It excludes unrelated national top-level domains and links with known media extensions, strips session identifiers from URL parameters and standardizes some subdomains for designated sites. These checks operate on the address itself. Redirects and differently written URLs serving the same content can still force extra visits. The design accepts that extra work in exchange for being able to make the initial decision using the link string alone.

From crawl records to released data

During the crawl, sentence and URL duplicates are detected by exact matching. This catches instances where the same string has already been seen. The export stage adds a broader comparison for sentences. It removes every character other than letters, including spaces, converts the result to lower-case and compares the remaining strings. Sentences that differ only in case, spaces or punctuation can therefore be recognized as duplicates even if their full forms were different during collection.

The comparison operates on a derived form of the sentence. Its purpose is to decide whether two records are sufficiently alike to keep both, while the released text retains the form produced by the normalization pipeline. A difference in the letters themselves can survive that comparison. For a corpus of dialect writing, such differences can carry information about spelling, and the authors say that other duplicate-detection approaches they tried discarded spelling variations they considered meaningful.

The released SwissCrawl file is a CSV with the extracted text, its source URL, the language probability assigned during crawling and the date. Those fields give a user several ways to select material. The score allows a more conservative language cutoff, the address can help identify sources or styles, and the date preserves when the text was collected. The paper also identifies a separate release of the experimental code for Swiss German text prediction. The collection and experiment serve different purposes, since the released corpus contains material outside the stricter sample used for training.

Experiments and results

How accurately the identifier classified held-out text

The fine-tuned German BERT system reached 99.58% accuracy on the held-out language identification test. Accuracy is the share of test sentences assigned the correct class. The authors report the most prominent confusions for Swiss German as German and GSW LIKE, at 0.04% each. These are the boundaries the class design was meant to address. The authors also report testing the identifier on Swiss German text messages and describe it as robust even for sentences of just five words.

The high test accuracy is measured on the identifier’s labeled data, with the classes balanced by design. During crawling, the distribution of languages depends on the pages reached and on the text that survives extraction and screening. The test result establishes performance on its own split. The SMS check offers evidence about a different type of short text, with the paper describing its success qualitatively. The examples of false positives in the released corpus show why accuracy on the test and confidence assigned to a specific web sentence need to be read separately.

What the initial crawl runs recovered

The authors report a sequence beginning with an empty database. For every iteration, 100 seeds were run on a virtual machine equipped with five CPU cores and zero GPUs. Because the database was carried forward, a later run searched against a larger record of known addresses and sentences. The table therefore records what successive runs added to the same effort. It describes the behavior of repeated collection rather than independent measurements of how many sentences an isolated run would recover.

The first seeding pass found 837 URLs, of which 577 were judged pertinent, a share reported as 68.94%. The crawl discovered 89,350 new sentences, along with 529 domains and 4810 URLs in the crawling totals. Its runtime was 16h15. The difference between the addresses found in seeding and the larger crawling total reflects the two roles in the system. Search supplies the initial addresses and links from visited pages can expand the collection beyond them.

The next seeding pass found 1062 URLs, of which 662 were pertinent, or 62.34%. That crawl discovered 48,483 new sentences, with 552 domains and 4382 URLs in its totals, and took 16h52. The seeder thus found more pertinent addresses in this pass while the crawler added fewer unique sentences. The reported domain count also went up at this point. Finding more addresses or domains can coexist with a lower yield of text when pages contribute less new material or repeat text seen earlier.

The final pass in the sequence found 732 URLs through seeding, of which 423 were pertinent, or 57.79%. The crawl added 20,662 sentences, with 423 domains and 2193 URLs in the crawling totals. It ran for 40h52. The authors note that some pages exposed as many as 12 thousand outgoing links, which had to be visited before they could be discarded. Addresses carrying cookie information in query parameters added a related burden, because their duplication could sometimes be recognized only after fetching the pages.

The sequence shows a falling return in new sentences and in the share of search results deemed pertinent. The authors explain that when top-ranked results are already known, the seeder works further down the result list. That means later runs change the pool of addresses on which the crawler spends its time. Since the pertinent share was still above 55% on the final pass, the authors regarded further runs as worth trying. The runtime figures show that the cost of a run also depends on the structure of the pages and URLs it finds, independently of how much text those pages eventually contribute.

What SwissCrawl contains

The full collection reported in the paper was crawled between September and November 2019. It contains 562,524 sentences from 62K URLs and 3,472 domains. These are counts of different kinds of units. A domain can contain many useful pages, and a page can supply multiple sentences. The distribution is uneven. The paper describes the ten largest domains as contributing 46% of the corpus. The leading source, www.fcbforum.ch, contributed 54,954 sentences from 6,169 URLs, for 9.77% of the sentences in the domain breakdown. In the same breakdown, the row grouping the other domains accounts for 303,235 sentences and 53.91%.

The domains illustrate the places in which the search worked. The source list includes forums, social platforms and reference material, and the authors emphasize informal discussion as a large part of the resulting collection. The domain distribution also gives context for the word forms and sentence lengths a reader will encounter. A thread about football or another recurring interest can supply many lines, so having text from thousands of domains still allows a small set of large communities to have a considerable influence on the overall collection.

The authors treat a Swiss German score of at least 99% as a high-confidence band. In the probability breakdown, 503,526 sentences fall in that band, accounting for 89.51%. The next band, labeled 98+ in the paper’s breakdown, contains 19,769 sentences, or 3.51%. At the low end retained by the collection, the 92+ band contains 3,973 sentences, or 0.71%. These labels represent separate bands in the paper’s table. The distribution says that most retained candidates were scored far above the admission threshold. It is a distribution of classifier outputs, with manual inspection providing a separate and much narrower view of actual sentence quality.

Lengths and formatting statistics describe what the extraction and normalization procedure preserved. The shortest sentence contains 25 characters and the longest contains 998. The mean is reported as 92 ± 55 characters, with a median of 77. Word counts have a median of 14 and a mean of 16 ± 10, with values spanning 4 to 222. The reported mean letter density is 80%. Only 61% of sentences both start with a capital letter and end with one of the ordinary terminal punctuation marks counted by the authors. That last statistic concerns both conditions together. It supplies evidence for the decision to recognize sentences without requiring conventional beginnings and endings.

The paper uses hand-picked cases to show what lies behind the aggregate figures. Some are well-formed examples of informal Swiss German. Some mix words with keyboard faces, repeated letters or strings that look like page or discussion titles. Others illustrate High German false positives. A selection made to show different kinds of output can reveal how things go wrong, while a sample designed to estimate their frequency would require a different selection procedure. The authors also describe long entries that contain lyrics with too little conventional punctuation for the splitter to find the intended boundaries. They kept these entries in the release because they may be of interest in their own right and can be filtered by users interested in shorter units.

How the text prediction comparison was set up

The authors used the base GPT-2 configuration for each training condition. The paper reports 12 layers, 786 hidden states, 12 heads and 117M parameters for this configuration. Keeping the same stated architecture gives the experiments a common basis. The training text changes between conditions, as do the amount of data and the vocabulary derived from it.

The Leipzig condition uses unique sentences from the Leipzig Swiss German web data and lists 180,000 training sentences. The SwissCrawl condition uses text at a Swiss German probability of at least 99%, with 483,526 training sentences. The combined condition lists 663,526 training sentences, using both sources. These are the training sizes in the experimental results. The earlier total of 175,399 refers to the paper’s description of the existing Leipzig Swiss German collection. The paper gives the two Leipzig figures in distinct contexts and leaves their relationship unresolved.

For each condition, the authors derive a vocabulary from its own training data with Byte Pair Encoding, or BPE. This is a form of subword tokenization that represents text using pieces learned from recurring sequences. A sufficiently familiar form can be represented by a larger piece, and a less familiar spelling can be composed of smaller pieces. That property is useful when alternate spellings are common because a complete word need not already be in the vocabulary for the system to represent it. The paper associates this approach with earlier work on subword units.

The evaluation uses independent test sets of 20K samples from each source. It reports scores for the Leipzig test set, the SwissCrawl test set and a combined test set. The metric is perplexity. For a predictor that assigns probabilities to the successive units of a text, perplexity reflects how much uncertainty it assigns to the sequence it is asked to predict. Lower perplexity means the observed test text is less surprising under the predictor. In this experiment, the system is being assessed on its ability to predict held-out text from the corpora. The metric says nothing directly about which dialect labels a classifier would assign or how people would judge a generated passage.

The results on each source

Training sources compared on the Leipzig test set by perplexity

Combining the corpora gives the lowest perplexity on Leipzig text.

Training sources compared on the Leipzig test set by perplexityLeipzig training: 47.6Leipzig training47.6SwissCrawl training: 63.9SwissCrawl training63.9Combined training (this paper): 30.5Combined training (this paper)30.5
The numbers
System or settingperplexity
Leipzig training47.6
SwissCrawl training63.9
Combined training (this paper)30.5

On the Leipzig test set, Leipzig training is the stronger of the individual sources. SwissCrawl alone scores 63.9, compared with 47.6 for Leipzig alone. Yet using SwissCrawl along with Leipzig produces the lowest perplexity, 30.5. The authors report a 36% relative improvement over the Leipzig-only result. The pattern is consistent with SwissCrawl bringing useful evidence to the Leipzig training condition even though a predictor trained solely on SwissCrawl is less well matched to Leipzig text than one trained on Leipzig itself.

Training sources compared on the SwissCrawl test set by perplexity

SwissCrawl training sharply improves prediction on SwissCrawl text and the combined condition leads.

Training sources compared on the SwissCrawl test set by perplexityLeipzig training: 92.6Leipzig training92.6SwissCrawl training: 49.5SwissCrawl training49.5Combined training (this paper): 45.9Combined training (this paper)45.9
The numbers
System or settingperplexity
Leipzig training92.6
SwissCrawl training49.5
Combined training (this paper)45.9

On the SwissCrawl test set, Leipzig training has perplexity of 92.6. Training on SwissCrawl alone reduces the score to 49.5, and the combined condition reaches 45.9. The source-matched advantage reverses across the two test sets. The predictor trained on just one source is more effective on held-out text from that source. This is evidence that the two corpora differ in ways that matter to prediction, even though each is meant to provide examples of Swiss German.

Training sources compared on the combined test set by perplexity

Training on both corpora gives the lowest perplexity on the combined test set.

Training sources compared on the combined test set by perplexityLeipzig training: 67.6Leipzig training67.6SwissCrawl training: 56.2SwissCrawl training56.2Combined training (this paper): 38.0Combined training (this paper)38.0
The numbers
System or settingperplexity
Leipzig training67.6
SwissCrawl training56.2
Combined training (this paper)38.0

On the combined test set, Leipzig alone scores 67.6 and SwissCrawl alone scores 56.2. The joint training condition scores 38.0. Across the evaluations, the system trained on both sources ranks highest under the protocol used in the paper. The improvement from adding Leipzig to SwissCrawl is smaller on SwissCrawl text than the improvement from adding SwissCrawl to Leipzig on Leipzig text. That asymmetry describes the observed training conditions, which differ in corpus size as well as in their contents and learned sub-word vocabularies.

What the ablations show

Changing the source of training sentences

The comparison between Leipzig, SwissCrawl and the union is the paper’s main controlled comparison. The stated GPT-2 configuration stays the same while the training source changes, and each condition faces the same three reported test settings. This design allows the reader to ask whether a gain is visible on the earlier corpus as well as on data from the new crawl. The Leipzig test is especially informative for that purpose. A gain only on SwissCrawl might come primarily from having trained on text drawn from the same collection. The lower perplexity on Leipzig when the corpora are combined shows that the observed benefit reaches the other collection too.

The comparison also exposes the limitations of training on one collection. Leipzig-only training encounters much greater difficulty on SwissCrawl text, and SwissCrawl-only training gives up the advantage of matching the Leipzig test distribution. Both gaps are instructive because they point to the source as an important property of the data. A corpus label tells the reader that both sources aim to contain Swiss German. It leaves open differences in how pages were discovered, what registers the texts represent, and which segments each collection accepted as sentences.

The paper compares complete training conditions. Adding a corpus supplies more sentences, can bring in new spellings and contexts, and changes the material used to learn the BPE vocabulary. The result supports the use of combined data for the tested task. It cannot identify the share of the improvement due to quantity, the share due to source diversity or the contribution of the vocabulary. A comparison in which the amount of text and the tokenization stay fixed would answer a different question from the one measured here.

Changing the way searches begin

The seeder comparison asks whether a different kind of query finds better text or simply finds different text. The authors compare frequent trigrams, frequency-weighted sampling of 2 to 7 words and manually composed queries. They used 100 seeds of each kind and report no significant difference in quantity or quality among the resulting collections. They also report that 50% of sentences differed between strategies. The paper provides this as an observation about overlap, without a breakdown that would assign a particular share of unique text to each approach.

Those observations explain why the authors considered combining strategies even though they ultimately favored frequency-weighted sampling. Similar yields can hide substantial differences in which pages or sentences were reached. Frequent trigrams tended to produce increasingly similar queries, and preparing manual queries took too much time for routine use. Sampling made it practical to keep proposing combinations of words automatically. The eventual procedure uses 3 words in a query. The preliminary comparison establishes the context for that practical choice and does not provide a separate result for each query length.

The finding about different sentences also clarifies the role of the search engine in the experiment. Search results are tied to the terms that reach the search engine. If alternative queries lead to distinct sets of sentences, a collection reached with one query strategy reflects its access route as well as the language available online. The comparison provides evidence for that claim within the authors’ runs. It gives no complete account of how much Swiss German each strategy would find if run to exhaustion.

Testing collection decisions in practice

Some design choices are supported by observations from trials rather than paired measurements. The choice to follow links only when a page provides more than two new Swiss German sentences comes from the authors’ observation that pages with fewer frequently contain isolated quotations or false positives. It is a way of using current yield to judge whether a stronger search investment is warranted. The paper does not give matched runs comparing that rule with several other thresholds, so its contribution to the final corpus size cannot be read from the iteration totals.

The export duplicate rule reflects a similar trial-and-judgment process. The authors tried other ways of detecting near-duplicates and found that they removed some meaningful spelling differences. The chosen comparison deliberately retains differences in letters while ignoring whitespace, case and punctuation for duplicate detection. This gives a concrete account of what the rule preserves and what it merges. The paper gives no measured count of the retained dialectal variants or the redundant sentences left behind.

The crawl sequence is a further analysis of the running system. Falling sentence yield accompanied by increased runtime on the final pass shows that effort and output can diverge. The extra work on pages with very many links and on URLs that conceal duplicates explains some of that divergence. The runs accumulate knowledge of previous addresses, so each new run faces a different search problem. Their results describe how a repeated crawl behaved in this setting. They are separate from an ablation that holds the starting database constant and removes one processing stage at a time.

The paper’s individual examples complete the analysis by revealing failures that summary scores conceal. A misleading proper name can give an otherwise High German sentence strong Swiss German cues, while a keyboard face can interfere with sentence boundaries even if every word belongs to the intended dialect. Those cases locate problems in different stages. One concerns the language decision, the other the construction of the unit on which that decision operates. The paper supplies no experiment in which each of these stages is systematically switched off and the resulting text prediction score measured.

Limitations

Limits described by the authors

Language errors remain even when the score looks convincing. The authors describe false positives chiefly involving High German and other German dialects, with rarer cases involving Dutch or Luxembourgian. They point to cues that can make those candidates resemble Swiss German, including names associated with Swiss German usage, misspellings or broken words, and combinations of umlauts and short words. Repeated letters can also contribute strong signals. In genuine informal Swiss German, a writer may repeat letters for emphasis, so a rule that simply removes such instances would cut into the style the authors sought to preserve.

Extraction quality depends on how each site structures its HTML. Some invisible elements become part of the extracted text even though a reader viewing the page would never see them. The authors describe a site-specific fix for watson.ch, where hidden elements entered the extracted sentences. They also report that further cases remained. A crawler that processes many sites encounters a range of layouts, and correcting a known case can improve one source without resolving the more general problem of separating visible discussion from text embedded for other purposes.

Sentence boundaries are another source of uncertainty. The authors identify text faces made of punctuation as a recurring cause of splitting errors. Lyrics and poems can also be hard to segment, especially when they have repeated lines and little conventional punctuation. The collection retains such material. A record called a sentence in the dataset is therefore the result of the text extraction and boundary rules, and can represent something closer to a fragment, a title or a long passage in some parts of the corpus.

The duplicate rule has a similarly specific meaning. A spelling change as small as a different umlaut can result in two retained records. A shortened version of a longer passage can survive because the sequence of letters differs. Conversely, candidates with the same letter sequence can be treated as duplicates even if their punctuation or word boundaries differ. The authors chose this tradeoff after finding that more expansive comparisons removed variations they wanted to preserve. The use of “unique” for corpus sentences should be read in light of that rule.

The authors monitored the crawl and blocked some problematic domains, including sources serving embedded PDFs and sources written in closely related German dialects. They report no systematic human validation of the finished collection. Their judgment of generally good quality therefore sits alongside an acknowledged lack of corpus-wide annotation. They also describe limited access to major social platforms and propose platform-specific work using their APIs. Their plan to run the crawler at intervals responds to the changing web, while the measurements in the paper cover the reported collection and the observed runs.

Limits of what the experiments establish

The language identification test measures performance against labeled examples selected to give the classes equal weight. Its accuracy cannot be applied directly to the release to estimate the share of genuinely Swiss German sentences. Web candidates have already been selected by queries, extraction rules and sentence filters, and the prevalence of each language among them is unknown. The paper also gives no calibration study relating confidence bands to the share of correct decisions on the crawl. A sentence placed in the highest band has received a strong score from the identifier. The observed sources of false positives remain relevant to the interpretation of that score.

The composition of the corpus limits claims about representativeness. It documents the Swiss German that the queries, search engine and link traversal could reach, with substantial contributions from a few large online sources. The record supports conclusions about how Swiss German is used in those settings. It yields no representative distribution of writing by dialect region, topic, age group or communication medium. The source names and lengths help characterize the observed text, but the paper does not give a dialect-by-dialect inventory or a sampling scheme designed to balance speakers.

The decreasing yield is evidence about the search as operated. It is compatible with the authors’ view that Swiss German is difficult to find online. The runs cannot establish the total amount available, because they depend on what the search engine indexes, which terms were tried, which links were traversed and which material survived screening. The authors’ observation that later queries reach further into the ranked results gives a concrete mechanism for declining relevance even when some useful material remains. Private text and material accessible only through particular platform interfaces are outside what these runs can count.

The text prediction experiment shows improvement under the reported training and test protocol. It leaves the roles of training volume, source mixture and sub-word vocabulary intertwined. Each condition learns a separate segmentation vocabulary. This matters because perplexity is defined over the units predicted, and different segmentations can divide the same string into different units. The reported ranking describes the authors’ procedure. The paper gives no assessment with a shared vocabulary or a score normalized to a common text unit that would isolate the effect of this choice.

The selection of high-confidence SwissCrawl sentences for training also defines the scope of the result. The full release includes candidates below that threshold. The experiment gives evidence about the portion chosen for training and says nothing direct about the added value of those lower-confidence bands. Similarly, the paper proposes potential benefits for future language identification and machine translation, while the downstream experiment measures perplexity. The transfer of the crawler to another low-resource language is a possibility of the design. The reported empirical case is Swiss German, where the authors had both Leipzig material to start from and specific evidence about the languages and varieties likely to be confused.

What came after

Playing with Words at the National Library of Sweden — Making a Swedish BERT cites SwissCrawl in work directed at building a Swedish BERT at the National Library of Sweden. Its stated objective places the citation in the context of assembling language-specific text for computational use. SwissCrawl provides an example of that resource-building problem in Swiss German, where informal web writing had to be found and screened before it could be used for training. The citation establishes a connection between the papers. It leaves open which, if any, of the SwissCrawl collection procedures the Swedish work adopted.

Mining Naturally Romanized Seed Corpora without Romanizations cites SwissCrawl in work on finding naturally romanized text for seed collections. Naturally romanized text is writing in the Roman alphabet produced in ordinary use. The problem named in the later work concerns finding that writing without already having romanizations to start from. This relates to the discovery problem in SwissCrawl, where naturally occurring forms were valuable evidence but search and recognition tools offered limited help in locating them. SwissCrawl could begin with an existing Leipzig sample and use its vocabulary to generate queries. The later title points to a different constraint on what can be assumed at the start of collection. The citation identifies the relationship at the level of corpus discovery, while the details of any direct reuse are unspecified.

Cite

Cite as Lucy Linder, Michael Jungo, Jean Hennebert, Claudiu Cristian Musat and Andreas Fischer. 2020. Automatic Creation of Text Corpora for Low-Resource Languages from the Internet: The Case of Swiss German. Proceedings of the Twelfth Language Resources and Evaluation Conference.

The paper itself, not this page. BibTeX from the library's record of the work.

@inproceedings{linder2020automatic,
  title = {{Automatic Creation of Text Corpora for Low-Resource Languages from the Internet: The Case of Swiss German}},
  author = {Lucy Linder, Michael Jungo, Jean Hennebert, Claudiu Cristian Musat and Andreas Fischer},
  booktitle = {Proceedings of the Twelfth Language Resources and Evaluation Conference},
  year = {2020},
  url = {https://aclanthology.org/2020.lrec-1.329/}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/linder-2020-automatic-creation-text-corpora-low/