Logo
Explore Help
Sign In
discourse/discourse-ai
1
0
Fork 0
You've already forked discourse-ai
mirror of https://github.com/discourse/discourse-ai.git synced 2025-06-30 19:42:17 +00:00
Code Issues Packages Projects Releases Wiki Activity
discourse-ai/lib/tokenizer/bert_tokenizer.rb

13 lines
278 B
Ruby
Raw Normal View History

DEV: port directory structure to Zeitwerk (#319) Previous to this change we relied on explicit loading for a files in Discourse AI. This had a few downsides: - Busywork whenever you add a file (an extra require relative) - We were not keeping to conventions internally ... some places were OpenAI others are OpenAi - Autoloader did not work which lead to lots of full application broken reloads when developing. This moves all of DiscourseAI into a Zeitwerk compatible structure. It also leaves some minimal amount of manual loading (automation - which is loading into an existing namespace that may or may not be there) To avoid needing /lib/discourse_ai/... we mount a namespace thus we are able to keep /lib pointed at ::DiscourseAi Various files were renamed to get around zeitwerk rules and minimize usage of custom inflections Though we can get custom inflections to work it is not worth it, will require a Discourse core patch which means we create a hard dependency.
2023-11-29 15:17:46 +11:00
# frozen_string_literal: true
module DiscourseAi
module Tokenizer
class BertTokenizer < BasicTokenizer
def self.tokenizer
@@tokenizer ||=
Tokenizers.from_file("./plugins/discourse-ai/tokenizers/bert-base-uncased.json")
end
end
end
end
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.23.8 Page: 248ms Template: 7ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API