ashishu007 commited on
Commit
7d4d670
1 Parent(s): 99bd351

updated linearized input

Browse files
Files changed (1) hide show
  1. sportsett_basketball.py +6 -1
sportsett_basketball.py CHANGED
@@ -18,6 +18,7 @@
18
  import csv
19
  import json
20
  import os
 
21
  from readline import parse_and_bind
22
 
23
  import datasets
@@ -567,6 +568,10 @@ class SportsettBasketball(datasets.GeneratorBasedBuilder):
567
  ),
568
  ]
569
 
 
 
 
 
570
  def sort_players_by_pts(self, entry, type='HOME'):
571
  """
572
  Sort players by points and return the indices sorted by points
@@ -585,7 +590,7 @@ class SportsettBasketball(datasets.GeneratorBasedBuilder):
585
  <FT> %d %d %d <REB> %d <AST> %d <STL> %s <BLK> %d <DREB> %d <OREB> %d <TO> %d"
586
  """
587
  pos = f'STARTER YES' if player_stats['starter'] == True else f'STARTER NO'
588
- player_line = f"<PLAYER> {player_stats['name']} <TEAM> {team_name} <POS> {pos} <RANK> {rank}"
589
  player_line = f"{player_line} <MIN> {player_stats['MIN']} <PTS> {player_stats['PTS']} <FG> {player_stats['FGM']} {player_stats['FGA']} {player_stats['FG_PCT']}"
590
  player_line = f"{player_line} <FG3> {player_stats['FG3M']} {player_stats['FG3A']} {player_stats['FG3_PCT']}"
591
  player_line = f"{player_line} <FT> {player_stats['FTM']} {player_stats['FTA']} {player_stats['FT_PCT']}"
 
18
  import csv
19
  import json
20
  import os
21
+ import re
22
  from readline import parse_and_bind
23
 
24
  import datasets
 
568
  ),
569
  ]
570
 
571
+ def tokenize_initials(self, value):
572
+ attrib_value = re.sub(r"(\w)\.(\w)\.", r"\g<1>. \g<2>.", value)
573
+ return attrib_value
574
+
575
  def sort_players_by_pts(self, entry, type='HOME'):
576
  """
577
  Sort players by points and return the indices sorted by points
 
590
  <FT> %d %d %d <REB> %d <AST> %d <STL> %s <BLK> %d <DREB> %d <OREB> %d <TO> %d"
591
  """
592
  pos = f'STARTER YES' if player_stats['starter'] == True else f'STARTER NO'
593
+ player_line = f"<PLAYER> {self.tokenize_initials(player_stats['name'])} <TEAM> {team_name} <POS> {pos} <RANK> {rank}"
594
  player_line = f"{player_line} <MIN> {player_stats['MIN']} <PTS> {player_stats['PTS']} <FG> {player_stats['FGM']} {player_stats['FGA']} {player_stats['FG_PCT']}"
595
  player_line = f"{player_line} <FG3> {player_stats['FG3M']} {player_stats['FG3A']} {player_stats['FG3_PCT']}"
596
  player_line = f"{player_line} <FT> {player_stats['FTM']} {player_stats['FTA']} {player_stats['FT_PCT']}"