DEV: Rename XClassification --> XClassificator to make it more obvious (#3)

This commit is contained in:
Roman Rizzi 2023-02-28 11:17:03 -03:00 committed by GitHub
parent a5f1b003d9
commit 676d3ce6b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 14 additions and 14 deletions

View File

@ -11,7 +11,7 @@ module Jobs
return if post.uploads.none? { |u| FileHelper.is_supported_image?(u.url) }
DiscourseAI::PostClassification.new(DiscourseAI::NSFW::NSFWClassification.new).classify!(post)
DiscourseAI::PostClassificator.new(DiscourseAI::NSFW::NSFWClassification.new).classify!(post)
end
end
end

View File

@ -9,7 +9,7 @@ module ::Jobs
post = Post.find_by(id: post_id, post_type: Post.types[:regular])
return if post&.raw.blank?
DiscourseAI::PostClassification.new(
DiscourseAI::PostClassificator.new(
DiscourseAI::Sentiment::SentimentClassification.new,
).classify!(post)
end

View File

@ -10,7 +10,7 @@ module ::Jobs
chat_message = ChatMessage.find_by(id: chat_message_id)
return if chat_message&.message.blank?
DiscourseAI::ChatMessageClassification.new(
DiscourseAI::ChatMessageClassificator.new(
DiscourseAI::Toxicity::ToxicityClassification.new,
).classify!(chat_message)
end

View File

@ -11,7 +11,7 @@ module ::Jobs
post = Post.find_by(id: post_id, post_type: Post.types[:regular])
return if post&.raw.blank?
DiscourseAI::PostClassification.new(
DiscourseAI::PostClassificator.new(
DiscourseAI::Toxicity::ToxicityClassification.new,
).classify!(post)
end

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
module ::DiscourseAI
class ChatMessageClassification < Classification
class ChatMessageClassificator < Classificator
private
def flag!(chat_message, _toxic_labels)

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
module ::DiscourseAI
class Classification
class Classificator
def initialize(classification_model)
@classification_model = classification_model
end

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
module ::DiscourseAI
class PostClassification < Classification
class PostClassificator < Classificator
private
def flag!(post, classification_type)

View File

@ -17,9 +17,9 @@ after_initialize do
require_relative "app/models/classification_result"
require_relative "lib/shared/inference_manager"
require_relative "lib/shared/classification"
require_relative "lib/shared/post_classification"
require_relative "lib/shared/chat_message_classification"
require_relative "lib/shared/classificator"
require_relative "lib/shared/post_classificator"
require_relative "lib/shared/chat_message_classificator"
require_relative "lib/modules/nsfw/entry_point"
require_relative "lib/modules/toxicity/entry_point"

View File

@ -3,7 +3,7 @@
require "rails_helper"
require_relative "../support/toxicity_inference_stubs"
describe DiscourseAI::ChatMessageClassification do
describe DiscourseAI::ChatMessageClassificator do
fab!(:chat_message) { Fabricate(:chat_message) }
let(:model) { DiscourseAI::Toxicity::ToxicityClassification.new }

View File

@ -3,7 +3,7 @@
require "rails_helper"
require_relative "../support/sentiment_inference_stubs"
describe DiscourseAI::Classification do
describe DiscourseAI::Classificator do
describe "#classify!" do
describe "saving the classification result" do
let(:classification_raw_result) do
@ -16,7 +16,7 @@ describe DiscourseAI::Classification do
end
let(:model) { DiscourseAI::Sentiment::SentimentClassification.new }
let(:classification) { DiscourseAI::PostClassification.new(model) }
let(:classification) { DiscourseAI::PostClassificator.new(model) }
fab!(:target) { Fabricate(:post) }
before do

View File

@ -3,7 +3,7 @@
require "rails_helper"
require_relative "../support/toxicity_inference_stubs"
describe DiscourseAI::PostClassification do
describe DiscourseAI::PostClassificator do
fab!(:post) { Fabricate(:post) }
let(:model) { DiscourseAI::Toxicity::ToxicityClassification.new }