fix count_characters.lua to use config if its present
This commit is contained in:
@@ -3,7 +3,9 @@
|
||||
package.path = (arg[0]:match("@?(.*/)") or arg[0]:match("@?(.*\\)")) .. "lib" .. package.config:sub(1, 1) .. "?.lua;" .. package.path
|
||||
local utility = require "utility"
|
||||
|
||||
local maximum_bytes = 40000
|
||||
local config = utility.get_config("read-only")
|
||||
if not config.llm_covers then config.llm_covers = {} end
|
||||
if not config.llm_covers.maximum_bytes then config.llm_covers.maximum_bytes = 40000 end
|
||||
|
||||
local read_all = function(file_name)
|
||||
return utility.open(file_name, "r", function(file)
|
||||
@@ -25,7 +27,7 @@ for _, path in ipairs{ ".", "extracted_texts", } do
|
||||
local path, name, extension = utility.split_path_components(file_name)
|
||||
local text = read_all(file_name)
|
||||
|
||||
print(math.floor(#text/maximum_bytes + 1), math.floor(#text/1000) .. "k", name)
|
||||
print(math.floor(#text/config.llm_covers.maximum_bytes + 1), math.floor(#text/1000) .. "k", name)
|
||||
end)
|
||||
print("Press enter.")
|
||||
io.read("*line")
|
||||
|
||||
Reference in New Issue
Block a user