module PostAudit

Overview

Checks for a batch of LinkedIn posts, following the steps of the LinkedIn Content Strategy playbook: count every post against the length band, keep numbered lists to 40% of a batch, gate every topic on active discussion in the last 30 days with a source noted, keep comments to one to three sentences ending in a real question, and rank commenters above likers.

Defined in:

audit.cr

Constant Summary

MAX_NUMBERED_SHARE = 0.40
NUMBERED = "numbered_list"
TOPIC_WINDOW_DAYS = 30

Class Method Summary

Class Method Detail

def self.band(chars : Int32, min : Int32, max : Int32) : Band #

[View source]
def self.comment_problems(text : String) : Array(String) #

A comment fits when it is one to three sentences and ends with a question.


[View source]
def self.numbered_ok?(posts : Array(Post)) : Bool #

A batch passes when numbered lists are no more than 40% of it.


[View source]
def self.numbered_share(posts : Array(Post)) : Float64 #

Share of the batch that is a numbered list, as a fraction.


[View source]
def self.parse_posts(text : String) : Array(Post) #

Parse "id,chars,structure,angle,visual,topic_source,topic_days". A blank topic_days means unknown.


[View source]
def self.parse_responders(text : String) : Array(Responder) #

Parse "name,type" with type commenter or liker.


[View source]
def self.rank_responders(list : Array(Responder)) : Array(Responder) #

Commenters rank above likers; each group keeps its input order.


[View source]
def self.sentence_count(text : String) : Int32 #

Number of sentences: runs of text ending in . ! or ? (a trailing fragment counts as one).


[View source]
def self.topic_gate(p : Post) : String | Nil #

A topic passes the gate when it has a source noted and was in active discussion within the last 30 days.


[View source]
def self.variety(posts : Array(Post), dim : Symbol) : Array(Tuple(String, Int32)) #

Counts per value for one dimension (structure, angle or visual), most frequent first.


[View source]