Skip to content

Commit

Permalink
added function for counting lines and paragraphs
Browse files Browse the repository at this point in the history
  • Loading branch information
cecoeco committed Apr 12, 2024
1 parent 8491d77 commit 1472588
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Readability"
uuid = "4455ec5f-b558-4ef1-b6d8-c3694046c382"
authors = ["Ceco E. Maples <[email protected]>"]
version = "0.2.1"
version = "0.2.2"

[compat]
julia = "1"
Expand Down
3 changes: 2 additions & 1 deletion src/Readability.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ module Readability

export reading_time, speaking_time
export characters, sentences, syllables,
words, complex_words, polysyllabic_words, difficult_words
words, complex_words, polysyllabic_words, difficult_words,
lines, paragraphs
export ARI
export ColemanLiau
export DaleChall
Expand Down
20 changes: 20 additions & 0 deletions src/counts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,26 @@ function words(text::String)
return count
end

"""
lines(text::String)
Returns the number of lines `text`.
"""
function lines(text::String)
count::Int = length(split(text, "\n"))
return count
end

"""
paragraphs(text::String)
Returns the number of paragraphs in `text`.
"""
function paragraphs(text::String)
count::Int = length(split(text, "\n\n"))
return count
end

# Gunning Fog
"""
complex_words(text::String)
Expand Down

0 comments on commit 1472588

Please sign in to comment.