Compiler settings

This commit is contained in:
Samuel Sloniker 2022-11-26 13:05:37 -08:00
parent 28f81c9a63
commit 314bdef1c5
Signed by: kj7rrv
GPG Key ID: 1BB4029E66285A62
2 changed files with 12 additions and 2 deletions

View File

@ -17,8 +17,12 @@
# this program. If not, see <https://www.gnu.org/licenses/>.
import sqlite3
import tomli
import gptc
with open("compiler.toml", "rb") as f:
config = tomli.load(f)
con = sqlite3.connect("articles.db")
con.execute("CREATE TABLE IF NOT EXISTS articles(source, category, url, text);")
@ -29,7 +33,11 @@ raw_model = [
with open("model.gptc", "w+b") as f:
f.write(
gptc.compile(raw_model, max_ngram_length=3, min_count=5).serialize()
gptc.compile(
raw_model,
max_ngram_length=config["max_ngram_length"],
min_count=config["min_count"],
).serialize()
)
con.commit()

2
compiler.toml Normal file
View File

@ -0,0 +1,2 @@
max_ngram_length=3
min_count=5