Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hs-cn/simple-word-count
a simple word count function, try to get same result with Microsoft Office Word application.
https://github.com/hs-cn/simple-word-count
word-count word-counter
Last synced: about 2 months ago
JSON representation
a simple word count function, try to get same result with Microsoft Office Word application.
- Host: GitHub
- URL: https://github.com/hs-cn/simple-word-count
- Owner: hs-CN
- License: mit
- Created: 2024-03-02T19:10:31.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2024-09-19T02:38:04.000Z (4 months ago)
- Last Synced: 2024-11-13T09:05:57.064Z (about 2 months ago)
- Topics: word-count, word-counter
- Language: TypeScript
- Homepage:
- Size: 4.17 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Description
a simple word count function, try to get same result with Microsoft Office Word application.
**Not guarantee** same result on special characters. Such like Emoji βππ¦πβ is count `1` in Microsoft Office Word, but `3` by word_count.# Examples
``` rust
use simple_word_count::word_count;fn main() {
assert_eq!(word_count("helloworld"), 1);
assert_eq!(word_count("hello world"), 2);
assert_eq!(word_count("hello, world"), 2);
assert_eq!(word_count("h e l l o w o r l d"), 10);
assert_eq!(word_count("hi......"), 1);
assert_eq!(word_count("hello, world | δ½ ε₯½οΌδΈη"), 8);
assert_eq!(word_count("δ½ ε₯½δΈη"), 4);
assert_eq!(word_count("δ½ ε₯½οΌδΈη"), 5);
assert_eq!(word_count("δ½ ε₯½ δΈ η"), 4);
assert_eq!(word_count("δ½ ε₯½γγγγ"), 6);
assert_eq!(word_count("a=b+c-d"), 1);
assert_eq!(word_count("a = b + c - d"), 7);
assert_eq!(word_count("123"), 1);
assert_eq!(word_count("123.456"), 1);
assert_eq!(word_count("123..456"), 1);
assert_eq!(word_count("123.456."), 1);
assert_eq!(word_count("123 456"), 2);
assert_eq!(word_count("1+1=2"), 1);
assert_eq!(word_count("1 + 1 = 2"), 5);
assert_eq!(word_count("&&%%$$οΏ₯οΏ₯"), 3);
assert_eq!(word_count("<>γγ"), 3);
}
```