Unstructured Data – Interdisciplinary Perspectives
Course 6
Building, Annotating & Sharing Text Corpora
Coverage · Human Annotation · Agreement · TEI / ISO · Corpora · FAIR
IIDT Master’s Programme · Faculty of Computer Science, UAIC Iași
What makes a collection a corpus?
CORPUS
A corpus is a deliberately defined dataset, not merely a directory of text files.
Analysing Unstructured Data · Interdisciplinary Perspectives
5
Purpose
A research question or intended analytical task.
Unit of analysis: document? utterance? token?
Selection
Inclusion and exclusion criteria.
Source, period, language, genre, population, rights.
Documentation
Stable IDs, metadata, provenance, versions, normalization and annotation rules.
Running example: the public-lighting corpus
CASE
Illustrative case — all counts and records in this lecture are hypothetical.
Analysing Unstructured Data · Interdisciplinary Perspectives
6
Research question
How do reported lighting problems vary across time and neighbourhoods of Iași?
Sources: web forms, e-mails, call-centre transcripts.
Period: 2021–2026.
Corpus specification
One record = one complaint, not one citizen.
Fields: stable ID, date, channel, neighbourhood, source reference, text, language.
Avoid storing unnecessary personal identifiers.
Coverage - what phenomena you want to identify?
COVERAGE
Its better not to cover too many unrelated details in the same corpora
Analysing Unstructured Data · Interdisciplinary Perspectives
8
Time
Year, season, weekday, before/after a service change.
Geography
Neighbourhoods, urban/rural, language regions.
Channel
App, web form, e-mail, telephone, paper.
People & genre
Who can complain? Formal/informal registers; language.
Content
Topics, lengths, duplicate reports, rare incidents.
Quality
OCR, ASR, missing metadata, inaccessible items.
Sampling and representativity - what do you select to include?
SAMPLING
Sampling is a methodological decision: specify selection probabilities when known.
Analysing Unstructured Data · Interdisciplinary Perspectives
10
Method
When useful
Main trade-off
Census of frame
All eligible records are attainable
Frame may omit important sources
Simple random
Estimate overall patterns from a frame
May miss small strata
Stratified
Guarantee coverage of key subgroups
Needs strata and design weights
Purposive
Seek rare or information-rich cases
Not probability-representative
Convenience
Pilot a workflow cheaply
Strong selection risks
Balanced corpora vs natural distributions
SAMPLING
Balance is useful for some evaluations; it can distort prevalence estimates.
Analysing Unstructured Data · Interdisciplinary Perspectives
11
Population-like source mix
75%
20%
Stratified research sample
40%
35%
25%
■ Web form ■ E-mail ■ Telephone
Granularity: where do annotations attach?
GRANULARITY
Changing the unit changes what a count, label, or “example” means.
Analysing Unstructured Data · Interdisciplinary Perspectives
13
01
Corpus
300 reports
02
Document
report #1042
03
Paragraph
problem description
04
Sentence
“The light is out.”
05
Token
light
06
Span / event
lighting-outage
Choose the unit from the research question
GRANULARITY
A stable unit definition comes before labeling or evaluation.
Analysing Unstructured Data · Interdisciplinary Perspectives
14
Question
Unit
Potential failure
Which topics recur by month?
Document / complaint
A complaint may mention multiple topics
Which places are mentioned?
Named-entity span
Many text mentions refer to same place
How many negative statements?
Sentence / clause
Negation and sarcasm cross boundaries
How many unresolved outages?
Event / linked records
Duplicates describe one incident
Who said what?
Turn / speaker segment
ASR segments may not reflect turns
Segmentation, normalization & stable offsets
GRANULARITY
Offsets become fragile when preprocessing changes the text.
Analysing Unstructured Data · Interdisciplinary Perspectives
15
A normalization choice
Original: “Str. Sărărie nr. 21”
Canonical: “Strada Sărărie numărul 21”
These strings have different lengths, so an offset anchored to the raw text will not point to the same characters after normalization.
Document the policy
Encoding and Unicode form (e.g. NFC).
Sentence and token boundaries.
Hyphens, punctuation, whitespace.
Whether offsets count bytes, code points, or UTF-16 units.
A separate immutable source text.
A tagset is a contract, not just a label list
TAGSETS
A good codebook specifies boundaries, exceptions and evidence requirements.
Analysing Unstructured Data · Interdisciplinary Perspectives
17
Definitions
Label name and exact meaning.
Positive and negative examples.
Permitted values and hierarchy.
Decisions
Which unit receives the label?
Can multiple labels apply?
How are uncertainty and missing data encoded?
Governance
Who changes a definition?
Version numbers and mappings.
An adjudication log for difficult cases.
Coarse and fine tagsets trade detail for reliability
TAGSETS
More labels do not necessarily produce more information.
Analysing Unstructured Data · Interdisciplinary Perspectives
18
Coarse: fast to apply
INFRASTRUCTURE
SAFETY
OTHER
Advantages: fewer ambiguities; easier pilot.
Limitation: “light broken” and “repair delayed” may collapse.
Fine: more analytical detail
LIGHTING_OUTAGE
REPAIR_DELAY
SAFETY_RISK
POWER_FAILURE
Advantages: targeted queries.
Limitation: more rare labels; lower consistency without clear rules.
Example: Universal Dependencies POS tags
TAGSETS
UD offers 17 universal POS categories; language-specific features add detail.
Analysing Unstructured Data · Interdisciplinary Perspectives
19
Token
Lemma
UPOS
Interpretation
Becul
bec
NOUN
noun, definite
stradal
stradal
ADJ
modifies the noun
nu
nu
PART
negation particle
funcționează
funcționa
VERB
finite verb
.
.
PUNCT
punctuation
Inline vs stand-off annotation
ANNOTATION
Separate layers support overlapping spans and independent annotation rounds.
Analysing Unstructured Data · Interdisciplinary Perspectives
21
Inline TEI / XML
<p>
<persName>John Ionescu</persName>
arrived in <placeName>Iași</placeName>.
</p>
Stand-off spans (schematic)
SOURCE: John Ionescu arrived in Iași.
PERSON → tokens 1–2
PLACE → token 5
EVENT → tokens 3–5
Each layer points to stable targets.
Annotation workflow: pilot → adjudicate → scale
ANNOTATION
Agreement measures a process; documentation helps another team reproduce it.
Analysing Unstructured Data · Interdisciplinary Perspectives
22
Draft tagset
→
Pilot 30 texts
→
Compare labels
→
Revise guide
→
Scale + audit
Before full annotation
Provide edge cases, negative examples, tokenization policy, precedence rules and an “uncertain” option.
During production
Double-annotate a sample; discuss disagreements; maintain versions and an adjudication register.
Manually annotated corpora: why people label text
MANUAL
A human-reviewed corpus is a documented interpretation—not a perfect oracle.
Analysing Unstructured Data · Interdisciplinary Perspectives
23
Human annotation
Annotators identify entities, topics, events or relations according to explicit guidelines.
Costly, but can capture contextual distinctions.
Automatic annotation
An NLP model suggests labels at scale.
Predictions are not automatically a reference standard.
Gold / reference set
Independent labels + review + adjudication become a stable evaluation reference.
Preserve earlier versions and uncertainty.
The annotation handbook: rules before labels
MANUAL
Do not ask annotators to guess what a tag means.
Analysing Unstructured Data · Interdisciplinary Perspectives
24
Rule
Good operational guidance
Example / counter-example
Scope
One label per complaint? multiple labels?
Lighting + safety may both apply
Unit
Exact span, sentence or whole complaint?
“Str. Sărărie” = location mention
Evidence
What observable wording supports a label?
“lamp is broken” → OUTAGE
Negative cases
What must NOT trigger the label?
“street feels unsafe” ≠ outage
Uncertainty
Use a distinct UNSURE and comments
Ambiguous incident, missing context
Manual annotation: a repeatable team workflow
MANUAL
Independent first passes must survive adjudication.
Analysing Unstructured Data · Interdisciplinary Perspectives
25
Design task
→
Train + pilot
→
Annotate twice
→
Measure IAA
→
Resolve / publish
Keep the evidence
Source version and exact text
Individual annotator IDs and labels
Guideline version and timestamps
Disagreement cases and review decisions
Design the audit sample
Double-label a shared, stratified subset.
Include difficult channels, rare labels and unclear source text.
Rotate annotator pairings if possible.
Agreement is task-specific: choose the unit first
IAA
A single percentage cannot summarize every annotation layer.
Analysing Unstructured Data · Interdisciplinary Perspectives
27
Observed agreement
Pₒ = number of equal labels / jointly labeled items.
Simple to explain, but ignores agreement expected by chance.
Chance-corrected
Cohen’s κ: 2 raters, fixed items, nominal labels.
Krippendorff’s α: more flexible designs and distance functions.
Structured annotations
Spans: exact / partial match, precision, recall, F1.
Relations: compare labeled edges after aligning mentions.
Cohen’s κ: a worked two-annotator example
IAA
Same raw agreement can hide very different label distributions.
Analysing Unstructured Data · Interdisciplinary Perspectives
28
Annotator A ↓ B →
B: OUTAGE
B: OTHER
A: OUTAGE
15
5
A: OTHER
3
17
Step by step
N = 40 jointly labeled items
Pₒ = (15 + 17) / 40 = 0.80
Pₑ = (.50 × .45) + (.50 × .55) = 0.50
κ = (Pₒ − Pₑ) / (1 − Pₑ)
κ = (0.80 − 0.50) / 0.50 = 0.60
When κ is not enough: boundaries and rare classes
IAA
Report the score, units, class prevalence and disagreement patterns.
Analysing Unstructured Data · Interdisciplinary Perspectives
29
Problem
Why headline κ may mislead
Better evidence to inspect
Rare labels
Most items may be OTHER; high raw agreement can occur by default
Per-class contingency and prevalence
Span boundaries
Annotators may select different character ranges
Exact / relaxed span F1; boundary errors
Multi-label items
One document can receive several valid tags
Per-label IAA + set-level overlap
Entity relations
Mention spans and edge targets may differ
Aligned nodes + relation-level F1
Missing judgments
Not all annotators label all items
Explicit missing-data rule; α if suitable
Disagreement analysis → better corpus quality
IAA
Do not adjudicate every mistake without fixing the underlying rule.
Analysing Unstructured Data · Interdisciplinary Perspectives
30
Guideline ambiguity
Boundary includes punctuation?
Fear = safety event?
Who can be a reporting agent?
Evidence ambiguity
OCR corrupted the name.
Audio transcript lost negation.
Message mentions a hypothetical event.
Operational drift
Annotators change decisions after feedback.
Tagset versions differ.
Rare labels go unreviewed.
Versioning, deduplication and data leakage
EVALUATION
A model may “generalize” only because the same incident occurs in train and test.
Analysing Unstructured Data · Interdisciplinary Perspectives
32
Version the corpus
Keep source snapshots, normalisation scripts, annotation schema and releases.
Corpus v1.0 is not v1.1.
Detect duplicates
Exact text, near duplicates, forwarded e-mails, repeated incident IDs.
Never assume each message is unique.
Split by group
Put all records for one incident/thread in one partition.
Consider time-held-out testing when forecasting.
Landmark corpora: Penn Treebank and OntoNotes
EXAMPLES
Prominent does not mean freely downloadable: check licence and access route.
Analysing Unstructured Data · Interdisciplinary Perspectives
34
Penn Treebank / Treebank-3
Foundational syntactic and POS annotated English corpora, including Wall Street Journal and conversational material.
LDC product: LDC99T42.
Licensed distribution.
OntoNotes Release 5.0
Multigenre, multilingual resource with syntax, word senses, semantic role and coreference layers.
LDC product: LDC2013T19.
Licensed distribution.
Significant annotated corpora: open examples
EXAMPLES
A reference corpus needs documentation, versioning and access rights—not just files.
Analysing Unstructured Data · Interdisciplinary Perspectives
33
GUM · Georgetown
Multilayer, multi-genre text; TEI, POS, syntax, NER, coreference, discourse.
Universal Dependencies
Multilingual dependency treebanks; manual and converted / corrected annotations.
RONEC · Romanian
Romanian named-entity corpus; 15 labels in v2.0, free research examples.
MASC · English
Manually produced or checked multilayer annotations in a 500k-word subset.
TEI P5: a corpus is a hierarchy with metadata
TEI
A corpus header and per-document headers answer different provenance questions.
Analysing Unstructured Data · Interdisciplinary Perspectives
35
teiCorpus
teiHeader · corpus-level scope, sampling, ownership, licences
TEI · document 1
teiHeader · local metadata
text / body · paragraphs, speech, etc.
TEI · document 2
teiHeader · local metadata
text / body · paragraphs, speech, etc.
TEI P5: a minimally documented text
TEI
A TEI XML document needs more than a <text> element to be useful.
Analysing Unstructured Data · Interdisciplinary Perspectives
36
<TEI xmlns="http://www.tei-c.org/ns/1.0">
<teiHeader><fileDesc>
<titleStmt><title>Report 1042</title></titleStmt>
<publicationStmt><p>Research access only</p></publicationStmt>
<sourceDesc><p>Municipal complaint record</p></sourceDesc>
</fileDesc></teiHeader>
<text><body><p>Becul stradal nu funcționează.</p></body></text>
</TEI>
Read the structure
TEI namespace
fileDesc = bibliographic description
text/body = content
Real projects add richer metadata
TEI header: describing texts so they can be reused
TEI
TEI metadata is both a catalogue record and a methodological statement.
Analysing Unstructured Data · Interdisciplinary Perspectives
37
Header component
Information it can document
For our complaint corpus
fileDesc
Title, responsible parties, source, publication
Source system, release and access
encodingDesc
Editorial and normalization decisions
OCR correction, tokenization policy
profileDesc
Language, participants, situation, text class
Romanian; channel; complaint type
revisionDesc
History of changes to the digital resource
Version, review, corrections
TEI stand-off and token IDs
TEI
Stand-off annotations must be validated for reference integrity.
Analysing Unstructured Data · Interdisciplinary Perspectives
38
<p>
<w xml:id="w1">John</w>
<w xml:id="w2">Ionescu</w>
<w xml:id="w3">arrived</w> in
<w xml:id="w4">Iași</w>.
</p>
<standOff><spanGrp type="entities">
<span from="#w1" to="#w2" ana="#PERSON"/>
<span from="#w4" to="#w4" ana="#PLACE"/>
</spanGrp></standOff>
Checks
Are xml:id values unique?
Do every from/to pointer resolve?
Are spans aligned to the correct text version?
TEI customization: XML syntax ≠ corpus semantics
TEI
Validate syntax, schema constraints and references—and still inspect meaning.
Analysing Unstructured Data · Interdisciplinary Perspectives
39
1 · Well-formed XML
Are tags nested correctly?
Are reserved characters escaped?
Is there exactly one root?
2 · TEI schema/profile
Which TEI elements are permitted?
ODD customization can generate a schema and documentation.
RELAX NG is common.
3 · Project assertions
Are IDs unique?
Do stand-off links resolve?
Do labels match the codebook?
Use additional XPath/Schematron or scripts.
Selected ISO language-resource standards
ISO
ISO models and TEI encoding solve related but not identical problems.
Analysing Unstructured Data · Interdisciplinary Perspectives
40
Standard
Scope
Practical use
General linguistic annotation framework
Interchange / stand-off annotation model
ISO 24614-1:2010
Written-text word segmentation principles
Define and document token units
ISO 24613-1:2024 · LMF
Core model for lexical resources
Represent lexicons linked to corpora
Note: ISO standards may require purchase; their public abstracts describe scope, not full specifications.
Annotation tools: select by task and workflow
TOOLS
A platform cannot substitute for an annotation protocol or a codebook.
Analysing Unstructured Data · Interdisciplinary Perspectives
42
INCEpTION
Multilayer annotations; recommenders, curation, entity linking.
doccano
Document classification, sequence labeling, text-to-text projects.
brat
Browser span, relation and event annotation; classic open-source tool.
Label Studio
Configurable labeling for text and other modalities; free Community edition.
Where do researchers find corpora? LDC and CLARIN VLO
DISCOVERY
A catalogue record may be discoverable even when data access is restricted.
Analysing Unstructured Data · Interdisciplinary Perspectives
43
LDC · Linguistic Data Consortium
Curated catalogue of notable NLP and speech resources.
Search by language, task, or catalogue ID.
Inspect licensing and member/non-member terms before use.
CLARIN · Virtual Language Observatory
Metadata discovery across language-resource repositories.
Filter by language, resource type and other facets; follow records to hosting repositories.
Access terms vary by resource.
Other corpus collections and access routes
DISCOVERY
Compare the annotation depth, licence, provenance and download format—not just size.
Analysing Unstructured Data · Interdisciplinary Perspectives
44
UD treebanks
Versioned multilingual dependency treebanks.
Annotated CoNLL-U files, documentation per treebank.
OPUS collections
Many parallel / comparable corpora for multilingual processing.
Source licences and alignment quality vary.
Hugging Face Datasets
Dataset discovery / hosting across tasks.
Always open the dataset card and confirm underlying rights.
Why linked data for corpora?
LINKED DATA
Analysing Unstructured Data · Interdisciplinary Perspectives
45
RDF: facts represented as triples
LINKED DATA
The predicate defines what is asserted, not merely which words co-occur.
Analysing Unstructured Data · Interdisciplinary Perspectives
46
Subject
<…/report/1042>
Predicate
ex:mentionsPlace
Object
<…/place/iasi>
@prefix ex: <https://example.org/vocab/> .
@prefix dct: <http://purl.org/dc/terms/> .
<https://example.org/report/1042>
ex:mentionsPlace <https://example.org/place/iasi> ;
dct:language "ro" .
JSON-LD: familiar JSON with linked meaning
LINKED DATA
The @context defines shared semantics; @id identifies the described resource.
Analysing Unstructured Data · Interdisciplinary Perspectives
47
{
"@context": {
"dct": "http://purl.org/dc/terms/",
"mentionsPlace": {
"@id": "https://example.org/vocab/mentionsPlace",
"@type": "@id"
}
},
"@id": "https://example.org/report/1042",
"dct:language": "ro",
"mentionsPlace": "https://example.org/place/iasi"
}
Observe
@context
Vocabulary map
@id
Resource identity
@type: @id
Treat link as an IRI
FAIR: four tests for research data stewardship
FAIR
FAIR = reusable by people and machines; it does not necessarily mean “open”.
Analysing Unstructured Data · Interdisciplinary Perspectives
49
F
Findable
Persistent ID, rich indexed metadata
A
Accessible
Standard retrieval; authentication if required
I
Interoperable
Shared vocabularies, standard structures
R
Reusable
Rights, provenance, quality and community conventions
Make FAIR operational for a text corpus
FAIR
A FAIR plan is testable: ask what an external researcher could actually do.
Analysing Unstructured Data · Interdisciplinary Perspectives
50
Principle
Corpus-level decision
Practical check
F · Findable
Deposit metadata with a persistent identifier
Can a search engine/catalogue locate it?
A · Accessible
Specify access and permissions
Can users discover access rules?
I · Interoperable
TEI/JSON-LD, vocabularies, codebook
Can another tool parse and interpret?
R · Reusable
Licence, provenance, method, limits
Can users assess suitability and rights?
Corpus release package: more than the XML
RELEASE
Document access restrictions at the same granularity as the released files.
Analysing Unstructured Data · Interdisciplinary Perspectives
51
corpus-v1.0/
README.md # scope and known limitations
metadata/ # catalogue and record-level metadata
source-restricted/ # raw files, managed access
texts/ # normalized TEI or JSONL
annotations/ # tagsets, stand-off layers
schemas/ # ODD / RNG / JSON Schema
methods/ # sampling + preprocessing logs
manifest-sha256.txt # file integrity
LICENSE-and-ACCESS.md # reuse / request conditions
Release checks
Stable IDs
Version number
Manifest + checksums
Access controls
Codebook
Known limitations
Citation instructions