Computational Linguistics Intro
π£οΈ Natural Language Processing (NLP) & Computational Linguistics
Natural Language Processing (NLP), also known as computational linguistics, is the field dedicated to programming computers to process human language. It involves teaching machines to understand, interpret, and generate human language, bridging the gap between human communication and computer comprehension.
Despite computers excelling at complex calculations like millions of digits of pi or playing chess, tasks that are automatic for humans are surprisingly difficult for machines.
Easy for computers: Learning vast vocabularies, performing rapid calculations.
Difficult for computers: Understanding nuances like sarcasm or emotion, recognizing language despite typos or accents, identifying objects in images (e.g., traffic lights).
NLP is fundamental to many technologies we use daily:
Search engines
Voice-activated home systems (e.g., smart assistants)
Spam filters
Spell checkers and grammar tools
Predictive text
π» The Multi-Step Process of NLP
Getting a computer to work with the complexity of human language requires a series of distinct steps. These steps allow for modularity and reusability across different NLP tasks.
1. π Inputting Text Data
The first step is to provide the computer with digital text. This can be done in several ways:
Direct input: Text typed directly into the system.
Transformation from physical forms:
Speech-to-text: Converts spoken language into written text.
Handwriting recognition: Transforms handwritten text into digital text.
Optical Character Recognition (OCR): Converts scanned documents or images of text into editable digital text.
This stage also involves segmentation, where the computer identifies boundaries between words and sentences. For example, distinguishing between "a moist towelette" and "a moist owlet," or recognizing whether a small mark is a period, an 'i' dot, or just a fleck of dirt.
2. π§ Understanding Meaning and Relationships
Once digital text is obtained, the computer must: a. Determine word meanings: This often requires disambiguation based on context (e.g., differentiating "river bank" from "financial bank"). It also involves distinguishing between common nouns and proper nouns. b. Identify relationships between words: This step helps the machine grasp the approximate meaning of what is being said.
3. π― Performing Useful Tasks
With an understanding of the text, the computer can then perform a specific, useful task. Each task typically requires a different system:
Answering questions
Translating into another language
Finding directions
The output of this processing is usually in an abstract form that the computer understands, such as a mathematical equation or lines of code.
4. π£οΈ Re-encoding into Human Language
The final step is to convert the processed data back into a format that humans can understand. This often involves text generation.
If the output needs to be spoken, text-to-speech and speech synthesis technologies are used.
π Reusability and Modularity
A significant advantage of breaking NLP into these steps is the reusability of components. For instance, a robust English text-to-speech system can be used to read aloud answers, translations, or directions. This modular approach allows programmers to distinguish between language-specific customizations and universal computer code, saving development time.
π οΈ Standalone NLP Tools
Individual subtasks can also be useful on their own:
Automatic captioners primarily perform speech-to-text.
Screen readers focus on text-to-speech.
Search engines and translation tools might start with text input, bypassing speech processing.
π€ Signed Language Processing
The principles of NLP can also be applied to signed languages, though this field is significantly less developed than for spoken languages. A similar set of steps could include:
Sign-to-text: Converting signs into a digital text representation.
Parsing signs: Analyzing the grammar and meaning of the signs.
Processing results: Enabling computers to work with the information.
Rendering output: Converting processed data back into signs.
Such systems could facilitate interoperation between signed and spoken languages (e.g., English to ASL translation). However, each of the hundreds of signed languages would require separate support, similar to spoken languages.
β The Myth of "Sign Language Translation Gloves"
"Sign language translation gloves" are often hyped but based on fundamental misunderstandings of signed languages:
Grammar goes beyond handshapes: Signed language grammar involves not only handshapes but also facial expressions and movements of hands and arms relative to the body. Gloves typically only detect handshapes.
Limited vocabulary recognition: Signed languages use far more signs than the 26 letters of the manual alphabet, which is often the limit of what these gloves can detect. The manual alphabet is primarily used for borrowing technical words, not core vocabulary.
One-way communication: These gloves only translate from signs to speech, failing to provide two-way communication accessible to Deaf and Hard-of-Hearing individuals. Effective translation requires input from Deaf people in development.
π€ Does a Computer "Understand" Language?
Even with highly effective NLP systems, the question remains whether a computer truly "understands" language like a human.
A computer can be trained to perform specific tasks (e.g., pressing buttons for a treat), giving the appearance of understanding.
However, if the underlying instructions are basic, the system may fail spectacularly when faced with more complex or nuanced queries. This highlights the challenge of teaching computers true linguistic comprehension.
π οΈ Approaches to Teaching Language to Computers
Historically, and in modern machine learning, different approaches have been used:
1. π Rule-Based Systems (Traditional)
Method: Computers were taught with long lists of specific rules (e.g., "make a word plural by adding -s," with exceptions for "child" becoming "children").
Challenge: Requires extensive manual rule creation and exception handling, becoming unwieldy for complex languages.
2. π Machine Learning (Modern)
Method: Computers are trained on large datasets to identify statistical patterns.
Process:
**Training**: Exposing the computer to vast amounts of data.
**Pattern Recognition**: The computer statistically learns relationships and rules from the data.
**Testing**: Evaluating the learned patterns on a separate dataset.
π§ Neural Networks
A type of statistical machine learning that has driven many recent NLP advancements.
Model: Loosely based on how neurons function in the brain.
Learning: Neural networks autonomously determine the most relevant factors in the training data.
Challenge: Because they learn independently, it can be difficult for humans to understand exactly which patterns they are picking up on, leading to initial "silly" errors (e.g., returning "eeeeeeeee" due to 'e' being the most common letter). With continued training, they adjust to produce more human-like outputs.
π The Importance of Training Data
The quality and type of training data are crucial for machine learning in NLP.
1. π€ Supervised Learning
Data Type: Parallel data with two corresponding parts, matched by humans.
Examples: Text with audio, words with definitions, questions with answers, sentences with translations, images with captions.
Advantages: Highly effective for training.
Challenges: Difficult to find enough data because humans must manually create these matched pairs, making it resource-intensive.
2. π Unsupervised Learning
Data Type: Non-parallel data with only one component.
Examples: A large corpus of text, audio, or video in a single language.
Advantages: Much easier to find and collect vast quantities.
Challenges: Harder to use for training because the computer must learn from incomplete pairs.
3. π Semi-Supervised Learning
Method: A combination of both supervised and unsupervised learning.
Process: Uses a smaller amount of parallel data to initiate training, then leverages a larger amount of non-parallel data for further learning.
π« Bias in Machine Learning for Language
All training data is created or gathered by humans, and humans have inherent biases. These biases can be reflected and amplified in the output of machine learning systems, particularly in language tools. Harini Suresh's framework helps categorize these biases:
1. π°οΈ Historical Bias
Description: A bias present in the real world is reflected in the computer's output.
Example: In Turkish, pronouns are gender-neutral. When translating from Turkish to English, a system might default to "he is a doctor" but "she is a nurse" for the same Turkish pronoun, reflecting societal gender stereotypes rather than linguistic neutrality.
2. π₯ Representation Bias
Description: Certain groups are underrepresented in the training data.
Example: While thousands of languages are used on social media, only a few major languages are well-represented in language tech tools. Most languages, including all signed languages, are poorly represented or entirely absent.
3. π Measurement Bias
Description: The features and labels in the training data do not accurately reflect the desired outcome.
Example: The Bible is often used as training data due to its availability in many languages. However, its formal, religious language style differs significantly from everyday conversation, leading to awkward or incorrect translations in tools like Google Translate.
4. π§© Aggregation Bias
Description: Combining data from diverse groups with different characteristics into a single system, which then performs poorly for some groups.
Example: If all varieties of English (e.g., Standardized English, African American English) are combined in training data for a speech-to-text program, the system might work better for Standardized English, creating a disadvantage for other varieties.
5. π Evaluation Bias
Description: Researchers measure program success based on metrics that are not truly useful to users.
Example: An English-centric focus might lead researchers to evaluate predictive text by how well it predicts the next word. However, for languages with longer words and more morphemes, predicting the next morpheme would be far more beneficial to users.
6. π¨ Deployment Bias
Description: A system created for reasonable purposes is misused after its release.
Example: Style analysis tools can identify authors of anonymous historical texts but can be misused to identify anonymous whistleblowers, posing ethical concerns.
π Addressing Bias
Recognizing these sources of bias is the crucial first step toward correcting them. Addressing these biases is an active area of research within computational linguistics. As developers and users of language technology, there is an ethical responsibility to consider the societal effects of these tools.

Ask anything
We've read this whole study set, so questions about it get the best answers.