Skip to content

Brazilian to European Portuguese v1.9.0: reference-guided idioms, possession and recipients - #365

Merged
niksedk merged 3 commits into
SubtitleEdit:mainfrom
SMAP-git:ptpt-v1.9.0-idioms-possession-recipients
Nov 16, 2026
Merged

niksedk merged 3 commits into
SubtitleEdit:mainfrom
SMAP-git:ptpt-v1.9.0-idioms-possession-recipients

Conversation

@SMAP-git

Copy link
Copy Markdown
Contributor

Updates the SE5 Brazilian to European Portuguese plugin to v1.9.0 with new reference-guided conversion rules. All rules are general to any PT-BR subtitle, respect existing options, disabled stages, ignored words and custom vocabulary, and work across ordinary LF/CRLF line wraps without crossing blank lines or speaker dashes.

New conversions

  • Reference-confirmed idioms with literal readings protected: está jogando verde → está à pesca, pegou a isca → mordeu o isco, não soma → não bate certo, uma xícara de Joe → uma chávena de café.
  • Police places with English evidence: esquadrão/distrito policial → esquadra, sala do esquadrão → sala da esquadra; adjectival policial and military squads stay.
  • Ongoing actions confirmed by the reference use estar a: Ele mente next to He's lying → Ele está a mentir.
  • Revenge and replies: revidar → vingar-se with the agreeing clitic (including mesoclisis), or responder for verbal retorts; retrucar → responder.
  • Prank senses: trote → brincadeira, telephone trote → chamada de brincadeira, trote estudantil → praxe académica, passar um trote → pregar uma partida; horse gaits untouched.
  • Pronominal forgetting: Esqueceu seu café → Esqueceste-te do teu café, with esquecer-se de complements.
  • Hypothetical comparisons restore como se with imperfect-subjunctive verbs, recovering the dropped subject and object pronoun when the English like/as if/as though clause confirms them: Como divertisse você? → Como se eu te divertisse? (Ciberdúvidas).
  • Inalienable possession prefers the dative clitic or bare article with body parts and personal effects: Ele pisou no meu rosto com a sua bota → Ele pisou-me o rosto com a bota, Feri o meu braço → Feri o braço (Ciberdúvidas).
  • Telling recipients: e contou sobre isso next to and told her about it → e contou-lhe sobre isso, across contar, dizer, falar, explicar, mostrar, perguntar, mentir, prometer, avisar, escrever.
  • A reference-confirmed you subject now also reaches sentences opening with Não,/Sim, before a connective: Não, mas não pensou → Não, mas não pensaste.
  • Contextual complements: recent explicit arrival referents in admission commands and missing que before finite complements of parecer.
  • Reviewed transport and mechanics conversion table (95 entries) for cars, motorcycles, bicycles, engines and boats, with ambiguous financial, anatomical and nautical senses protected.

Validation

  • Full test suite: 6,354 passed (13 optional model-dependent tests skipped), including exhaustive LF/CRLF word-boundary wrapping tests and cue-timing preservation tests for every new rule.
  • Optional real MiniLM alignment tests verified for the new reference-dependent rules.
  • Both the English and PT-PT guides document the new rules with sources.

…session and recipients

Reference-confirmed fishing and literal idioms, police-place vocabulary,
ongoing actions with estar a, revenge and reply senses, prank senses,
pronominal forgetting, como se hypothetical comparisons, inalienable
possession with dative clitics and bare articles, telling-verb recipients,
reference second person after initial Não, arrival referents, parecer que
complements and a reviewed transport and mechanics conversion table.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Several rules produce incorrect Portuguese by crossing blank-line boundaries, duplicating or misassigning clitics, inserting spurious “que”, and changing temporal meaning.

7 open issues
What changed in this PR

Updates the SE5 Brazilian-to-European Portuguese plugin to v1.9.0, expanding reference-guided subtitle conversions, contextual grammar rules, and technical vocabulary.

Changes:

  • Adds reference-assisted idioms, recipient recovery, possession handling, and contextual complements.
  • Expands transport vocabulary and pronoun handling, with regression coverage for wrapping, options, and cue preservation.
  • Updates bilingual documentation, packaged resources, and settings-panel layout.
File Description
se5/​BrazilianToEuropeanPortuguese/​TransportVocabulary.pt-PT.md Documents transport terminology and safeguards.
se5/​BrazilianToEuropeanPortuguese/​TransportVocabulary.cs Adds vehicle-qualified jump-start conversions.
se5/​BrazilianToEuropeanPortuguese/​SubtitleConversion.cs Integrates contextual hints and referent-review notes.
se5/​BrazilianToEuropeanPortuguese/​ReviewedDialogue.cs Adds reference-guided dialogue and recipient rules.
se5/​BrazilianToEuropeanPortuguese/​ReferenceSubtitle.cs Extends contextual hints and idiom alignment.
se5/​BrazilianToEuropeanPortuguese/​README.pt-PT.md Updates the Portuguese guide and examples.
se5/​BrazilianToEuropeanPortuguese/​README.md Updates the English guide and examples.
se5/​BrazilianToEuropeanPortuguese/​PortugueseWordList.xml Adds transport and prank vocabulary.
se5/​BrazilianToEuropeanPortuguese/​PortugueseVerbs.cs Expands verb recognition and clitic support.
se5/​BrazilianToEuropeanPortuguese/​plugin.json Advances the plugin version to 1.9.0.
se5/​BrazilianToEuropeanPortuguese/​MaybeSubjunctive.cs Extends subjunctive complements and supported subjects.
se5/​BrazilianToEuropeanPortuguese/​MainWindow.axaml.cs Adjusts responsive settings-panel height.
se5/​BrazilianToEuropeanPortuguese/​MainWindow.axaml Refines settings-column width and scrolling space.
se5/​BrazilianToEuropeanPortuguese/​LocalChecks.cs Uses original Portuguese to disambiguate idiom meanings.
se5/​BrazilianToEuropeanPortuguese/​ContextualComplements.cs Adds missing conjunction and arrival-object recovery.
se5/​BrazilianToEuropeanPortuguese/​BrazilianToEuropeanPortuguese.csproj Packages the transport guide and preview image.
se5/​BrazilianToEuropeanPortuguese/​AutomaticGrammar.cs Extends noun-based determiner agreement.
se5/​BrazilianToEuropeanPortuguese/​AttractedEnclisis.cs Extends clitic placement and CRLF handling.
se5/​BrazilianToEuropeanPortuguese.Tests/​TransportVocabularyTests.cs Tests transport conversions and local overrides.
se5/​BrazilianToEuropeanPortuguese.Tests/​TemporalCliticTests.cs Tests clitics after temporal adverbs.
se5/​BrazilianToEuropeanPortuguese.Tests/​SeeingObjectTests.cs Tests reference-confirmed missing objects.
se5/​BrazilianToEuropeanPortuguese.Tests/​ReviewedEpisodeDialogueTests.cs Covers dialogue conversions and protected meanings.
se5/​BrazilianToEuropeanPortuguese.Tests/​ReferenceTests.cs Adds alignment, optional model, and layout coverage.
se5/​BrazilianToEuropeanPortuguese.Tests/​PorFamilyCliticTests.cs Tests irregular pôr-family clitic placement.
se5/​BrazilianToEuropeanPortuguese.Tests/​PersonalObjectTests.cs Updates formal-object expectations.
se5/​BrazilianToEuropeanPortuguese.Tests/​LocalChecksTests.cs Tests Portuguese-guided fishing disambiguation.
se5/​BrazilianToEuropeanPortuguese.Tests/​InterrogationAgreementTests.cs Covers esperar complements and plural subjects.
se5/​BrazilianToEuropeanPortuguese.Tests/​FormalPersonalObjectTests.cs Tests formal objects, gender, and placement.
se5/​BrazilianToEuropeanPortuguese.Tests/​ExplanationTests.cs Updates the inalienable-possession expectation.
se5/​BrazilianToEuropeanPortuguese.Tests/​EnglishExpressionTests.cs Tests idiom meanings, conversions, and safeguards.
se5/​BrazilianToEuropeanPortuguese.Tests/​EmphaticAndPolicyDialogueTests.cs Covers emphatic questions and contextual paraphrases.
se5/​BrazilianToEuropeanPortuguese.Tests/​DurationAndWrappingTests.cs Tests duration phrasing and LF/CRLF boundaries.
se5/​BrazilianToEuropeanPortuguese.Tests/​CorpusConstructionTests.cs Adds coverage for reference-guided constructions.
se5/​BrazilianToEuropeanPortuguese.Tests/​ConverterTests.cs Updates forgetting, imperative, and clitic expectations.
se5/​BrazilianToEuropeanPortuguese.Tests/​ContextualComplementsTests.cs Tests complement recovery and arrival referents.
se5/​BrazilianToEuropeanPortuguese.Tests/​ConstructionTests.cs Removes an obsolete unchanged-forgetting expectation.
se5/​BrazilianToEuropeanPortuguese.Tests/​BigCompareObjectTests.cs Updates pronominal forgetting and possession expectations.

Review effort: Balanced

@"(?<![\p{L}\p{M}-])(?<negative>não|nunca|jamais)(?<gap>\s+)(?<aux>vou|vais|vai|vamos|vão|ia|ias|íamos|iam)" +
@"(?:-(?<cl>me|te|se|nos|vos|lhe|lhes))?(?<space>\s+)(?<inf>[\p{L}\p{M}]+)" +
@"(?:-(?<cl>me|te|se|nos|vos|lhe|lhes))?(?![\p{L}\p{M}-])",
m => m.Groups["cl"].Captures.Count != 1 || !PortugueseConverter.TuImperative.IsInfinitive(m.Groups["inf"].Value) ? m.Value :

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e01d7c6: the negative clitic-climbing replacement now rejects matches whose span contains a blank line or a speaker dash, while single LF/CRLF wraps keep working (covered by new NegativeIrPlacementIsConsistent cases).

private const string PlainSubject = @"(?:ele|ela|eles|elas|eu|tu|nós|vós|você|vocês)";
private const string Subject = @"(?:" + PlainSubject +
@"|(?:o|a|os|as|um|uma|uns|umas)\s+(?!que\b)" + Word +
@"(?:\s+(?!(?:que|não|nunca|já|também|se|me|te|nos|lhe|lhes|e|ou|mas)\b)" + Word + @"){0,5})";

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e01d7c6: the nominal-subject pattern now stops at subordinate-clause markers and prepositions (quando/como/onde/porque/enquanto/embora/caso/quem/cujo/com/sem/de/em/para/por/sobre/contra/até/desde/durante), so "Parece a minha mãe quando era jovem." and "Parece o homem com quem ela falou." stay unchanged (new protection tests).

if (!tail.Success) continue;
var finite = Regex.Matches(tail.Value, Word).Cast<Match>().Skip(1).FirstOrDefault(w =>
{
if (!Finite(w.Value) || blocked(w.Value)) return false;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e01d7c6: the full span from parecer to the proposed finite verb is now rejected when it contains a blank line or speaker dash, so "Parece\n\nela chegou." stays unchanged while ordinary wraps still receive que.

var map = new Dictionary<string, (string, Regex)>(StringComparer.OrdinalIgnoreCase);
foreach (var (infinitive, english) in TellingVerbs)
{
var regex = new Regex(@"\b" + english + @"\s+(?<obj>me|you|him|her|us|them)\b", Ci);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e01d7c6: "her" only counts as a recipient when it ends the phrase or is followed by the telling content (about/that/everything/articles/pronouns/etc.), so "He told her parents about it." no longer produces contou-lhe (new protection test).

}

private static readonly Regex TellingRecipient = new(
Before + @"(?<!(?<![\p{L}\p{M}])(?:me|te|se|nos|vos|lhe|lhes)\s)(?<v>" +

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e01d7c6: the existing-proclitic lookbehind now accepts any whitespace run (\s+), so "Ele nos\r\ncontou sobre isso." and multiple spaces no longer produce a duplicated clitic (new protection tests).

if (Regex.IsMatch(english, @"\bit(?:'s|\s+has|\s+had)\s+(?:only\s+|just\s+)?been\s+(?:only\s+|just\s+)?(?:a|an|a\s+few|some|\d+)\s+(?:seconds?|minutes?|hours?|days?|weeks?|months?|years?)\b", Ci) &&
!blocked("fazer") && !blocked("passar"))
text = Regex.Replace(text,
@"(?<head>^|[,;.!?]\s+|\bmas\s+)(?<only>(?:(?:só|apenas|somente)\s+)?)(?<verb>faz|fazia|há|havia)\s+" +

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e01d7c6: the elapsed-time rewrite now requires a standalone predicate (sentence end or desde), so the temporal adjunct "Há alguns anos, ele vivia aqui." is preserved while "Faz uma hora." → "Passou uma hora." still works (new protection test).


internal static string Apply(string text, Func<string, bool> blocked) => JumpStart.Replace(text, m =>
{
var verb = m.Groups["verb"].Value;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e01d7c6: jump-start matches containing a blank line or speaker dash are rejected, so "Deu uma chupeta\n\nno carro." keeps the plain vocabulary conversion while single LF/CRLF wraps still convert (new protection tests).

SMAP-git and others added 2 commits November 13, 2026 12:40
…d temporal adjuncts

Blank-line and speaker boundaries now stop negative clitic climbing,
parecer que insertion and vehicle jump-start matches. Parecer subjects
stop at subordinate-clause markers and prepositions. Telling recipients
reject possessive her before a noun phrase and recognise existing
proclitics across any whitespace. Elapsed-time rewrites only apply to
standalone predicates, preserving time-ago adjuncts.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…estions

Reference-confirmed unnoticed escapes (algo passou por mim → algo me
escapou), colloquial failures (vacilar → falhar/hesitar, dar mancada and
pisar na bola → fazer asneira), echo-question commas (O que queres dizer,
nada?), contracted-negative wh-questions (Porque não acabas o que
começaste?), telling recipients after initial Não, and reference-aware
spreadsheet fixes. Inalienable possession now drops possessives only with
the dative clitic, keeps second-person teu/tua and rewrites English-
confirmed his/her seu/sua as dele/dela. Sentence starts, free relatives
and merged por que are CRLF-safe.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@SMAP-git

Copy link
Copy Markdown
Contributor Author

Pushed baf0d5e with further corpus-driven improvements and refinements:

  • Unnoticed escapes: não é a primeira vez que algo passou por mim next to something got past me → …que algo me escapou, with person-matched clitics, proclisis after attractors and future mesoclisis; literal walking past is protected (overlooked-escape).
  • Colloquial failures: vacilar → falhar with English fail evidence (messed up, screwed up, blew it…) or hesitar with hesitation evidence; sem vacilar → sem hesitar; dar mancada and pisar na bola → fazer asneira (literal balls protected) (failure-vocabulary).
  • Echo-question commas: O que quer dizer nada? next to What do you mean, nothing? → O que queres dizer, nada? — without the comma the question asks what “nothing” means (echo-question-comma).
  • Wh-questions with contracted negatives: Por que não acaba o que começou aqui? next to Why don't you finish what you started here? → Porque não acabas o que começaste aqui?; questions about things keep the third person.
  • Inalienable possession refined: the possessive now drops only together with the dative clitic (pisou-me o rosto); the subject's own possessive stays (Toquei na minha cara); second-person possessives always survive for the address rules (na tua mala mágica); and an English-confirmed third-person seu/sua becomes the unambiguous owner phrase dele/dela (com a sua bota → com a bota dele).
  • CRLF robustness: the shared sentence-start anchor no longer treats \r\n as a sentence boundary, free-relative guards are backtracking-safe, and a merged por que at the start of a cue re-wraps without an empty first line.

Full suite: 6,424 passed, 0 failed, including exhaustive LF/CRLF word-boundary wrapping and cue-timing preservation tests; all changed behaviors verified against real aligned cues. Both guides document the new rules.

@niksedk
niksedk merged commit 1011c83 into SubtitleEdit:main Nov 16, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants