gpt-storyteller/src/zone.cr
2023-04-11 10:42:17 +02:00

27 lines
426 B
Crystal

class Zone
property tag : String
property content : Array(String)
def initialize(@tag = "", @content = [] of String)
end
def token_count()
token_count = 0
self.each do |content|
token_count += content.size / 4
end
return token_count
end
def each(&block)
content.each { |item| yield item }
end
def reverse_each(&block)
content.reverse_each { |item| yield item }
end
end