Deterministic, zero-AI text-analysis signals shared across the document-structural-decomposition sharder family (ADR 0035): lexicon-based sentiment scoring and coarse heuristic part-of-speech-class proportions. Both are explicitly approximate, non-ML techniques -- not a substitute for a real tagger/classifier, just a cheap, local, fully deterministic signal a caller can disclose alongside structural counts without new model dependencies.
| Tier | foundation |
| Role | unclassified (baselined) |
| Path | crates/foundation/text-signals |
| Edition | 2021 |
| Targets | foundation_text_signals |
| Public items | 13 across 0 modules |
| Tests | 10 |
What it is for
Deterministic, zero-AI text-analysis signals shared across the document-structural-decomposition sharder family (ADR 0035): lexicon-based sentiment scoring and coarse heuristic part-of-speech proportions. Nothing here calls an AI, loads a model, or makes a network request -- both techniques are explicitly approximate, word-list/suffix-rule based, not a substitute for a real classifier or tagger. Callers disclose the resulting counts/scores, never the underlying text.
Capabilities
crate root
Deterministic, zero-AI text-analysis signals shared across the
| Item |
|---|
pub const LEADING_ARTICLES: & str; 3 |
fn strip_leading_article <'a>(words : & 'a & 'a str) -> & 'a & 'a str |
PosClass
Deterministic, zero-AI text-analysis signals shared across the
| Item |
|---|
pub enum PosClass |
fn classify_word_pos(word : & str) -> PosClass |
PosProportions
Deterministic, zero-AI text-analysis signals shared across the
| Item |
|---|
pub struct PosProportions |
PosProportions :: fn function_word_ratio(& self) -> f64 |
PosProportions :: fn verb_ratio(& self) -> f64 |
PosProportions :: fn noun_ratio(& self) -> f64 |
PosProportions :: fn adjective_ratio(& self) -> f64 |
PosProportions :: fn adverb_ratio(& self) -> f64 |
fn pos_class_proportions(text : & str) -> PosProportions |
SentimentSignal
Deterministic, zero-AI text-analysis signals shared across the
| Item |
|---|
pub struct SentimentSignal |
fn sentiment_score(text : & str) -> SentimentSignal |
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`
| Item | What it is |
|---|---|
pub const LEADING_ARTICLES: & str; 3 | A small closed set of English articles that legitimately start a sentence, capitalized only because they're sentence-initial, not because they're part of a proper name |
fn strip_leading_article <'a>(words : & 'a & 'a str) -> & 'a & 'a str | Only strips when 3+ words remain after stripping, so a genuine 2-word proper name that happens to start with an article ("The Hague") is left intact rather than reduced to a single, non-distinguishing word. |
pub struct SentimentSignal | Word-count-based sentiment signal for one piece of text |
fn sentiment_score(text : & str) -> SentimentSignal | Score text by counting lexicon hits |
pub enum PosClass | A collapsed, heuristic part-of-speech class |
fn classify_word_pos(word : & str) -> PosClass | Classify one word by a fixed closed-class list first, then suffix heuristics for open classes |
pub struct PosProportions | Per-class word counts and proportions (count / total) for text |
PosProportions :: fn function_word_ratio(& self) -> f64 | — |
PosProportions :: fn verb_ratio(& self) -> f64 | — |
PosProportions :: fn noun_ratio(& self) -> f64 | — |
PosProportions :: fn adjective_ratio(& self) -> f64 | — |
PosProportions :: fn adverb_ratio(& self) -> f64 | — |
fn pos_class_proportions(text : & str) -> PosProportions | Classify every word in text and tally counts per PosClass. |
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) |
| Location | crates/foundation/text-signals |
| Vocabulary in force (lexicon) | current |
Dependencies
Runtime, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
serde | ^1 | derive, derive | no | always |
Development. None.
Build. None.
Depended on by. 3 workspace crates.
Signal flow — what reaches this crate, and what it reaches.
flowchart LR n_domain_prose_shard["domain-prose-shard"] -->|uses| SELF n_domain_transcript_shard["domain-transcript-shard"] -->|uses| SELF n_foundation_text_deidentify["foundation-text-deidentify"] -->|uses| SELF SELF["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
| Kind | Name | Source |
|---|---|---|
| lib | foundation_text_signals | `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
| Property | Evidence |
|---|---|
| async public surface | none detected |
| async runtime | none detected |
| database access | none detected |
| network I/O | none detected |
| unsafe code | none detected |
| environment variables | none 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.
Related capabilities
3 workspace crates depend on this one: domain-prose-shard, domain-transcript-shard, foundation-text-deidentify.
Verification
| Kind | Count |
|---|---|
| Unit tests | 10 |
| Integration tests | 0 |
| Examples | 0 |
| Doctests | 0 |
Evidence by module. How often each public module is named by something executable.
| Module | Tests | Examples | Consumers |
|---|---|---|---|
crate root | 8 | 0 | 8 |
What the tests establish, by name:
pos_class_proportions_classifies_a_mixed_sentence—src/lib.rspos_class_proportions_ratios_are_zero_not_a_panic_on_empty_input—src/lib.rspos_class_proportions_recognizes_common_suffix_patterns—src/lib.rspos_class_proportions_treats_a_bare_number_as_other—src/lib.rssentiment_score_counts_hits_case_and_punctuation_insensitively—src/lib.rssentiment_score_is_zero_on_empty_input_not_a_panic—src/lib.rssentiment_score_sign_matches_the_dominant_lexicon—src/lib.rsstrip_leading_article_leaves_a_genuine_two_word_article_led_name_intact—src/lib.rsstrip_leading_article_leaves_non_article_leading_words_untouched—src/lib.rsstrip_leading_article_removes_a_leading_the_when_3plus_words_remain—src/lib.rs
Documentation coverage
| Measure | Documented | Total |
|---|---|---|
| Public items with rustdoc | 8 | 13 |
Public modules with a //! block | 0 | 0 |
pie showData
title Public items with rustdoc
"Documented" : 8
"No rustdoc detected" : 5
Metrics
| Metric | Value |
|---|---|
| Rust source files | 1 |
| Source lines | 393 |
| Code lines | 300 |
| Public API items | 13 |
| Public modules | 0 |
| Tests | 10 |
| Examples | 0 |
| Cargo features | 0 |
| Direct runtime dependencies | 1 |
| Workspace reverse dependencies | 3 |
pie showData
title Public API by kind
"constant" : 1
"enum" : 1
"function" : 4
"method" : 5
"struct" : 2
pie showData
title Rust source composition
"Code" : 300
"Blank or comment" : 93
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.