mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-06-27 10:02:16 +00:00
FIX: Truncate content for sentiment/toxicity classification (#431)
This commit is contained in:
parent
5bdf3dc1f4
commit
c70f43f130
@ -48,11 +48,14 @@ module DiscourseAi
|
||||
end
|
||||
|
||||
def content_of(target_to_classify)
|
||||
if target_to_classify.post_number == 1
|
||||
"#{target_to_classify.topic.title}\n#{target_to_classify.raw}"
|
||||
else
|
||||
target_to_classify.raw
|
||||
end
|
||||
content =
|
||||
if target_to_classify.post_number == 1
|
||||
"#{target_to_classify.topic.title}\n#{target_to_classify.raw}"
|
||||
else
|
||||
target_to_classify.raw
|
||||
end
|
||||
|
||||
Tokenizer::BertTokenizer.truncate(content, 512)
|
||||
end
|
||||
|
||||
def endpoint
|
||||
|
@ -59,13 +59,18 @@ module DiscourseAi
|
||||
end
|
||||
|
||||
def content_of(target_to_classify)
|
||||
return target_to_classify.message if target_to_classify.is_a?(Chat::Message)
|
||||
content =
|
||||
if target_to_classify.is_a?(Chat::Message)
|
||||
target_to_classify.message
|
||||
else
|
||||
if target_to_classify.post_number == 1
|
||||
"#{target_to_classify.topic.title}\n#{target_to_classify.raw}"
|
||||
else
|
||||
target_to_classify.raw
|
||||
end
|
||||
end
|
||||
|
||||
if target_to_classify.post_number == 1
|
||||
"#{target_to_classify.topic.title}\n#{target_to_classify.raw}"
|
||||
else
|
||||
target_to_classify.raw
|
||||
end
|
||||
Tokenizer::BertTokenizer.truncate(content, 512)
|
||||
end
|
||||
|
||||
def endpoint
|
||||
|
Loading…
x
Reference in New Issue
Block a user