Skip to content

Add French pattern support, gated so English scoring is unchanged - #1

Open
GoldenSis wants to merge 1 commit into
seyedehsanhadi:mainfrom
GoldenSis:french-pattern-set
Open

Add French pattern support, gated so English scoring is unchanged#1
GoldenSis wants to merge 1 commit into
seyedehsanhadi:mainfrom
GoldenSis:french-pattern-set

Conversation

@GoldenSis

Copy link
Copy Markdown

The miss

CONTRIBUTING.md asks first for machine writing the detector misses. Here is one, reproducible:

Dans le paysage numérique en constante évolution d'aujourd'hui, il est important de noter que
notre solution ne se contente pas d'améliorer votre productivité, elle la révolutionne. Plongeons
ensemble dans cette riche tapisserie de possibilités pour libérer tout le potentiel de votre
entreprise. Que vous soyez une startup ou un grand groupe, cette expérience sans couture est
définitivement le changement de paradigme que vous attendiez. En conclusion, prêt à passer à la
vitesse supérieure ? N'hésitez pas à nous contacter. Meilleures salutations.

python scripts/detect.py scores that 1/100, clean. The same paragraph written in English
scores 69, heavy tells. Every tell in it is documented in the English catalogue — the words
are simply French.

Why a translation of the catalogue would not have fixed it

French machine prose is not English machine prose with French words. Two families carry most of the
signal and have no English original to translate from:

  • The calque — vocabulary rendered so literally that it is rare or wrong in native French:
    « une riche tapisserie », « sans couture », « un témoignage de ». A French writer does not
    reach for these; a model translating from English does.
  • The faux-ami — the French word that looks right to an English-trained model.
    « définitivement » is the cleanest case: it means permanently, not definitely, so
    « c'est définitivement le meilleur » is a translation error rather than emphasis. Same for
    adresser un problème (→ traiter), supporter (→ soutenir), délivrer de la valeur (→ fournir).

What this adds

Nine rules in references/patterns-fr.md, each with a worked Before and After, plus is_french()
in scripts/detect.py.

English behaviour is unchanged, and that is the design, not a hope. The French rules are appended
to simple only when is_french() says the document reads as French; otherwise the code takes
exactly the path it took before. Verified byte-identical output on this repository's own English
documents, and your 97 tests and 53 hook checks pass untouched.

The keys carry no catalogue number. The numbered series and its published totals — 71 patterns,
62 with a detector, 50 scoring — are claims about the English catalogue, quoted in README, SKILL,
ETHICS, plugin.json and marketplace.json. Renumbering from a French addition would rewrite all of
them, so these sit in their own namespace until you decide whether French belongs in the headline
count. test_machine_checked_count_is_honest therefore still asserts 62, unedited.

Measurement

Per CONTRIBUTING.md, a scored pattern may not fire more on human writing than on machine writing.
Measured across 59,733 words of human French — spoken-word transcripts and warm, colloquial
business correspondence:

hits per 10,000 words of human French
all nine rules 0.00

The limits of that, stated plainly. The corpus is narrow: dominated by one author's speech and
one team's correspondence, both informal, with no formal administrative French, no journalism and no
academic prose — exactly the registers where « il convient de souligner » and « n'hésitez pas à »
legitimately appear. fr_signposting and fr_cta are the two most likely to need demotion to
_SCORE_REPORT_ONLY
against a broader corpus. The machine-French side was author-constructed
rather than sampled, since no French AI corpus was available. Your private harness is the right
instrument for both; this arrives with its own measurement as CONTRIBUTING asks, not with a claim to
have replaced it.

Tests

tests/test_french.py, 12 checks:

  • French machine prose is reached, and scores above the nudge threshold
  • ordinary French speech and an ordinary French letter are left alone —
    « Cordialement », « bon week-end » and « j'espère que vous allez bien » are deliberately
    never matched
  • no French rule ever fires on English, checked against README, CONTRIBUTING and ETHICS
  • every documented Before trips its own rule and every After is clean, mirroring
    test_catalogue.py
  • no worked example names a real person or company
python -m pytest tests/ -q     # 109 passed (97 yours + 12 new)
bash tests/test_hooks.sh       # 53 passed
python scripts/check_docs.py   # 340 checks passed

Test-count references in README, CONTRIBUTING and CHANGELOG are updated so check_docs.py stays
honest; that is the only reason those files are touched.

Happy to change the shape

If you would rather have French as a separate module, behind a flag, folded into the numbered
catalogue, or not at all, say which and I will rework or close this. The measurement above stands on
its own either way, and the miss it documents is real whatever happens to this branch.

The English rules do not reach French. A French paragraph carrying every
documented tell scores 1/100 "clean" on the current set, because French
machine prose is not English machine prose with French words.

Two families have no English original to translate from:

  the calque   vocabulary rendered so literally it is rare or wrong in
               native French ("une riche tapisserie", "sans couture")
  the faux-ami the word that looks right to an English-trained model and
               means something else ("définitivement" is "permanently",
               not "definitely")

Nine rules cover them, in references/patterns-fr.md with a worked Before
and After each. They are appended to the simple list only when is_french()
says the document reads as French, so a document that is not French takes
exactly the path it took before. Verified byte-identical on this
repository's own English documents.

The keys carry no catalogue number. The numbered series and its published
totals are claims about the English catalogue, and renumbering it from a
French addition would rewrite those figures everywhere they are quoted.

Measured per CONTRIBUTING: zero hits for every rule across 59,733 words of
human French. That corpus is narrow and its limits are stated in the
catalogue; fr_signposting and fr_cta are the two most likely to need
demotion to _SCORE_REPORT_ONLY against a broader one.

tests/test_french.py adds 12 checks, including that every Before trips its
own rule, every After is clean, and no French rule ever fires on English.
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.

1 participant