Skip to content

Instantly share code, notes, and snippets.

@samueleresca
Last active April 19, 2019 22:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samueleresca/531b636c2ada582d2218372575eb6fe7 to your computer and use it in GitHub Desktop.
Save samueleresca/531b636c2ada582d2218372575eb6fe7 to your computer and use it in GitHub Desktop.
let trainDataPath = Path.Combine("../","Data","lyrics.csv")
let msft = CsvFile.Load(File.Open(trainDataPath, FileMode.Open), separators = ",", quote = '"', hasHeaders= true)
let songLyrics =
msft.Rows
|> Seq.filter (fun row -> not(row.GetColumn "lyrics" |> String.IsNullOrEmpty))
|> Seq.filter (fun row -> not(String.Equals(row.GetColumn "lyrics", "[Instrumental]", StringComparison.OrdinalIgnoreCase)))
|> Seq.map (fun row -> { Song = (row.GetColumn "song")
Artist = (row.GetColumn "artist")
Genre = (row.GetColumn "genre")
Lyrics = (row.GetColumn "lyrics").Replace(Environment.NewLine, ", ")
Year = (row.GetColumn "year") |> int
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment