dale-chall 0.1.1

static word-list data for the Dale-Chall readability formula
Documentation
//! List of easy American-English words: New Dale-Chall (1995).
//!
//! This crate ships one thing: the New Dale-Chall familiar-word list as a
//! sorted, deduplicated, lowercase slice of string literals. Readability tools
//! use the list to decide whether a word is familiar when scoring text. The
//! crate does not compute the Dale-Chall formula. It only provides the data.
//!
//! The list holds 2942 entries. Every entry is lowercase ASCII. Most are plain
//! letters. Nine words contain a hyphen and 47 contain a straight apostrophe
//! (`'`, U+0027). The slice is sorted ascending by byte order, which for this
//! all-ASCII data matches Unicode code-point order. A caller can check
//! membership with `DALE_CHALL.binary_search(&word).is_ok()`.
//!
//! Membership is exact and case sensitive. The data is already lowercase. The
//! crate does not fold case or trim input. Callers normalize query words before
//! a lookup.
//!
//! The crate is `#![no_std]`. The data lives in `core`, so embedded and kernel
//! callers can use it.
//!
//! # Examples
//!
//! ```
//! use dale_chall::DALE_CHALL;
//!
//! assert_eq!(DALE_CHALL.len(), 2942);
//! assert_eq!(DALE_CHALL[0], "a");
//! assert!(DALE_CHALL.binary_search(&"old-fashioned").is_ok());
//! assert!(DALE_CHALL.binary_search(&"xylophone").is_err());
//! ```

#![no_std]
#![forbid(unsafe_code)]
#![warn(missing_docs)]

mod words;

/// List of easy American-English words: New Dale-Chall (1995).
///
/// A sorted, deduplicated, lowercase slice of 2942 familiar words. The order is
/// ascending byte order, which equals Unicode code-point order here because
/// every entry is ASCII. The slice is `'static` and immutable.
///
/// The slice is sorted, so `binary_search` finds a word in `O(log n)`.
///
/// # Examples
///
/// ```
/// use dale_chall::DALE_CHALL;
///
/// assert_eq!(DALE_CHALL.first(), Some(&"a"));
/// assert_eq!(DALE_CHALL.last(), Some(&"youth"));
/// assert!(DALE_CHALL.binary_search(&"don't").is_ok());
/// assert!(DALE_CHALL.binary_search(&"Ache").is_err());
/// ```
pub const DALE_CHALL: &[&str] = words::WORDS;