1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//! 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());
//! ```
/// 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: & = WORDS;