juan_gandhi: (VP)
object DoggyEnglish {
  val meaningless = Set("name", "of", "the", "my", "your", "in", "what", "which", "was", "is")

  val synonyms = Set("city, town", "sibling, siblings", "job, work") .map {
    word => word.split(", ").toList
  } .collect {
    case main::tail => tail map (w => w -> main)
  } .flatten .toMap withDefault identity


  def simplifyQuestion(question: String) = {
    val noPunctuation = question.toLowerCase.replaceAll("[^a-z ]", "")
    val words = noPunctuation split " "
    val meaningfulWords = words filterNot meaningless
    val standardized = meaningfulWords map synonyms
    standardized mkString " "
  }

}

Profile

juan_gandhi: (Default)
Juan-Carlos Gandhi

December 2025

S M T W T F S
  12 3 4 56
78910111213
14151617181920
21222324252627
28293031   

Syndicate

RSS Atom

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Dec. 8th, 2025 07:32 pm
Powered by Dreamwidth Studios