mirror of
https://github.com/laosb/ReadabilityFramework.git
synced 2025-08-18 13:52:40 +00:00
fix: Publish functions.
This commit is contained in:
parent
73b8996beb
commit
4343848549
5 changed files with 25 additions and 19 deletions
|
@ -8,18 +8,20 @@
|
|||
import Foundation
|
||||
|
||||
public struct RAFleschKincaidGradeScorer: RAScorer {
|
||||
static let requiresCommonMetrics: Set<RACommonMetric>? = [
|
||||
public static let requiresCommonMetrics: Set<RACommonMetric>? = [
|
||||
.avgWordsPerSentence,
|
||||
.avgSyllablesPerWord
|
||||
]
|
||||
|
||||
static let meta = RAScorerMeta(
|
||||
public static let meta = RAScorerMeta(
|
||||
name: "Flesch-Kincaid Grade",
|
||||
creator: "John P. Kincaid",
|
||||
citation: "Kincaid, J. P., Fishburne Jr, R. P., Rogers, R. L., & Chissom, B. S. (1975). Derivation of new readability formulas (automated readability index, fog count and flesch reading ease formula) for navy enlisted personnel. Naval Technical Training Command Millington TN Research Branch."
|
||||
)
|
||||
|
||||
func score(_ text: String, metrics: RACommonMetricsCalculator.Results?) -> Double {
|
||||
public init() {}
|
||||
|
||||
public func score(_ text: String, metrics: RACommonMetricsCalculator.Results?) -> Double {
|
||||
let asl = metrics![.avgWordsPerSentence]!
|
||||
let asw = metrics![.avgSyllablesPerWord]!
|
||||
|
||||
|
|
|
@ -8,18 +8,20 @@
|
|||
import Foundation
|
||||
|
||||
public struct RAFleschReadingEaseScorer: RAScorer {
|
||||
static let requiresCommonMetrics: Set<RACommonMetric>? = [
|
||||
public static let requiresCommonMetrics: Set<RACommonMetric>? = [
|
||||
.avgWordsPerSentence,
|
||||
.avgSyllablesPerWord
|
||||
]
|
||||
|
||||
static let meta = RAScorerMeta(
|
||||
public static let meta = RAScorerMeta(
|
||||
name: "Flesch Reading Ease",
|
||||
creator: "Rudolf Flesch",
|
||||
citation: "Flesch, R. (1948). A new readability yardstick. Journal of applied psychology, 32(3), 221."
|
||||
)
|
||||
|
||||
func score(_ text: String, metrics: RACommonMetricsCalculator.Results?) -> Double {
|
||||
public init() {}
|
||||
|
||||
public func score(_ text: String, metrics: RACommonMetricsCalculator.Results?) -> Double {
|
||||
let asl = metrics![.avgWordsPerSentence]!
|
||||
let asw = metrics![.avgSyllablesPerWord]!
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue