gpt-storyteller/src/zone.cr

27 lines
426 B
Crystal
Raw Normal View History

2023-04-11 08:42:17 +00:00
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