def self.feed_alternative_spellings(translitered)
return true if(@@sol.has_alternative_spellings(translitered))
word_alternative_spellings = Set.new
temp = translitered
if( temp.match(@@alternative_spellings[0]) )
temp.gsub!(/Y/, "y")
if(@verbose)
@stream.puts "Found alternative spelling "+ temp + " for word " + translitered
end
word_alternative_spellings.add(temp)
temp2 = temp.sub(/w/, "&")
if(temp!=temp2)
temp = temp2
if(@verbose)
@stream.puts "Found alternative spelling "+ temp + " for word " + translitered
end
word_alternative_spellings.add(temp)
end
temp=translitered
temp.gsub!(/Y/,"y")
temp.sub!(/y'$/,"}")
if(@verbose)
@stream.puts "Found alternative spelling "+ temp + " for word " + translitered
end
word_alternative_spellings.add(temp)
temp2 = temp.sub(/w/, "&")
if(temp!=temp2)
temp = temp2
if(@verbose)
@stream.puts "Found alternative spelling "+ temp + " for word " + translitered
end
word_alternative_spellings.add(temp)
end
elsif( temp.match(@@alternative_spellings[1]) )
temp2 = temp.gsub(/Y/,"y")
if(temp != temp2 )
temp = temp2
if(@verbose)
@stream.puts "Found alternative spelling "+ temp + " for word " + translitered
end
word_alternative_spellings.add(temp)
end
temp2 = temp.sub(/w'/, "&")
if(temp != temp2 )
temp = temp2
if(@verbose)
@stream.puts "Found alternative spelling "+ temp + " for word " + translitered
end
word_alternative_spellings.add(temp)
end
temp =translitered
temp.gsub!(/Y/, "y")
temp.sub!(/y'$/, "}")
if(@verbose)
@stream.puts "Found alternative spelling "+ temp + " for word " + translitered
end
word_alternative_spellings.add(temp)
temp2 = temp.sub(/w'/, "&")
if(temp != temp2 )
temp = temp2
if(@verbose)
@stream.puts "Found alternative spelling "+ temp + " for word " + translitered
end
word_alternative_spellings.add(temp)
end
elsif( temp.match(@@alternative_spellings[2]) )
temp.gsub!(/Y/,"y")
temp2 = temp.sub(/w'/, "&")
if(temp != temp2 )
temp = temp2
if(@verbose)
@stream.puts "Found alternative spelling "+ temp + " for word " + translitered
end
word_alternative_spellings.add(temp)
end
temp =translitered
temp.gsub!(/Y/, "y")
temp.gsub!(/y$/, "Y")
if(@verbose)
@stream.puts "Found alternative spelling "+ temp + " for word " + translitered
end
word_alternative_spellings.add(temp)
temp2 = temp.sub(/w'/, "&")
if(temp != temp2 )
temp = temp2
if(@verbose)
@stream.puts "Found alternative spelling "+ temp + " for word " + translitered
end
word_alternative_spellings.add(temp)
end
elsif( temp.match(@@alternative_spellings[3]) )
temp2 = temp.gsub(/Y/,"y")
if(temp != temp2 )
temp = temp2
if(@verbose)
@stream.puts "Found alternative spelling "+ temp + " for word " + translitered
end
word_alternative_spellings.add(temp)
end
temp2 = temp.sub(/w'/, "&")
if(temp != temp2 )
temp = temp2
if(@verbose)
@stream.puts "Found alternative spelling "+ temp + " for word " + translitered
end
word_alternative_spellings.add(temp)
end
temp.sub!(/p$/, "h")
if(@verbose)
@stream.puts "Found alternative spelling "+ temp + " for word " + translitered
end
word_alternative_spellings.add(temp)
else
temp2 = temp.sub(/Y$/, "y")
if(temp!=temp2)
temp = temp2
temp.gsub!(/Y/, "y")
if(@verbose)
@stream.puts "Found alternative spelling "+ temp + " for word " + translitered
end
word_alternative_spellings.add(temp)
temp2 = temp.sub(/w'/, "&")
if(temp != temp2 )
temp = temp2
if(@verbose)
@stream.puts "Found alternative spelling "+ temp + " for word " + translitered
end
word_alternative_spellings.add(temp)
end
else
temp2 = temp.gsub(/Y/, "y")
if(temp != temp2)
if(@verbose)
@stream.puts "Found alternative spelling "+ temp + " for word " + translitered
end
word_alternative_spellings.add(temp)
temp2 = temp.sub(/w'/, "&")
if(temp != temp2 )
temp = temp2
if(@verbose)
@stream.puts "Found alternative spelling "+ temp + " for word " + translitered
end
word_alternative_spellings.add(temp)
end
else
temp2 = temp.sub(/w'/, "&")
if(temp != temp2 )
temp = temp2
if(@verbose)
@stream.puts "Found alternative spelling "+ temp + " for word " + translitered
end
word_alternative_spellings.add(temp)
end
end
end
end
if(!word_alternative_spellings.empty?)
@@sol .add_alternative_spellings(translitered,word_alternative_spellings)
end
return !word_alternative_spellings.empty?
end