Temporal parsing
Converting free-form date and time expressions into structured data.
Parsing human intent from unstructured text.
Research into temporal understanding, structured command extraction and natural language interfaces built specifically for Brazilian Portuguese.
Research areas
Converting free-form date and time expressions into structured data.
Grammar, slang and cultural context of Brazilian speech.
Detecting and encoding recurring patterns in natural language.
Classifying tasks, events, deadlines and notes from context.
Splitting and resolving multiple intents from a single input.
Published as an open library on GitHub under MIT license.
brazilian-temporal-parser investigates whether a rule-based natural language system can reliably transform free-form Brazilian Portuguese text into structured temporal objects — without relying on large language models or cloud inference.
Most temporal parsing libraries are built around English grammar and
calendar conventions. Brazilian Portuguese introduces distinct challenges:
relative anchors such as daqui a 2 semanas, fuzzy time
idioms such as depois do almoço, recurrence patterns such as
quinzenalmente, and list formats that share a single date
context across multiple items. This library is a first attempt at
addressing those challenges with deterministic, testable rule sets that
produce structured objects suitable for calendars, task managers
and scheduling applications.
The library is in active development. Core parsing is functional and the public API is usable, but coverage is incomplete and edge cases remain unhandled. Production use is at your own risk.
Date, time, and recurrence parsing are implemented and produce structured output for the majority of common Brazilian Portuguese patterns.
parseMultiple can split list-format inputs
and inherit a shared date context across all items in
a block.
Adversarial inputs and regional slang variations have not yet been systematically catalogued or benchmarked.
Method signatures and output shapes may change before 1.0 is reached.
The parser operates through a pipeline of pattern matchers applied sequentially to input text. Each matcher is responsible for a specific category of expression: explicit dates, relative anchors, weekday references, fuzzy times, and recurrence signals.
The explicit choice to avoid language model inference means the parser is fully deterministic, runs offline, has predictable latency, and produces no API costs. The tradeoff is that novel phrasings not covered by existing rules will fail silently or return low-confidence output.
Confidence scores are surfaced on every result so that callers can decide whether to accept, prompt for clarification, or fall back to a manual input path.
The library exposes three parsing modes. parseAuto
is the recommended entry point for most callers; it detects
whether the input contains a single expression or a multi-item
block and routes accordingly.
// Single expression — recommended
const result = BrazilianTemporalParser.parseAuto(
'Pagar fatura dia 15/12'
);
// → { type: 'task', title: 'Pagar fatura',
// startDate: '2025-12-15', confidence: 0.9 }
// Explicit single parse
const event = BrazilianTemporalParser.parse(
'Reunião amanhã às 14h'
);
// → { title: 'Reunião', type: 'event',
// startDate: '2025-11-28', startTime: '14:00',
// confidence: 0.95 }
// Multi-task extraction
const multi = BrazilianTemporalParser.parseMultiple(`
SEGUNDA-FEIRA:
- Academia
- Estudar Inglês
- Comprar pão
`);
// → { hasMultipleTasks: true,
// items: [ … ] }
Installation requires npm install brazilian-temporal-parser date-fns.
The library is written in TypeScript and ships type definitions.
The current rule set addresses the most common patterns in Brazilian scheduling language. Each category is implemented with its own matcher and contributes to the final structured output.
hoje, amanhã, depois de amanhã,
daqui a N dias / semanas / meses resolve against
the current date at parse time.
próxima segunda, essa sexta, and
bare weekday names resolve to the nearest occurrence
in the appropriate direction.
15/12, 15/12/2025 and written-out forms
such as 15 de dezembro are parsed with
year inference for partial inputs.
Exact times (14h30, 14:30), fuzzy
anchors (depois do almoço, final da tarde,
à noite), and time ranges are recognized.
toda sexta, quinzenalmente,
a cada 3 dias, mensalmente and
similar forms produce a structured recurrence descriptor.
Output type is inferred from context keywords:
tarefa, reunião, prazo,
lembrete influence whether the result is
classified as a task, event, deadline or note.
Coverage for informal contractions, regional dialects and voice-to-text artifacts is not yet systematic.
Temporal parsing in natural language remains a hard problem because language is ambiguous and usage evolves. Several questions remain open in this research.
Inputs such as na próxima semana, terça e quinta
require tracking that the weekdays inherit the
“next week” anchor from the preceding clause.
This is not yet handled reliably across all forms.
The confidence score is currently heuristic. No empirical calibration against a labelled corpus has been performed to verify that a score of 0.9 actually correlates with 90% precision.
Transcription errors and filler words common in spoken Brazilian Portuguese are not currently normalized before parsing.
Expressions such as não vai mais ter reunião sexta
or cancela o compromisso de amanhã require
negative intent detection that is not yet implemented.
This library is an alpha research artifact. No claim of production reliability or complete coverage is made.
parseMultiple with list context inheritance.