foundation tier

foundation-text-deidentify

Structure-preserving text de-identification: swap detected multi-word name-like phrases for opaque Person-N placeholders, and swap content words (nouns/verbs/adjectives/adverbs, via foundation-text-signals' POS heuristic) for a deterministic synonym from a small hand-curated thesaurus, leaving function words and punctuation untouched. Preserves sentence length, punctuation, and paragraph structure ("the shape") for a downstream reader; does NOT provide the same disclosure guarantee as the opaque structural shards (table-shard/transcript-shard/prose-shard) -- rare/technical terms may have no listed synonym and stay literal, and structure plus partial vocabulary can sometimes allow real content to be inferred. Real obfuscation, not a proof of non-recoverability -- documented as such, not oversold.

Structure-preserving text de-identification: swap detected multi-word name-like phrases for opaque Person-N placeholders, and swap content words (nouns/verbs/adjectives/adverbs, via foundation-text-signals' POS heuristic) for a deterministic synonym from a small hand-curated thesaurus, leaving function words and punctuation untouched. Preserves sentence length, punctuation, and paragraph structure ("the shape") for a downstream reader; does NOT provide the same disclosure guarantee as the opaque structural shards (table-shard/transcript-shard/prose-shard) -- rare/technical terms may have no listed synonym and stay literal, and structure plus partial vocabulary can sometimes allow real content to be inferred. Real obfuscation, not a proof of non-recoverability -- documented as such, not oversold.

Tierfoundation
Roleunclassified (baselined)
Pathcrates/foundation/text-deidentify
Edition2021
Targetsdeidentify, foundation_text_deidentify
Public items3 across 0 modules
Tests16

What it is for

Structure-preserving text de-identification: swap detected name-like phrases for opaque Person N placeholders, and swap content words for a deterministic synonym from a small hand-curated thesaurus, leaving function words and punctuation untouched. The goal is a stand-in document with the same shape (sentence length, paragraph breaks, repeated-word/name patterns) as the real one, safe enough to use as a structural example for an outside model -- e.g. calibrating how it should handle a document of this shape, without ever showing it the real one.

This is NOT the same disclosure guarantee as the opaque structural shards (table-shard/transcript-shard/prose-shard), and this crate makes no claim otherwise. Those emit ONLY counts and types -- nothing recognizable as prose ever leaves them. This crate emits real prose, with real grammar and real sentence structure, and only the individual content words swapped:

vocabulary -- the exact words most likely to matter) is left literal, not masked, and this crate does not detect or warn about that case.

infer real content even where individual words were swapped.

detected at all -- see find_name_phrases.

Treat the output as "harder to skim, not provably safe" -- useful for a structural training/calibration example, not a substitute for the disclosure-minimized shard family when the real content must not leak.

Capabilities

crate root

Structure-preserving text de-identification: swap detected name-like

Item
fn find_name_phrases(text : & str) -> Vec <String>
fn synonym_for(word : & str) -> Option <& 'static str>
fn deidentify(text : & str) -> String

How to use it

No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.

Module structure

No public modules: the crate root is its whole surface.

Public surface

`crate root`

ItemWhat it is
fn find_name_phrases(text : & str) -> Vec <String>Find every distinct run of 2+ consecutive Title-Case words, in first-appearance order -- unlike domain_transcript_shard::detect_repeated_title_case_phrases, this does NOT require a repeat: a name mentioned exactly once still needs to be swapped
fn synonym_for(word : & str) -> Option <& 'static str>Deterministically pick a synonym for word (case-insensitive lookup): the same input word always yields the same synonym, so a document de-identified twice produces byte-identical output, and a word repeated in the source stays recognizably repeated in the output -- preserving that structural signal rather than scattering it randomly
fn deidentify(text : & str) -> StringDe-identify text: every detected name phrase becomes Person N (first-appearance order); every content word (Noun/Verb/Adjective/ Adverb per classify_word_pos) with a thesaurus entry becomes its deterministic synonym; everything else (function words, punctuation attached to a word, words with no thesaurus entry) is left as-is

No pub use re-exports: every item above is declared in this crate.

Boundary

Depends on no other workspace tier.

Shares tier foundation with 27 other crates: foundation-audit-log, foundation-basemodels, foundation-bounded-io, foundation-conversation-closure, foundation-crypto-sign, foundation-decisioning, foundation-encounter-vocabulary, foundation-fs-metadata, … (27 total).

_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._

Where it sits

Tier (ontology)foundation
Architectural role (taxonomy)unclassified (baselined)
Locationcrates/foundation/text-deidentify
Vocabulary in force (lexicon)current

Dependencies

Runtime, in this workspace.

CrateTierOptionalOnly on
`foundation-text-signals`foundationnoalways

Runtime, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
clap^4derivenoalways

Development, in this workspace.

CrateTierOptionalOnly on
`tools-cli-conformance`toolsnoalways

Build. None.

Depended on by. Nothing in this workspace.

Signal flow — what reaches this crate, and what it reaches.

flowchart LR
  SELF["foundation-text-deidentify"]
  SELF -->|development| n_tools_cli_conformance["tools-cli-conformance"]
  SELF -->|runtime| n_foundation_text_signals["foundation-text-signals"]
  classDef self fill:#1f883d,stroke:#1f883d,color:#fff;
  class SELF self;

Feature flags

No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.

Targets

KindNameSource
bindeidentify`src/main.rs`
libfoundation_text_deidentify`src/lib.rs`

Error model

No public error type was detected: no public item declares a type named *Error, and no public signature returns one.

Operational characteristics

PropertyEvidence
async public surfacenone detected
async runtimenone detected
database accessnone detected
network I/Onone detected
unsafe codenone detected
environment variablesnone detected

No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.

Configuration

No environment variable is read with a literal name anywhere in this crate. A variable whose key is computed at run time cannot be listed here, and is not claimed to be absent.

No workspace crate depends on this one.

Verification

KindCount
Unit tests16
Integration tests0
Examples0
Doctests0

Evidence by module. How often each public module is named by something executable.

ModuleTestsExamplesConsumers
crate root300

What the tests establish, by name:

Documentation coverage

MeasureDocumentedTotal
Public items with rustdoc33
Public modules with a //! block00
pie showData
    title Public items with rustdoc
    "Documented" : 3
    "No rustdoc detected" : 0

Metrics

MetricValue
Rust source files2
Source lines480
Code lines327
Public API items3
Public modules0
Tests16
Examples0
Cargo features0
Direct runtime dependencies2
Workspace reverse dependencies0
pie showData
    title Public API by kind
    "function" : 3
pie showData
    title Rust source composition
    "Code" : 327
    "Blank or comment" : 153

Generation

Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.

All foundation · Manual