/ Robotics

Filtering VEX event names

When making my VEX event/team information app I encountered a problem, vex event names would take up too much space on the title bar and with mostly redundant information too.

Here are some examples:

2017-2018 VEX Lakeside MSC In the Zone  
2017 Compton Robotics Challenge  
In the Zone in Vancouver  
Harriton VRC Qualifier  
AHS Eagle Nation Challenge - State Qualifier  
Corona STEM Academy In the Zone  
Branches Homeschool Skills Challenge  
KIDS Inc In The Zone Blended Winter State Qualifier; Indianapolis, IN  
District 204 MS Only  VEX Tournament  
Michigan East Regional at MCCC/Midway - Middle School Only  
Michigan East Regional at MCCC/Midway - High School Only  
Collins Hill High School Battle at The Hill  
Pulaski County VEX State Qualifier  
2017-18 Southern Maryland VEX League - Middle School  
War Hawk Qualifier  
2018 VEX In the Zone Inland Empire Challenge sponsored by iDesign Solutions  
iDesign Central Toronto VRC Qualifying Event  
***Syracuse City School District Intercity VEX Tournament***
Queensbury In the Zone  
Wiregrass VEX VRC Tournament  
Monticello Challenge: In the Zone  
IDesign East Rockaway HS Southern NY Regional Qualifier - In The Zone  
Northeast Oklahoma VEXU VEX Robotics Competition  
Branches Homeschool Skills Challenge  
Battle at the Border Vex Tournament  
Hornet Robotics - 1st Annual VRC Cupid's Challenge  
New Mexico State University  In the Zone  VRC  State  Championship  
CSM VEX U Regional Qualifier  
VRC In The Zone Lancashire Regional  
West Michigan All Teams Spring Skills Only Event  
Millburn High School VRC Event  
Great Lakes Skills Only Event  
Broken Arrow HS Only-"In The Zone" VEX Robotic Competition  
Clarkston VRC Tournament - In The Zone  
Broken Arrow MS Only-"In The Zone" VEX Robotics Competition  
Golden West's 2nd Annual Robotics Tournament  
McKamy Middle School VEX In The Zone Competition  
Community High School  
Brandywine School District VEX Robotics Competition In The Zone Tournament  
Freeport Robotics Competition  
Chamberlain VEX Robotics Competition  

Absolute garbage! Most of them have VEX, In The Zone, Event, 2018, or 2017 and there is redundant spacing everywhere.

So how can we improve the user experience by removing redundant text in tournament names without making them ambiguous?

We'll start off by removing redundant space

o = o.trim().split(new RegExp(" +")).join(" ");  

So that 2018 Ohio VRC Middle School State Championship -> 2018 Ohio VRC Middle School State Championship

Now let's get rid of that annoying punctuation

o = o.replaceFirstMapped(new RegExp("^[\\*\\-!]*(.+?)[\\*\\-!]*\$"), (m) => m.group(1));  

Now ********Bville In The Zone******** -> Bville In The Zone

Time to get rid of the year numbers

o = o.split(" ").where((word) {  
    var n = int.parse(word, onError: (s) => null);
    return n == null || (n > 2025 && n < 2007);
}).join(" ");

Now 2018 VEX in the Valley Valentine Day -> VEX in the Valley Valentine Day

But year ranges like in 2017-2018 VEX Lakeside MSC In the Zone are still there, we are going to have to get more creative

o = o.split(" ").map((word) {  
  var w = word.split("-");
  var n = int.parse(w.first.replaceAll(new RegExp(r"[:\*!]"), ""), onError: (s) => null);
  if (w.length == 1) {
    return n == null || (n > 2025 && n < 2007) ? w.first : "";
  } else if (w.length == 2 && n != null && n <= 2025 && n >= 2007) {
    var n2 = int.parse(w.elementAt(1).replaceAll(new RegExp(r"[:\*!]"), ""), onError: (s) => null);
    if (n2 != null && ((n2 <= 2025 && n2 >= 2007) || (n2 <= 25 && n2 >= 7))) return "";
  }
  return word;
}).join(" ");

now 2017-2018 Asia Open VEX Robotics Competition - High School -> Asia Open VEX Robotics Competition - High School and 2017-18 Southern Maryland VEX League - Middle School -> Southern Maryland VEX League - Middle School

Next filter some redundant words

[
  "VEX Robotics",
  "Event",
  "Competition",
  "Tournament",
].forEach((bad) => o = o.replaceAll(new RegExp(bad, caseSensitive: false), ""));

[
  "VRC",
  "VEX",
  "In The Zone",
  "Starstruck",
  "Nothing But Net",
  "Skyrise",
  "Tossup",
  "at",
].forEach((bad) => o = o.replaceFirst(new RegExp("^$bad", caseSensitive: false), ""));

[
  "VRC",
  "VEX",
  "Challenge"
].forEach((bad) => o = o.replaceFirst(new RegExp("$bad\$", caseSensitive: false), ""));

Now 2018 VEX Robotics World Championship - VEX Robotics Competition High School Division -> World Championship - High School Division

Filtering VEX event names
Share this