Class: Copyleaks::ScoreWeights

Inherits:
Object
  • Object
show all
Defined in:
lib/copyleaks/models/submissions/writing_assistant/score_weights.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(grammar_score_weight, mechanics_score_weight, sentence_structure_score_weight, word_choice_score_weight) ⇒ ScoreWeights

Returns a new instance of ScoreWeights.



34
35
36
37
38
39
# File 'lib/copyleaks/models/submissions/writing_assistant/score_weights.rb', line 34

def initialize(grammar_score_weight, mechanics_score_weight, sentence_structure_score_weight, word_choice_score_weight)
  @grammar_score_weight = grammar_score_weight
  @mechanics_score_weight = mechanics_score_weight
  @sentence_structure_score_weight = sentence_structure_score_weight
  @word_choice_score_weight = word_choice_score_weight
end

Instance Attribute Details

#grammar_score_weightObject

Parameters:

  • Grammar (Float)

    correction category weight in the overall score. 0.0 >= weight <= 1.0

  • Mechanics (Float)

    correction category weight in the overall score. 0.0 >= weight <= 1.0

  • Sentence (Float)

    structure correction category weight in the overall score. 0.0 >= weight <= 1.0

  • Word (Float)

    choice correction category weight in the overall score. 0.0 >= weight <= 1.0



32
33
34
# File 'lib/copyleaks/models/submissions/writing_assistant/score_weights.rb', line 32

def grammar_score_weight
  @grammar_score_weight
end

#mechanics_score_weightObject

Parameters:

  • Grammar (Float)

    correction category weight in the overall score. 0.0 >= weight <= 1.0

  • Mechanics (Float)

    correction category weight in the overall score. 0.0 >= weight <= 1.0

  • Sentence (Float)

    structure correction category weight in the overall score. 0.0 >= weight <= 1.0

  • Word (Float)

    choice correction category weight in the overall score. 0.0 >= weight <= 1.0



32
33
34
# File 'lib/copyleaks/models/submissions/writing_assistant/score_weights.rb', line 32

def mechanics_score_weight
  @mechanics_score_weight
end

#sentence_structure_score_weightObject

Parameters:

  • Grammar (Float)

    correction category weight in the overall score. 0.0 >= weight <= 1.0

  • Mechanics (Float)

    correction category weight in the overall score. 0.0 >= weight <= 1.0

  • Sentence (Float)

    structure correction category weight in the overall score. 0.0 >= weight <= 1.0

  • Word (Float)

    choice correction category weight in the overall score. 0.0 >= weight <= 1.0



32
33
34
# File 'lib/copyleaks/models/submissions/writing_assistant/score_weights.rb', line 32

def sentence_structure_score_weight
  @sentence_structure_score_weight
end

#word_choice_score_weightObject

Parameters:

  • Grammar (Float)

    correction category weight in the overall score. 0.0 >= weight <= 1.0

  • Mechanics (Float)

    correction category weight in the overall score. 0.0 >= weight <= 1.0

  • Sentence (Float)

    structure correction category weight in the overall score. 0.0 >= weight <= 1.0

  • Word (Float)

    choice correction category weight in the overall score. 0.0 >= weight <= 1.0



32
33
34
# File 'lib/copyleaks/models/submissions/writing_assistant/score_weights.rb', line 32

def word_choice_score_weight
  @word_choice_score_weight
end

Instance Method Details

#as_json(*_args) ⇒ Object



41
42
43
44
45
46
47
48
# File 'lib/copyleaks/models/submissions/writing_assistant/score_weights.rb', line 41

def as_json(*_args)
  {
    grammarScoreWeight: @grammar_score_weight,
    mechanicsScoreWeight: @mechanics_score_weight,
    sentenceStructureScoreWeight: @sentence_structure_score_weight,
    wordChoiceScoreWeight: @word_choice_score_weight
  }.reject { |_k, v| v.nil? }
end

#to_json(*options) ⇒ Object



50
51
52
# File 'lib/copyleaks/models/submissions/writing_assistant/score_weights.rb', line 50

def to_json(*options)
  as_json(*options).to_json(*options)
end