Class: Sastrawi::Morphology::InvalidAffixPairSpecification

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

Instance Method Summary collapse

Instance Method Details

#satisfied_by?(word) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/sastrawi/morphology/invalid_affix_pair_specification.rb', line 8

def satisfied_by?(word)
  return false if /^me(.*)kan$/.match(word)

  return false if word == 'ketahui'

  invalid_affixes = [
    /^ber(.*)i$/, /^di(.*)an$/, /^ke(.*)i$/, /^ke(.*)an$/,
    /^me(.*)an$/, /^me(.*)an$/, /^ter(.*)an$/, /^per(.*)an$/
  ]

  matches = false

  invalid_affixes.each do |invalid_affix|
    matches = matches || !!(word =~ invalid_affix)
  end

  matches
end