Language · Essay № 01 The Lab / Writing ↗

The architecture of language
from sound to code.

Author
Raf Laus
Published
2026 · 07
Read
12 min
Filed
Linguistics

A concise guide to the core structures of linguistics and Python examples.

Linguistics is the study of how language is built, understood, and used. Computational linguistics represents sounds, words, sentences, meaning, and context as structured data that can be modeled, analyzed, and transformed. Many of these concepts can be represented with trees and other data structures.

01. Phonology: sound systems

Phonology studies the abstract sound categories a language uses. It distinguishes phonemes from allophones, describes contrastive features, and models how sounds alternate in context through distinctive features, syllable structure, stress patterns, and neutralization. The syllable itself is a small tree: an onset and a rime, the rime splitting into nucleus and coda.

Phonology · syllable structureσ → onset · rime → nucleus · coda
The English word cat /kæt/: one syllable node branching to onset and rime, the rime carrying the vowel nucleus and final coda.

Python concepts

  • Unicode strings, normalization, and IPA tokenization
  • regular expressions for phonotactic patterns
  • dictionaries for feature sets and segment inventories
  • finite-state transducers for alternations and phonological rules

02. Morphology: word structure

Morphology covers morphemes, roots, affixes, and the difference between inflection and derivation. It explains how words are composed, how paradigms work, and how productive processes generate new forms. Morphophonology links this word structure back to phonology.

Morphology · word decompositionprefix · stem → root · suffix
un·happi·ness, a derived word: prefix and suffix attach around a stem whose root carries the lexical meaning.

Python concepts

  • tokenization into morpheme sequences
  • rule-based segmentation and finite-state morphology
  • feature bundles to represent tense, number, case, and agreement
  • lexicon lookups with dictionaries and nested maps

03. Syntax: sentence architecture

Syntax is the grammar of sentence structure. It distinguishes constituency from dependency, models movement and agreement, and explains how arguments relate to predicates through phrase-structure rules, X-bar theory, and Minimalist derivations. The parse tree is the canonical structure here.

Syntax · constituency treeS → NP · VP
The fox jumps. A sentence node branching to a noun phrase and a verb phrase, each expanding to its lexical items.

Python concepts

  • tree structures and recursive traversal
  • context-free grammars for constituency parsing
  • dependency graphs for head-dependent relations
  • parsing algorithms like CKY and Earley

04. Semantics: meaning and inference

Semantics asks how meaning is composed from words and structures. It covers lexical meaning, compositional semantics, quantification, entailment, and reference, connecting predicate logic to natural-language meaning through scope, presupposition, and modality. Composition itself is a bottom-up tree.

Semantics · compositional derivation⟦S⟧ = ⟦VP⟧(⟦NP⟧)
Function application: the verb phrase denotes a function λx.jumps(x), applied to the subject fox to yield the proposition jumps(fox).

Python concepts

  • symbolic representations with tuples, dicts, and lambda expressions
  • typed feature structures for semantic roles
  • vector embeddings for lexical semantics
  • logic-style evaluation over structured data

05. Pragmatics and discourse

Pragmatics studies language in context: speaker intent, implicature, deixis, and conversational structure. Discourse analysis looks at cohesion, coherence, information structure, and how language unfolds across turns. Context changes interpretation, allowing one utterance to carry several layers of meaning.

Pragmatics · layers of an utteranceliteral · implicature · deixis
“Can you pass the salt?” Literally a question about ability; by implicature a request; with deictic anchors that only context resolves.

Python concepts

  • stateful context windows for dialogue
  • coreference chains and entity tracking
  • annotated corpora for discourse relations
  • feature extraction for pragmatics signals

06. Typology, variation, and modeling

Typology compares language structures across systems: word order, morphological type, case alignment, and markedness. Variation studies dialects, register, and social meaning, revealing how universals emerge from data and where exceptions matter. The field is a classification hierarchy.

Typology · classification axesorder · morphology · alignment
Three independent axes along which languages are classified: a language occupies one leaf under each branch.
The Rosetta Stone, inscribed with one decree in hieroglyphic, Demotic, and Greek scripts.
Relic · 196 BCE

The Rosetta Stone

One decree carved in three scripts: Egyptian hieroglyphic, Demotic, and Ancient Greek. Because the Greek was still readable, it became the key that let Champollion decipher hieroglyphs in 1822: the original parallel corpus, and a founding artifact of comparative and typological linguistics.

British Museum · via Wikimedia Commons

Python concepts

  • dataset filtering by language and typological features
  • statistics on frequency and distribution
  • corpus analysis for variation and register
  • modeling language as structured, probabilistic data

07. Python patterns for linguistics

Linguistics concepts can be represented with computational abstractions. Sounds can use tokens and feature matrices, words can use segmented sequences and morphological state machines, syntax can use trees and graphs, and meaning can use structured logic or dense vectors.

from collections import defaultdict

def tokenize(text):
    return text.lower().split()

def build_lexicon(tokens):
    lexicon = defaultdict(int)
    for token in tokens:
        lexicon[token] += 1
    return lexicon

text = "The quick brown fox jumps over the lazy dog"
print(build_lexicon(tokenize(text)))

The example represents language with code before applying rules, models, or statistical inference to the resulting data.

Filed under · Linguistics · NLP · Systems