Class: Sastrawi::Morphology::Disambiguator::DisambiguatorPrefixRule9

Inherits:
Object
  • Object
show all
Defined in:
lib/sastrawi/morphology/disambiguator/disambiguator_prefix_rule9.rb

Instance Method Summary collapse

Instance Method Details

#disambiguate(word) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/sastrawi/morphology/disambiguator/disambiguator_prefix_rule9.rb', line 5

def disambiguate(word)
  contains = /^te([bcdfghjklmnpqrstvwxyz])er([bcdfghjklmnpqrstvwxyz])(.*)$/.match(word)

  if contains
    matches = contains.captures

    return if matches[0] == 'r'

    return "#{matches[0]}er#{matches[1]}#{matches[2]}"
  end
end