beyarkay commited on
Commit ·
0e20a2b
1
Parent(s): 1c339c2
Add cleanrs temp rust project
Browse files- cleanrs/Cargo.lock +543 -0
- cleanrs/Cargo.toml +12 -0
- cleanrs/after.txt +27 -0
- cleanrs/before.txt +50 -0
- cleanrs/dictionaries/frequency_bigramdictionary_en_243_342.txt +0 -0
- cleanrs/dictionaries/frequency_dictionary_en_82_765.txt +0 -0
- cleanrs/src/main.rs +232 -0
cleanrs/Cargo.lock
ADDED
|
@@ -0,0 +1,543 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is automatically @generated by Cargo.
|
| 2 |
+
# It is not intended for manual editing.
|
| 3 |
+
version = 4
|
| 4 |
+
|
| 5 |
+
[[package]]
|
| 6 |
+
name = "aho-corasick"
|
| 7 |
+
version = "1.1.3"
|
| 8 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 9 |
+
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
|
| 10 |
+
dependencies = [
|
| 11 |
+
"memchr",
|
| 12 |
+
]
|
| 13 |
+
|
| 14 |
+
[[package]]
|
| 15 |
+
name = "anstream"
|
| 16 |
+
version = "0.6.20"
|
| 17 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 18 |
+
checksum = "3ae563653d1938f79b1ab1b5e668c87c76a9930414574a6583a7b7e11a8e6192"
|
| 19 |
+
dependencies = [
|
| 20 |
+
"anstyle",
|
| 21 |
+
"anstyle-parse",
|
| 22 |
+
"anstyle-query",
|
| 23 |
+
"anstyle-wincon",
|
| 24 |
+
"colorchoice",
|
| 25 |
+
"is_terminal_polyfill",
|
| 26 |
+
"utf8parse",
|
| 27 |
+
]
|
| 28 |
+
|
| 29 |
+
[[package]]
|
| 30 |
+
name = "anstyle"
|
| 31 |
+
version = "1.0.11"
|
| 32 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 33 |
+
checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd"
|
| 34 |
+
|
| 35 |
+
[[package]]
|
| 36 |
+
name = "anstyle-parse"
|
| 37 |
+
version = "0.2.7"
|
| 38 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 39 |
+
checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2"
|
| 40 |
+
dependencies = [
|
| 41 |
+
"utf8parse",
|
| 42 |
+
]
|
| 43 |
+
|
| 44 |
+
[[package]]
|
| 45 |
+
name = "anstyle-query"
|
| 46 |
+
version = "1.1.4"
|
| 47 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 48 |
+
checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2"
|
| 49 |
+
dependencies = [
|
| 50 |
+
"windows-sys",
|
| 51 |
+
]
|
| 52 |
+
|
| 53 |
+
[[package]]
|
| 54 |
+
name = "anstyle-wincon"
|
| 55 |
+
version = "3.0.10"
|
| 56 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 57 |
+
checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a"
|
| 58 |
+
dependencies = [
|
| 59 |
+
"anstyle",
|
| 60 |
+
"once_cell_polyfill",
|
| 61 |
+
"windows-sys",
|
| 62 |
+
]
|
| 63 |
+
|
| 64 |
+
[[package]]
|
| 65 |
+
name = "bumpalo"
|
| 66 |
+
version = "3.19.0"
|
| 67 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 68 |
+
checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43"
|
| 69 |
+
|
| 70 |
+
[[package]]
|
| 71 |
+
name = "cfg-if"
|
| 72 |
+
version = "1.0.1"
|
| 73 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 74 |
+
checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268"
|
| 75 |
+
|
| 76 |
+
[[package]]
|
| 77 |
+
name = "clap"
|
| 78 |
+
version = "4.5.43"
|
| 79 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 80 |
+
checksum = "50fd97c9dc2399518aa331917ac6f274280ec5eb34e555dd291899745c48ec6f"
|
| 81 |
+
dependencies = [
|
| 82 |
+
"clap_builder",
|
| 83 |
+
"clap_derive",
|
| 84 |
+
]
|
| 85 |
+
|
| 86 |
+
[[package]]
|
| 87 |
+
name = "clap_builder"
|
| 88 |
+
version = "4.5.43"
|
| 89 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 90 |
+
checksum = "c35b5830294e1fa0462034af85cc95225a4cb07092c088c55bda3147cfcd8f65"
|
| 91 |
+
dependencies = [
|
| 92 |
+
"anstream",
|
| 93 |
+
"anstyle",
|
| 94 |
+
"clap_lex",
|
| 95 |
+
"strsim",
|
| 96 |
+
]
|
| 97 |
+
|
| 98 |
+
[[package]]
|
| 99 |
+
name = "clap_derive"
|
| 100 |
+
version = "4.5.41"
|
| 101 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 102 |
+
checksum = "ef4f52386a59ca4c860f7393bcf8abd8dfd91ecccc0f774635ff68e92eeef491"
|
| 103 |
+
dependencies = [
|
| 104 |
+
"heck",
|
| 105 |
+
"proc-macro2",
|
| 106 |
+
"quote",
|
| 107 |
+
"syn",
|
| 108 |
+
]
|
| 109 |
+
|
| 110 |
+
[[package]]
|
| 111 |
+
name = "clap_lex"
|
| 112 |
+
version = "0.7.5"
|
| 113 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 114 |
+
checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675"
|
| 115 |
+
|
| 116 |
+
[[package]]
|
| 117 |
+
name = "cleanrs"
|
| 118 |
+
version = "0.1.0"
|
| 119 |
+
dependencies = [
|
| 120 |
+
"clap",
|
| 121 |
+
"regex",
|
| 122 |
+
"symspell",
|
| 123 |
+
"unicode-general-category",
|
| 124 |
+
"unicode-segmentation",
|
| 125 |
+
]
|
| 126 |
+
|
| 127 |
+
[[package]]
|
| 128 |
+
name = "colorchoice"
|
| 129 |
+
version = "1.0.4"
|
| 130 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 131 |
+
checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"
|
| 132 |
+
|
| 133 |
+
[[package]]
|
| 134 |
+
name = "darling"
|
| 135 |
+
version = "0.20.11"
|
| 136 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 137 |
+
checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee"
|
| 138 |
+
dependencies = [
|
| 139 |
+
"darling_core",
|
| 140 |
+
"darling_macro",
|
| 141 |
+
]
|
| 142 |
+
|
| 143 |
+
[[package]]
|
| 144 |
+
name = "darling_core"
|
| 145 |
+
version = "0.20.11"
|
| 146 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 147 |
+
checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e"
|
| 148 |
+
dependencies = [
|
| 149 |
+
"fnv",
|
| 150 |
+
"ident_case",
|
| 151 |
+
"proc-macro2",
|
| 152 |
+
"quote",
|
| 153 |
+
"strsim",
|
| 154 |
+
"syn",
|
| 155 |
+
]
|
| 156 |
+
|
| 157 |
+
[[package]]
|
| 158 |
+
name = "darling_macro"
|
| 159 |
+
version = "0.20.11"
|
| 160 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 161 |
+
checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead"
|
| 162 |
+
dependencies = [
|
| 163 |
+
"darling_core",
|
| 164 |
+
"quote",
|
| 165 |
+
"syn",
|
| 166 |
+
]
|
| 167 |
+
|
| 168 |
+
[[package]]
|
| 169 |
+
name = "derive_builder"
|
| 170 |
+
version = "0.20.2"
|
| 171 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 172 |
+
checksum = "507dfb09ea8b7fa618fcf76e953f4f5e192547945816d5358edffe39f6f94947"
|
| 173 |
+
dependencies = [
|
| 174 |
+
"derive_builder_macro",
|
| 175 |
+
]
|
| 176 |
+
|
| 177 |
+
[[package]]
|
| 178 |
+
name = "derive_builder_core"
|
| 179 |
+
version = "0.20.2"
|
| 180 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 181 |
+
checksum = "2d5bcf7b024d6835cfb3d473887cd966994907effbe9227e8c8219824d06c4e8"
|
| 182 |
+
dependencies = [
|
| 183 |
+
"darling",
|
| 184 |
+
"proc-macro2",
|
| 185 |
+
"quote",
|
| 186 |
+
"syn",
|
| 187 |
+
]
|
| 188 |
+
|
| 189 |
+
[[package]]
|
| 190 |
+
name = "derive_builder_macro"
|
| 191 |
+
version = "0.20.2"
|
| 192 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 193 |
+
checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c"
|
| 194 |
+
dependencies = [
|
| 195 |
+
"derive_builder_core",
|
| 196 |
+
"syn",
|
| 197 |
+
]
|
| 198 |
+
|
| 199 |
+
[[package]]
|
| 200 |
+
name = "fnv"
|
| 201 |
+
version = "1.0.7"
|
| 202 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 203 |
+
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
| 204 |
+
|
| 205 |
+
[[package]]
|
| 206 |
+
name = "heck"
|
| 207 |
+
version = "0.5.0"
|
| 208 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 209 |
+
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
| 210 |
+
|
| 211 |
+
[[package]]
|
| 212 |
+
name = "ident_case"
|
| 213 |
+
version = "1.0.1"
|
| 214 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 215 |
+
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
|
| 216 |
+
|
| 217 |
+
[[package]]
|
| 218 |
+
name = "is_terminal_polyfill"
|
| 219 |
+
version = "1.70.1"
|
| 220 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 221 |
+
checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
|
| 222 |
+
|
| 223 |
+
[[package]]
|
| 224 |
+
name = "itoa"
|
| 225 |
+
version = "1.0.15"
|
| 226 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 227 |
+
checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
|
| 228 |
+
|
| 229 |
+
[[package]]
|
| 230 |
+
name = "log"
|
| 231 |
+
version = "0.4.27"
|
| 232 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 233 |
+
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
|
| 234 |
+
|
| 235 |
+
[[package]]
|
| 236 |
+
name = "memchr"
|
| 237 |
+
version = "2.7.5"
|
| 238 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 239 |
+
checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0"
|
| 240 |
+
|
| 241 |
+
[[package]]
|
| 242 |
+
name = "once_cell"
|
| 243 |
+
version = "1.21.3"
|
| 244 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 245 |
+
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
| 246 |
+
|
| 247 |
+
[[package]]
|
| 248 |
+
name = "once_cell_polyfill"
|
| 249 |
+
version = "1.70.1"
|
| 250 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 251 |
+
checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad"
|
| 252 |
+
|
| 253 |
+
[[package]]
|
| 254 |
+
name = "proc-macro2"
|
| 255 |
+
version = "1.0.95"
|
| 256 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 257 |
+
checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778"
|
| 258 |
+
dependencies = [
|
| 259 |
+
"unicode-ident",
|
| 260 |
+
]
|
| 261 |
+
|
| 262 |
+
[[package]]
|
| 263 |
+
name = "quote"
|
| 264 |
+
version = "1.0.40"
|
| 265 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 266 |
+
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
|
| 267 |
+
dependencies = [
|
| 268 |
+
"proc-macro2",
|
| 269 |
+
]
|
| 270 |
+
|
| 271 |
+
[[package]]
|
| 272 |
+
name = "regex"
|
| 273 |
+
version = "1.11.1"
|
| 274 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 275 |
+
checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
|
| 276 |
+
dependencies = [
|
| 277 |
+
"aho-corasick",
|
| 278 |
+
"memchr",
|
| 279 |
+
"regex-automata",
|
| 280 |
+
"regex-syntax",
|
| 281 |
+
]
|
| 282 |
+
|
| 283 |
+
[[package]]
|
| 284 |
+
name = "regex-automata"
|
| 285 |
+
version = "0.4.9"
|
| 286 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 287 |
+
checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
|
| 288 |
+
dependencies = [
|
| 289 |
+
"aho-corasick",
|
| 290 |
+
"memchr",
|
| 291 |
+
"regex-syntax",
|
| 292 |
+
]
|
| 293 |
+
|
| 294 |
+
[[package]]
|
| 295 |
+
name = "regex-syntax"
|
| 296 |
+
version = "0.8.5"
|
| 297 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 298 |
+
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
|
| 299 |
+
|
| 300 |
+
[[package]]
|
| 301 |
+
name = "rustversion"
|
| 302 |
+
version = "1.0.22"
|
| 303 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 304 |
+
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
|
| 305 |
+
|
| 306 |
+
[[package]]
|
| 307 |
+
name = "ryu"
|
| 308 |
+
version = "1.0.20"
|
| 309 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 310 |
+
checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
|
| 311 |
+
|
| 312 |
+
[[package]]
|
| 313 |
+
name = "serde"
|
| 314 |
+
version = "1.0.219"
|
| 315 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 316 |
+
checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6"
|
| 317 |
+
dependencies = [
|
| 318 |
+
"serde_derive",
|
| 319 |
+
]
|
| 320 |
+
|
| 321 |
+
[[package]]
|
| 322 |
+
name = "serde_derive"
|
| 323 |
+
version = "1.0.219"
|
| 324 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 325 |
+
checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00"
|
| 326 |
+
dependencies = [
|
| 327 |
+
"proc-macro2",
|
| 328 |
+
"quote",
|
| 329 |
+
"syn",
|
| 330 |
+
]
|
| 331 |
+
|
| 332 |
+
[[package]]
|
| 333 |
+
name = "serde_json"
|
| 334 |
+
version = "1.0.142"
|
| 335 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 336 |
+
checksum = "030fedb782600dcbd6f02d479bf0d817ac3bb40d644745b769d6a96bc3afc5a7"
|
| 337 |
+
dependencies = [
|
| 338 |
+
"itoa",
|
| 339 |
+
"memchr",
|
| 340 |
+
"ryu",
|
| 341 |
+
"serde",
|
| 342 |
+
]
|
| 343 |
+
|
| 344 |
+
[[package]]
|
| 345 |
+
name = "strsim"
|
| 346 |
+
version = "0.11.1"
|
| 347 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 348 |
+
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
| 349 |
+
|
| 350 |
+
[[package]]
|
| 351 |
+
name = "symspell"
|
| 352 |
+
version = "0.4.5"
|
| 353 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 354 |
+
checksum = "a0c8f69794fa4370d8fff17895350e56c8c803576a7ca782a5c6598d434a2646"
|
| 355 |
+
dependencies = [
|
| 356 |
+
"derive_builder",
|
| 357 |
+
"serde",
|
| 358 |
+
"serde_derive",
|
| 359 |
+
"strsim",
|
| 360 |
+
"unidecode",
|
| 361 |
+
"wasm-bindgen",
|
| 362 |
+
]
|
| 363 |
+
|
| 364 |
+
[[package]]
|
| 365 |
+
name = "syn"
|
| 366 |
+
version = "2.0.104"
|
| 367 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 368 |
+
checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40"
|
| 369 |
+
dependencies = [
|
| 370 |
+
"proc-macro2",
|
| 371 |
+
"quote",
|
| 372 |
+
"unicode-ident",
|
| 373 |
+
]
|
| 374 |
+
|
| 375 |
+
[[package]]
|
| 376 |
+
name = "unicode-general-category"
|
| 377 |
+
version = "0.6.0"
|
| 378 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 379 |
+
checksum = "2281c8c1d221438e373249e065ca4989c4c36952c211ff21a0ee91c44a3869e7"
|
| 380 |
+
|
| 381 |
+
[[package]]
|
| 382 |
+
name = "unicode-ident"
|
| 383 |
+
version = "1.0.18"
|
| 384 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 385 |
+
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
|
| 386 |
+
|
| 387 |
+
[[package]]
|
| 388 |
+
name = "unicode-segmentation"
|
| 389 |
+
version = "1.12.0"
|
| 390 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 391 |
+
checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493"
|
| 392 |
+
|
| 393 |
+
[[package]]
|
| 394 |
+
name = "unidecode"
|
| 395 |
+
version = "0.3.0"
|
| 396 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 397 |
+
checksum = "402bb19d8e03f1d1a7450e2bd613980869438e0666331be3e073089124aa1adc"
|
| 398 |
+
|
| 399 |
+
[[package]]
|
| 400 |
+
name = "utf8parse"
|
| 401 |
+
version = "0.2.2"
|
| 402 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 403 |
+
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
| 404 |
+
|
| 405 |
+
[[package]]
|
| 406 |
+
name = "wasm-bindgen"
|
| 407 |
+
version = "0.2.100"
|
| 408 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 409 |
+
checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5"
|
| 410 |
+
dependencies = [
|
| 411 |
+
"cfg-if",
|
| 412 |
+
"once_cell",
|
| 413 |
+
"rustversion",
|
| 414 |
+
"serde",
|
| 415 |
+
"serde_json",
|
| 416 |
+
"wasm-bindgen-macro",
|
| 417 |
+
]
|
| 418 |
+
|
| 419 |
+
[[package]]
|
| 420 |
+
name = "wasm-bindgen-backend"
|
| 421 |
+
version = "0.2.100"
|
| 422 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 423 |
+
checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6"
|
| 424 |
+
dependencies = [
|
| 425 |
+
"bumpalo",
|
| 426 |
+
"log",
|
| 427 |
+
"proc-macro2",
|
| 428 |
+
"quote",
|
| 429 |
+
"syn",
|
| 430 |
+
"wasm-bindgen-shared",
|
| 431 |
+
]
|
| 432 |
+
|
| 433 |
+
[[package]]
|
| 434 |
+
name = "wasm-bindgen-macro"
|
| 435 |
+
version = "0.2.100"
|
| 436 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 437 |
+
checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407"
|
| 438 |
+
dependencies = [
|
| 439 |
+
"quote",
|
| 440 |
+
"wasm-bindgen-macro-support",
|
| 441 |
+
]
|
| 442 |
+
|
| 443 |
+
[[package]]
|
| 444 |
+
name = "wasm-bindgen-macro-support"
|
| 445 |
+
version = "0.2.100"
|
| 446 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 447 |
+
checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de"
|
| 448 |
+
dependencies = [
|
| 449 |
+
"proc-macro2",
|
| 450 |
+
"quote",
|
| 451 |
+
"syn",
|
| 452 |
+
"wasm-bindgen-backend",
|
| 453 |
+
"wasm-bindgen-shared",
|
| 454 |
+
]
|
| 455 |
+
|
| 456 |
+
[[package]]
|
| 457 |
+
name = "wasm-bindgen-shared"
|
| 458 |
+
version = "0.2.100"
|
| 459 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 460 |
+
checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d"
|
| 461 |
+
dependencies = [
|
| 462 |
+
"unicode-ident",
|
| 463 |
+
]
|
| 464 |
+
|
| 465 |
+
[[package]]
|
| 466 |
+
name = "windows-link"
|
| 467 |
+
version = "0.1.3"
|
| 468 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 469 |
+
checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a"
|
| 470 |
+
|
| 471 |
+
[[package]]
|
| 472 |
+
name = "windows-sys"
|
| 473 |
+
version = "0.60.2"
|
| 474 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 475 |
+
checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb"
|
| 476 |
+
dependencies = [
|
| 477 |
+
"windows-targets",
|
| 478 |
+
]
|
| 479 |
+
|
| 480 |
+
[[package]]
|
| 481 |
+
name = "windows-targets"
|
| 482 |
+
version = "0.53.3"
|
| 483 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 484 |
+
checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91"
|
| 485 |
+
dependencies = [
|
| 486 |
+
"windows-link",
|
| 487 |
+
"windows_aarch64_gnullvm",
|
| 488 |
+
"windows_aarch64_msvc",
|
| 489 |
+
"windows_i686_gnu",
|
| 490 |
+
"windows_i686_gnullvm",
|
| 491 |
+
"windows_i686_msvc",
|
| 492 |
+
"windows_x86_64_gnu",
|
| 493 |
+
"windows_x86_64_gnullvm",
|
| 494 |
+
"windows_x86_64_msvc",
|
| 495 |
+
]
|
| 496 |
+
|
| 497 |
+
[[package]]
|
| 498 |
+
name = "windows_aarch64_gnullvm"
|
| 499 |
+
version = "0.53.0"
|
| 500 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 501 |
+
checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764"
|
| 502 |
+
|
| 503 |
+
[[package]]
|
| 504 |
+
name = "windows_aarch64_msvc"
|
| 505 |
+
version = "0.53.0"
|
| 506 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 507 |
+
checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c"
|
| 508 |
+
|
| 509 |
+
[[package]]
|
| 510 |
+
name = "windows_i686_gnu"
|
| 511 |
+
version = "0.53.0"
|
| 512 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 513 |
+
checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3"
|
| 514 |
+
|
| 515 |
+
[[package]]
|
| 516 |
+
name = "windows_i686_gnullvm"
|
| 517 |
+
version = "0.53.0"
|
| 518 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 519 |
+
checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11"
|
| 520 |
+
|
| 521 |
+
[[package]]
|
| 522 |
+
name = "windows_i686_msvc"
|
| 523 |
+
version = "0.53.0"
|
| 524 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 525 |
+
checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d"
|
| 526 |
+
|
| 527 |
+
[[package]]
|
| 528 |
+
name = "windows_x86_64_gnu"
|
| 529 |
+
version = "0.53.0"
|
| 530 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 531 |
+
checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba"
|
| 532 |
+
|
| 533 |
+
[[package]]
|
| 534 |
+
name = "windows_x86_64_gnullvm"
|
| 535 |
+
version = "0.53.0"
|
| 536 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 537 |
+
checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57"
|
| 538 |
+
|
| 539 |
+
[[package]]
|
| 540 |
+
name = "windows_x86_64_msvc"
|
| 541 |
+
version = "0.53.0"
|
| 542 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 543 |
+
checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486"
|
cleanrs/Cargo.toml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[package]
|
| 2 |
+
name = "cleanrs"
|
| 3 |
+
version = "0.1.0"
|
| 4 |
+
edition = "2024"
|
| 5 |
+
|
| 6 |
+
[dependencies]
|
| 7 |
+
clap = { version = "4", features = ["derive"] }
|
| 8 |
+
regex = "1"
|
| 9 |
+
unicode-segmentation = "1.10"
|
| 10 |
+
unicode-general-category = "0.6"
|
| 11 |
+
symspell = "0.4.5"
|
| 12 |
+
|
cleanrs/after.txt
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
footballs free to boys
|
| 2 |
+
we want every live active boy in new haven to get one of our footballs which may be had free by persuading their mothers to buy their suits and over coats here those mothers who have bought their boys suits here need no persuasion for they know that long eyes suits for boys are better made bet ter fitting and give better service for less money than any other clothing to be found in new haven
|
| 3 |
+
children overcoats
|
| 4 |
+
sizes of to of years
|
| 5 |
+
$2.50 to a of
|
| 6 |
+
boys overcoats
|
| 7 |
+
sizes a to of years
|
| 8 |
+
$3.50 to $15.00
|
| 9 |
+
boys overcoats
|
| 10 |
+
sizes of to of years
|
| 11 |
+
$7.50 to $25.00
|
| 12 |
+
a mrs julian heath of new work out a
|
| 13 |
+
who is organizing a house loss league for the protection of the house wife against unscrupulous and unsanitary storekeepers sixty five thous and women and housewives members
|
| 14 |
+
days permits a building
|
| 15 |
+
total $15,000
|
| 16 |
+
two $7,000 tenements planned tor ferry street
|
| 17 |
+
building inspector austin issued the following permits yesterday
|
| 18 |
+
to a la watkins a sony for two
|
| 19 |
+
$7,000 six family frame houses on
|
| 20 |
+
ferry street near clay re a
|
| 21 |
+
do also drew the plans and the owner will do the entire work
|
| 22 |
+
to ely rose sky for a frame barn at of stevens street to cost $250. in
|
| 23 |
+
heisman will do the work
|
| 24 |
+
to charles schmidt to move a frame house from of springs de avenue to austin near blake streets interior alterations will also be done the entire work to cost $500. mrs
|
| 25 |
+
brake will move the house a
|
| 26 |
+
tofu pm costa zoo for a frame addition to the house at a of greene street no sassy will do the work
|
| 27 |
+
these deeds were recorded yes
|
cleanrs/before.txt
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Footballs
|
| 2 |
+
FREE TO BOYS
|
| 3 |
+
We want every live, active boy in New Haven to
|
| 4 |
+
get one of our footballs which may be had free by
|
| 5 |
+
persuading their mothers to buy their suits and over
|
| 6 |
+
coats here. Those mothers who have bought their
|
| 7 |
+
boys’ suits here need no persuasion for they know
|
| 8 |
+
that Longley’s suits for boys are better made, bet
|
| 9 |
+
ter fitting and give better service for less money than
|
| 10 |
+
any other clothing to be found in New Haven.
|
| 11 |
+
Children’s Overcoats
|
| 12 |
+
Sizes 2% to 10 years
|
| 13 |
+
$2.50 to $10
|
| 14 |
+
BOYS’ OVERCOATS
|
| 15 |
+
Sizes 8 to 17 years
|
| 16 |
+
$3.50 to $15.00
|
| 17 |
+
BOYS’ OVERCOATS
|
| 18 |
+
Sizes 16 to 19 years.
|
| 19 |
+
$7.50 to $25.00
|
| 20 |
+
V Mrs. Julian Heath of New Tork olty |
|
| 21 |
+
Who Is organizing a Housewlvo’s lea
|
| 22 |
+
gue for the protection of the house
|
| 23 |
+
wife against unscrupulous and unsani
|
| 24 |
+
tary storekeepers. Slxty-flve thous
|
| 25 |
+
and women and housewives, members
|
| 26 |
+
DAY’S PERMITS
|
| 27 |
+
m BUILDING
|
| 28 |
+
TOTAL $15,000
|
| 29 |
+
Two $7,000 Tenements Planned
|
| 30 |
+
tor Ferry Street.
|
| 31 |
+
Building Inspector Austin Issued
|
| 32 |
+
the following permits yesterday:
|
| 33 |
+
To A. L. Watkins & Son, for two
|
| 34 |
+
$7,000 six-family frame houses on
|
| 35 |
+
Ferry street, near Clay. R. A.
|
| 36 |
+
D’Avlno drew the plans and the
|
| 37 |
+
owner will do the entire work.
|
| 38 |
+
To Ely Rosovsky, for a frame barn
|
| 39 |
+
at 46 Stevens street, to cost $250. I.
|
| 40 |
+
Weisman will do the work.
|
| 41 |
+
To Charles Schmidt to move a
|
| 42 |
+
frame house from 18 Springside ave
|
| 43 |
+
nue to Austin near Blake streets. In
|
| 44 |
+
terior alterations will also be done,
|
| 45 |
+
the entire work to cost $500. Mr.
|
| 46 |
+
Brake will move the house. ,
|
| 47 |
+
To F. P. Costanzo, for a frame ad
|
| 48 |
+
dition to the house at 100 Greene
|
| 49 |
+
street. N. Sasso will do the work.
|
| 50 |
+
These' deeds were recorded yes
|
cleanrs/dictionaries/frequency_bigramdictionary_en_243_342.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
cleanrs/dictionaries/frequency_dictionary_en_82_765.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
cleanrs/src/main.rs
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
use clap::Parser;
|
| 2 |
+
use regex::Regex;
|
| 3 |
+
use std::ffi::{OsStr, OsString};
|
| 4 |
+
use std::fs::File;
|
| 5 |
+
use std::io::{self, Read, Write};
|
| 6 |
+
use std::path::{Path, PathBuf};
|
| 7 |
+
use symspell;
|
| 8 |
+
use symspell::{AsciiStringStrategy, SymSpell, Verbosity};
|
| 9 |
+
use unicode_general_category::{GeneralCategory, get_general_category};
|
| 10 |
+
use unicode_segmentation::UnicodeSegmentation;
|
| 11 |
+
|
| 12 |
+
type AppResult<T> = Result<T, AppError>;
|
| 13 |
+
|
| 14 |
+
#[derive(Debug)]
|
| 15 |
+
enum AppError {
|
| 16 |
+
Io(std::io::Error),
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
impl std::fmt::Display for AppError {
|
| 20 |
+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
| 21 |
+
match self {
|
| 22 |
+
AppError::Io(e) => write!(f, "I/O error: {}", e),
|
| 23 |
+
}
|
| 24 |
+
}
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
impl std::error::Error for AppError {}
|
| 28 |
+
|
| 29 |
+
impl From<std::io::Error> for AppError {
|
| 30 |
+
fn from(e: std::io::Error) -> Self {
|
| 31 |
+
AppError::Io(e)
|
| 32 |
+
}
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
/// Clean a single text file from a path or stdin, writing the cleaned text to stdout.
|
| 36 |
+
/// If INPUT_PATH is omitted or "-", stdin is used.
|
| 37 |
+
#[derive(Parser, Debug)]
|
| 38 |
+
#[command(name = "clean-one", version, disable_help_subcommand = true)]
|
| 39 |
+
struct Cli {
|
| 40 |
+
/// Path to the input text file, or "-" for stdin. Omit to read from stdin.
|
| 41 |
+
#[arg(value_name = "INPUT_PATH")]
|
| 42 |
+
input_path: Option<PathBuf>,
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
fn main() {
|
| 46 |
+
let cli = Cli::parse();
|
| 47 |
+
if let Err(e) = run(cli) {
|
| 48 |
+
eprintln!("error: {}", e);
|
| 49 |
+
std::process::exit(1);
|
| 50 |
+
}
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
fn run(cli: Cli) -> AppResult<()> {
|
| 54 |
+
let input_spec = match cli.input_path.as_deref() {
|
| 55 |
+
None => InputSpec::Stdin,
|
| 56 |
+
Some(p) if matches!(p.as_os_str().to_str(), Some("-")) => InputSpec::Stdin,
|
| 57 |
+
Some(p) => InputSpec::File(p),
|
| 58 |
+
};
|
| 59 |
+
let raw = match input_spec {
|
| 60 |
+
InputSpec::Stdin => read_stdin_all()?,
|
| 61 |
+
InputSpec::File(p) => read_file_all(p.as_os_str())?,
|
| 62 |
+
};
|
| 63 |
+
let text = String::from_utf8_lossy(&raw).into_owned();
|
| 64 |
+
|
| 65 |
+
// let cleaned = unwrap_paragraph(&text, 3);
|
| 66 |
+
|
| 67 |
+
// let spell_corrected = correct_spelling(&cleaned);
|
| 68 |
+
|
| 69 |
+
let stats = get_stats(&text);
|
| 70 |
+
println!("{stats:?}");
|
| 71 |
+
|
| 72 |
+
write_all_stdout(text.as_bytes())?;
|
| 73 |
+
Ok(())
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
#[derive(Debug, Clone, Default)]
|
| 77 |
+
pub struct Stats {
|
| 78 |
+
// Size/length
|
| 79 |
+
pub num_bytes: u64,
|
| 80 |
+
pub num_chars: u64,
|
| 81 |
+
pub num_graphemes: u64,
|
| 82 |
+
pub num_lines: u64,
|
| 83 |
+
pub num_newlines: u64,
|
| 84 |
+
// Script-specific
|
| 85 |
+
pub hebrew_chars: u64,
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
pub fn get_stats(s: &str) -> Result<Stats, Box<dyn std::error::Error>> {
|
| 89 |
+
const HEBREW_BASIC_START: char = '\u{0590}';
|
| 90 |
+
const HEBREW_BASIC_END: char = '\u{05FF}';
|
| 91 |
+
const HEBREW_PRESENTATION_START: char = '\u{FB1D}';
|
| 92 |
+
const HEBREW_PRESENTATION_END: char = '\u{FB4F}';
|
| 93 |
+
|
| 94 |
+
let mut st = Stats::default();
|
| 95 |
+
|
| 96 |
+
// Size/length
|
| 97 |
+
st.num_bytes = s.len() as u64;
|
| 98 |
+
st.num_lines = s.lines().count() as u64;
|
| 99 |
+
st.num_newlines = s.as_bytes().iter().filter(|&&b| b == b'\n').count() as u64;
|
| 100 |
+
st.num_graphemes = UnicodeSegmentation::graphemes(s, true).count() as u64;
|
| 101 |
+
|
| 102 |
+
Ok(st)
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
fn shannon_entropy_bits_per_byte(bytes: &[u8]) -> f64 {
|
| 106 |
+
const ALPHABET: usize = 256;
|
| 107 |
+
if bytes.is_empty() {
|
| 108 |
+
return 0.0;
|
| 109 |
+
}
|
| 110 |
+
let mut freq = [0u64; ALPHABET];
|
| 111 |
+
for &b in bytes {
|
| 112 |
+
freq[b as usize] += 1;
|
| 113 |
+
}
|
| 114 |
+
let n = bytes.len() as f64;
|
| 115 |
+
let mut h = 0.0f64;
|
| 116 |
+
for &c in &freq {
|
| 117 |
+
if c == 0 {
|
| 118 |
+
continue;
|
| 119 |
+
}
|
| 120 |
+
let p = c as f64 / n;
|
| 121 |
+
// log2
|
| 122 |
+
h -= p * p.ln() / std::f64::consts::LN_2;
|
| 123 |
+
}
|
| 124 |
+
h
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
enum InputSpec<'a> {
|
| 128 |
+
Stdin,
|
| 129 |
+
File(&'a Path),
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
fn read_stdin_all() -> AppResult<Vec<u8>> {
|
| 133 |
+
let mut buf = Vec::new();
|
| 134 |
+
let mut stdin = io::stdin().lock();
|
| 135 |
+
stdin.read_to_end(&mut buf)?;
|
| 136 |
+
Ok(buf)
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
fn read_file_all(p: &OsStr) -> AppResult<Vec<u8>> {
|
| 140 |
+
let path = Path::new(p);
|
| 141 |
+
let mut buf = Vec::new();
|
| 142 |
+
let mut f = File::open(path)?;
|
| 143 |
+
f.read_to_end(&mut buf)?;
|
| 144 |
+
Ok(buf)
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
fn correct_spelling(s: &str) -> String {
|
| 148 |
+
let mut symspell: SymSpell<AsciiStringStrategy> = SymSpell::default();
|
| 149 |
+
|
| 150 |
+
symspell.load_bigram_dictionary(
|
| 151 |
+
"dictionaries/frequency_bigramdictionary_en_234_342.txt",
|
| 152 |
+
0,
|
| 153 |
+
1,
|
| 154 |
+
" ",
|
| 155 |
+
);
|
| 156 |
+
symspell.load_dictionary("dictionaries/frequency_dictionary_en_82_765.txt", 0, 1, " ");
|
| 157 |
+
|
| 158 |
+
s.split("\n")
|
| 159 |
+
.map(|paragraph| symspell.lookup_compound(paragraph, 2)[0].term.clone())
|
| 160 |
+
.reduce(|acc, e| format!("{acc}\n{e}"))
|
| 161 |
+
.unwrap()
|
| 162 |
+
|
| 163 |
+
// for paragraph in s.split("\n\n") {
|
| 164 |
+
// out.push_str(&symspell.lookup_compound(s, 2)[0].term.clone());
|
| 165 |
+
// out.push_str("\n\n")
|
| 166 |
+
// }
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
fn unwrap_paragraph(paragraph: &str, title_min_alpha: usize) -> String {
|
| 170 |
+
if paragraph.trim().is_empty() {
|
| 171 |
+
return paragraph.to_owned();
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
// Split into lines but keep content; we will optionally preserve the first line if it's a title.
|
| 175 |
+
let mut lines = paragraph.lines();
|
| 176 |
+
let first = lines.next().unwrap_or_default();
|
| 177 |
+
let rest = lines.collect::<Vec<_>>().join("\n");
|
| 178 |
+
|
| 179 |
+
// TODO this doesn't figure ot Mr.\nBlake, or M.J.\nWeissman
|
| 180 |
+
let re_dehyphen = Regex::new(r"(?m)\n([a-z])").unwrap();
|
| 181 |
+
// let re_newlines = Regex::new(r"\n+").unwrap();
|
| 182 |
+
|
| 183 |
+
// Process the "rest" chunk: dehyphenate, then collapse newlines to spaces.
|
| 184 |
+
let rest_processed = re_dehyphen.replace_all(&rest, " $1").into_owned();
|
| 185 |
+
|
| 186 |
+
if is_all_caps_title(first, title_min_alpha) && !rest_processed.is_empty() {
|
| 187 |
+
// Preserve the title on its own line.
|
| 188 |
+
let mut out = String::with_capacity(first.len() + 1 + rest_processed.len());
|
| 189 |
+
out.push_str(first);
|
| 190 |
+
out.push('\n');
|
| 191 |
+
out.push_str(&rest_processed);
|
| 192 |
+
out
|
| 193 |
+
} else if rest_processed.is_empty() {
|
| 194 |
+
first.to_owned()
|
| 195 |
+
} else {
|
| 196 |
+
// No title: join first line with the rest using a space/newline rule.
|
| 197 |
+
// Handle dehyphenation across the boundary too.
|
| 198 |
+
// If first ends with '-' and rest starts with lowercase, drop the hyphen and space.
|
| 199 |
+
let starts_lower = rest_processed
|
| 200 |
+
.chars()
|
| 201 |
+
.next()
|
| 202 |
+
.map(|c| c.is_ascii_lowercase())
|
| 203 |
+
.unwrap_or(false);
|
| 204 |
+
if first.ends_with('-') && starts_lower {
|
| 205 |
+
format!("{}{}", &first[..first.len() - 1], rest_processed)
|
| 206 |
+
} else {
|
| 207 |
+
format!("{} {}", first, rest_processed)
|
| 208 |
+
}
|
| 209 |
+
}
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
fn is_all_caps_title(s: &str, min_alpha: usize) -> bool {
|
| 213 |
+
let mut alpha_count = 0usize;
|
| 214 |
+
for ch in s.chars() {
|
| 215 |
+
if ch.is_ascii_lowercase() {
|
| 216 |
+
return false;
|
| 217 |
+
}
|
| 218 |
+
if ch.is_ascii_uppercase() {
|
| 219 |
+
alpha_count += 1;
|
| 220 |
+
}
|
| 221 |
+
}
|
| 222 |
+
alpha_count >= min_alpha
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
// ----- Output -----
|
| 226 |
+
|
| 227 |
+
fn write_all_stdout(bytes: &[u8]) -> AppResult<()> {
|
| 228 |
+
let mut stdout = io::stdout().lock();
|
| 229 |
+
stdout.write_all(bytes)?;
|
| 230 |
+
stdout.flush()?;
|
| 231 |
+
Ok(())
|
| 232 |
+
}
|