Class: Legion::Extensions::Agentic::Language::Grammar::Helpers::Construal

Inherits:
Object
  • Object
show all
Includes:
Constants
Defined in:
lib/legion/extensions/agentic/language/grammar/helpers/construal.rb

Constant Summary

Constants included from Constants

Legion::Extensions::Agentic::Language::Grammar::Helpers::Constants::ACTIVATION_BOOST, Legion::Extensions::Agentic::Language::Grammar::Helpers::Constants::ACTIVATION_DECAY, Legion::Extensions::Agentic::Language::Grammar::Helpers::Constants::ACTIVATION_LABELS, Legion::Extensions::Agentic::Language::Grammar::Helpers::Constants::CONSTRUAL_OPERATIONS, Legion::Extensions::Agentic::Language::Grammar::Helpers::Constants::DEFAULT_ACTIVATION, Legion::Extensions::Agentic::Language::Grammar::Helpers::Constants::ENTRENCHMENT_THRESHOLD, Legion::Extensions::Agentic::Language::Grammar::Helpers::Constants::EXPRESSION_TYPES, Legion::Extensions::Agentic::Language::Grammar::Helpers::Constants::MAX_CONSTRUALS, Legion::Extensions::Agentic::Language::Grammar::Helpers::Constants::MAX_CONSTRUCTIONS, Legion::Extensions::Agentic::Language::Grammar::Helpers::Constants::MAX_HISTORY, Legion::Extensions::Agentic::Language::Grammar::Helpers::Constants::PROMINENCE_TYPES, Legion::Extensions::Agentic::Language::Grammar::Helpers::Constants::SCOPE_LEVELS, Legion::Extensions::Agentic::Language::Grammar::Helpers::Constants::SPECIFICITY_LEVELS

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scene:, perspective:, figure:, ground:, specificity: :intermediate, scope: :local, dynamicity: 0.5, construction_id: nil) ⇒ Construal

Returns a new instance of Construal.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/legion/extensions/agentic/language/grammar/helpers/construal.rb', line 17

def initialize(scene:, perspective:, figure:, ground:,
               specificity: :intermediate, scope: :local,
               dynamicity: 0.5, construction_id: nil)
  @id              = SecureRandom.uuid
  @scene           = scene
  @perspective     = perspective
  @figure          = figure
  @ground          = ground
  @specificity     = specificity.to_sym
  @scope           = scope.to_sym
  @dynamicity      = dynamicity.clamp(0.0, 1.0)
  @construction_id = construction_id
  @created_at      = Time.now.utc
end

Instance Attribute Details

#construction_idObject (readonly)

Returns the value of attribute construction_id.



14
15
16
# File 'lib/legion/extensions/agentic/language/grammar/helpers/construal.rb', line 14

def construction_id
  @construction_id
end

#created_atObject (readonly)

Returns the value of attribute created_at.



14
15
16
# File 'lib/legion/extensions/agentic/language/grammar/helpers/construal.rb', line 14

def created_at
  @created_at
end

#dynamicityObject (readonly)

Returns the value of attribute dynamicity.



14
15
16
# File 'lib/legion/extensions/agentic/language/grammar/helpers/construal.rb', line 14

def dynamicity
  @dynamicity
end

#figureObject (readonly)

Returns the value of attribute figure.



14
15
16
# File 'lib/legion/extensions/agentic/language/grammar/helpers/construal.rb', line 14

def figure
  @figure
end

#groundObject (readonly)

Returns the value of attribute ground.



14
15
16
# File 'lib/legion/extensions/agentic/language/grammar/helpers/construal.rb', line 14

def ground
  @ground
end

#idObject (readonly)

Returns the value of attribute id.



14
15
16
# File 'lib/legion/extensions/agentic/language/grammar/helpers/construal.rb', line 14

def id
  @id
end

#perspectiveObject (readonly)

Returns the value of attribute perspective.



14
15
16
# File 'lib/legion/extensions/agentic/language/grammar/helpers/construal.rb', line 14

def perspective
  @perspective
end

#sceneObject (readonly)

Returns the value of attribute scene.



14
15
16
# File 'lib/legion/extensions/agentic/language/grammar/helpers/construal.rb', line 14

def scene
  @scene
end

#scopeObject (readonly)

Returns the value of attribute scope.



14
15
16
# File 'lib/legion/extensions/agentic/language/grammar/helpers/construal.rb', line 14

def scope
  @scope
end

#specificityObject (readonly)

Returns the value of attribute specificity.



14
15
16
# File 'lib/legion/extensions/agentic/language/grammar/helpers/construal.rb', line 14

def specificity
  @specificity
end

Instance Method Details

#background_elementObject



36
37
38
# File 'lib/legion/extensions/agentic/language/grammar/helpers/construal.rb', line 36

def background_element
  @ground
end

#detailed?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/legion/extensions/agentic/language/grammar/helpers/construal.rb', line 40

def detailed?
  @specificity == :detailed
end

#global_scope?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/legion/extensions/agentic/language/grammar/helpers/construal.rb', line 44

def global_scope?
  @scope == :global
end

#prominent_elementObject



32
33
34
# File 'lib/legion/extensions/agentic/language/grammar/helpers/construal.rb', line 32

def prominent_element
  @figure
end

#to_hObject



48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/legion/extensions/agentic/language/grammar/helpers/construal.rb', line 48

def to_h
  {
    id:              @id,
    scene:           @scene,
    perspective:     @perspective,
    figure:          @figure,
    ground:          @ground,
    specificity:     @specificity,
    scope:           @scope,
    dynamicity:      @dynamicity,
    construction_id: @construction_id,
    created_at:      @created_at
  }
end