<commit_before>require 'open-uri'
require 'nokogiri'

# this is a class
class Scraper
  web_data = open('http://scores.espn.go.com/nba/scoreboard')
  doc = Nokogiri.HTML(web_data)
  x, y, z, w = [], [], [], []
  team_1 = []

  time = doc.xpath("//div[@class='game-status']//p")
  time.each { |times| x << times.text }
  team = doc.xpath("//div[@class='team-capsule']//a")
  team.each { |teams| y << teams.text }
  player = doc.xpath("//div[@style='display: block']\
  //table[@class='game-stat-overview']//tbody//tr//td")
  player.each { |p| team_1 << p.text }

  for i in 0..(y.size) / 2 - 1
    z << y[i * 2] + ' v.s ' + y[i * 2 + 1]
  end

  for i in 0..(team_1.size) / 5 - 1
    w << team_1[i * 5] + "\t" + "#{team_1[i * 5 + 1]} #{team_1[i * 5 + 2]}" + \
    ' v.s '  + "#{team_1[i * 5 + 3]} #{team_1[i * 5 + 4]}"
  end

  schedule_table_upcoming = Hash[x.zip(z)]
  schedule_table_upcoming.each do |key, value|
    puts "#{key}\t#{value}"
    if key.include? "PM" || "AM"
      5.times { puts w.shift }
    else
      3.times { puts w.shift }
    end
  end
end<commit_msg>Add option control, user can enter 1 or 2 to different function.<commit_after>require 'open-uri'
require 'nokogiri'

# this is a class
class Scraper
  web_data = open('http://scores.espn.go.com/nba/scoreboard')
  doc = Nokogiri.HTML(web_data)
  web_data_player = 'http://origin.nba.com/playerfile/'
  x, y, z, w ,f = [], [], [], [], []
  team_1 = []
  data = ["PTS", "REB", "AST", "PIE"]

  puts "Enter 1 to see starting lineup today, enter 2 to see any player's profile you want."
  control = gets.chomp
  control = control.to_i
  if control == 1
  puts "Which player's profile do you want to search?"
  name = gets.chomp
  name.downcase!
  web_data_player = web_data_player + name
  doc1 = Nokogiri.HTML(open(web_data_player))
  profile = doc1.xpath("//div[@class='sponsor-branding']//tr[@class='stats text-shadow']//td")
  profile.each { |profile| f << profile.text }
  player_profile = Hash[data.zip(f)]
  puts player_profile

elsif control == 2
  time = doc.xpath("//div[@class='game-status']//p")
  time.each { |times| x << times.text }
  team = doc.xpath("//div[@class='team-capsule']//a")
  team.each { |teams| y << teams.text }
  player = doc.xpath("//div[@style='display: block']\
  //table[@class='game-stat-overview']//tbody//tr//td")
  player.each { |p| team_1 << p.text }

  for i in 0..(y.size) / 2 - 1
    z << y[i * 2] + ' v.s ' + y[i * 2 + 1]
  end

  for i in 0..(team_1.size) / 5 - 1
    w << team_1[i * 5] + "\t" + "#{team_1[i * 5 + 1]} #{team_1[i * 5 + 2]}" + \
    ' v.s '  + "#{team_1[i * 5 + 3]} #{team_1[i * 5 + 4]}"
  end

  schedule_table_upcoming = Hash[x.zip(z)]
  schedule_table_upcoming.each do |key, value|
    puts "#{key}\t#{value}"
    if key.include? "PM" || "AM"
      5.times { puts w.shift }
    else
      3.times { puts w.shift }
    end
  end
else
  puts "Please enter number 1 or 2"
end
end
{'fraction_non_alphanumeric': 0.20309278350515464, 'fraction_numerical': 0.02268041237113402, 'mean_word_length': 2.8403693931398415, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1109894', 'n_tokens_mistral': 1231, 'n_tokens_neox': 1178, 'n_words': 280}