Analysis
A tool helping you to extract useful information from strings.
Install / Use
/learn @BasThomas/AnalysisREADME
Analysis
Analysis is a tool that helps you extract useful information from strings. It calculates the amount of sentences, words, characters, occurrence of words and characters, and more.
Installation
Analysis is available via CocoaPods.
pod 'Analysis'
Then run pod install.
Sample Project
There's a sample project in the Example directory. To use it, run pod install to download the required libraries.
Usage
Analysing a string is very straightforward. You can use any of these two ways to instantiate an Analysis:
import Analysis
let analysis = Analysis(of: "You are awesome, you!")
or
import Analysis
let analysis = "You are awesome, you!".analysed()
After that, you can get the information you need.
analysis.sentenceCount() // 1
analysis.wordCount(unique: true) // 4
analysis.characterCount(includingSpaces: false) // 18
analysis.wordOccurrences(caseSensitive: true) // ["You": 1, "are": 1, "awesome", 1, "you": 1]
analysis.wordOccurrences(caseSensitive: false) // ["you": 2, "are": 1, "awesome", 1]
analysis.frequency(of: "you", caseSensitive: false) // 50.0%
analysis.averageCharacters(per: .word) // 5.33
analysis.syllableCount() // 5
analysis.wordSyllables() // ["you": 1, "are": 1, "awesome": 2]
analysis.fleschReadingEase() // 97.025
analysis.fleschKincaidGradeLevel() // 0.72
You can also easily sort your occurences via an enhanced sorting method on Dictionary.
analysis
.wordOccurrences(caseSensitive: false)
.sorted(by: .key, order: .ascending) // [("are", 1), ("awesome", 1), ("you", 2)]
Contributing
Want to contribute to this project? Great! There's some things that still need work, but definitely also let me know when you encounter any issues, spot a bug, or have a feature request!
Check out the issues for some tasks to get started with. Or, write tests. We can use as many as you can think of.
License
Analysis is released under an MIT license. See License for more information.
Related Skills
node-connect
344.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
96.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
344.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
344.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
