Sha256: 9e5c8c7deb3bbc06ec5017146cec69c32350a2ab351bab5d13ae2a8ab64d7833

Contents?: true

Size: 534 Bytes

Versions: 2

Compression:

Stored size: 534 Bytes

Contents

require "dojefiy/version"
require 'engtagger'

class Dojefiy

  ADJECTIVES = %w[so much many very such]

  def initialize
    @tagger = EngTagger.new
  end

  def process( str )
    str.downcase
    tagged_str = @tagger.add_tags( str )
    nouns = @tagger.get_nouns( tagged_str ).keys
    phrases = nouns.each_with_index.map do |noun, index|
      "#{adjective(index)} #{noun}."
    end
    phrases << "wow."
    phrases.join(" ").downcase
  end

  private 

  def adjective index
    ADJECTIVES[ index % ADJECTIVES.size ]
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dojefiy-1.1.0 lib/dojefiy.rb
dojefiy-1.0.0 lib/dojefiy.rb