<commit_before> import java.util.Set;
String datesSBar[];
String conceptSBar[];
String yearSelected="2009",yearHover="2006";
String conceptSelected="8",conceptHover="10";
Table tableConcept;
String poloo="";
String poloo2="";
HashMap<String,HashMap<String,Float[]>> wordByYear=new HashMap();
ArrayList<TermForce> termsForce=new ArrayList();
MaxSize max= new MaxSize();
void setup() {
  background(255);
  size(800, 600);
  initTable(); //<>//
  initScrollBar();
  //termsForce.add(new TermForce("test",10.0,(int)random(width),(int)random(height),max));
  //termsForce.add(new TermForce("teste",0.2,(int)random(width),(int)random(height),max));
  termsForce=generateTermForce(yearSelected,conceptSelected);
  arrange(termsForce); 
}

void draw() {
  background(255);
  drawScroll();
  drawSpirale();
}

ArrayList<TermForce> generateTermForce(String year,String concept){
  ArrayList<TermForce> ters=new ArrayList();
  int conInt=Integer.parseInt(concept);
  HashMap<String,Float[]> wordsDouble=wordByYear.get(year);
  Set<String> words=wordsDouble.keySet();
  for(String word:words){
    float val=wordsDouble.get(word)[conInt-1];
    ters.add(new TermForce(word,val,(int)random(width),(int)random(height),max));
  }
  return ters;
}
void drawSpirale(){
  for(TermForce ter:termsForce)
  {
    ter.display();
  }
}

void drawScroll(){
  int sliderW=(int)(width*0.8);
  String prevYear=yearSelected;
  String prevConcept=conceptSelected;
  
  yearSelected=drawScrollBar(width/10,50,sliderW,datesSBar,yearSelected);
  conceptSelected=drawScrollBar(width/10,80,sliderW,conceptSBar,conceptSelected);
  if(!prevYear.equals(yearSelected)||!prevConcept.equals(conceptSelected)){
    termsForce=generateTermForce(yearSelected,conceptSelected);
    arrange(termsForce); 
  }
}

void initTable(){
  tableConcept=loadTable("../projetTermConceptYear.csv");
  for (TableRow row : tableConcept.rows()) {
    String or[]=row.getString(0).split(":");
    String year = or[0];
    String word="";
    if(or.length>1){
      word = or[1];
    }else{
      continue;
    }
    String con[]=row.getString(1).substring(1,row.getString(1).length()-2).split(",");
    Float []doubleCon=new Float[con.length];
    for(int i=0;i<con.length;i++){
      doubleCon[i]=Float.parseFloat(con[i]);
    }
    if(!wordByYear.containsKey(year)){
      wordByYear.put(year,new HashMap());
    }
    wordByYear.get(year).put(word,doubleCon);
    
  }
}
void initScrollBar(){
  int nb=2021-2006;
  datesSBar=new String[nb];
  for (int i=0;i<nb;i++){
     datesSBar[i]=Integer.toString(2006+i);
  }
  conceptSBar=new String[20];
  for (int i=0;i<20;i++){
     conceptSBar[i]=Integer.toString(i+1);
  }
}

String drawScrollBar( int x,int y,int w,String []list,String selection){
   textSize(12);
  int baseW=(int)Math.rint(w/list.length);
  line(x, y, x+w-baseW, y);
  String select=selection;
  for (int i=0;i<list.length;i++){
      String name=list[i];
      int xCoo=x+i*baseW;
      double txtSize=textWidth(name)*0.5;
      boolean hover=mouseX>xCoo-txtSize&&mouseX<xCoo+txtSize+5&&
      mouseY>y-35&&mouseY<y+5;
      
      drawTextIndex(xCoo,y,name,name.equals(selection),hover);
      if(mousePressed &&hover){
        select=name;
      }
  }
  return select;
}
void drawTextIndex(int baseX,int baseY,String text,boolean selected,boolean hov){
 
  if(hov){
    fill(0, 182, 203, 254);
  }else{
    fill(0, 102, 153, 204);
  }
  Float sText=(textWidth(text))*0.5;
  if(!selected&&!hov){
    noFill();
  }
  text(text, baseX-sText+5, baseY-12); 
  triangle(baseX, baseY, baseX+6, baseY-7, baseX+12, baseY);
}

// calcule de la spirale des mots
void arrange(ArrayList<TermForce>  arranging) {
     //cntre de la spirale
    float cx=width/2,cy=height/2;
    //Eloignement et angle
    float R=0.0,dR=1.0,theta=0.0,dTheta=0.05;
    //bruit
    float Rnoise=0.0,dRnoise=1.5;
      R=0.0;
      theta=0.0;
      ArrayList<TermForce>  bases = arranging;
      ArrayList<TermForce> arrayCalcul=new ArrayList();
      for(TermForce arrange:bases){
              R=0.0;
        theta=random(100)/100;
        arrange.calculateValue();
        arrange.calculateDisplay();
        int loop=0;
        do{
          float radd=theta+(noise(Rnoise)*200)-100;
          arrange.x=(int)(cx+R*cos(radd));
          arrange.y=(int)(cy+R*sin(radd));
                    
          theta+=dTheta;
          R+=dR;
          Rnoise+=dRnoise;
          loop++;
        }while(check(arrayCalcul,arrange)&&loop<10000);
        arrayCalcul.add(arrange);
      }
      
    

}<commit_msg>Panez<commit_after> import java.util.*;
String datesSBar[];
String conceptSBar[];
String selectionSBar[];
String yearSelected="2009";
String conceptSelected="1";
Table tableConcept;
String poloo="";
String poloo2="";
HashMap<String,HashMap<String,Float[]>> wordByYear=new HashMap();
ArrayList<TermForce> termsForce=new ArrayList();
String nbSelect="100";
MaxSize max= new MaxSize();
void setup() {
  background(255);
  size(1024, 768);
  initTable(); //<>//
  initScrollBar();
  //termsForce.add(new TermForce("test",10.0,(int)random(width),(int)random(height),max));
  //termsForce.add(new TermForce("teste",0.2,(int)random(width),(int)random(height),max));
  termsForce=generateTermForce(yearSelected,conceptSelected,nbSelect);
  arrange(termsForce); 
}

void draw() {
  background(255);
  
  drawSpirale();
  drawScroll();
}

ArrayList<TermForce> generateTermForce(String year,String concept,String nbSelect){
  max=new MaxSize();
  int nbSel=Integer.parseInt(nbSelect);
  ArrayList<TermForce> ters=new ArrayList();
  int conInt=Integer.parseInt(concept);
  HashMap<String,Float[]> wordsDouble=wordByYear.get(year);
  Set<String> words=wordsDouble.keySet();
  for(String word:words){
    float val=wordsDouble.get(word)[conInt-1];
    max.max=max(max.max,val);
    max.min=min(max.min,val);
    ters.add(new TermForce(word,val,(int)random(width),(int)random(height),max));
  }
  double nbSelCal=min(nbSel,ters.size());
  float nia=(float)(width*height/(textWidth("demonstration")*nbSelCal));
  //max.min=0.2*max.max;
  max.fontMax=min(40,nia*0.14);
  max.fontMin=1;
  
  Collections.sort(ters,
        new Comparator<TermForce>(){
          public int compare(TermForce o1, TermForce o2){
            return o1.compareTo(o2);
        }
      });
  ArrayList<TermForce> tersRe=new ArrayList();
      
  for(int i=0;i<min(ters.size(),nbSel);i++)
  {
    tersRe.add(ters.get(i));
    float val=ters.get(i).value;
    max.max=max(max.max,val);
    max.min=min(max.min,val);
  
  }
  return tersRe;
}
void drawSpirale(){
  for(TermForce ter:termsForce)
  {
    ter.display();
  }
}

void drawScroll(){
  int sliderW=(int)(height*0.8);
  String prevYear=yearSelected;
  String prevConcept=conceptSelected;
  String prevSel=nbSelect;
  yearSelected=drawScrollBar(50,50,sliderW,datesSBar,yearSelected);
  conceptSelected=drawScrollBar(10,50,sliderW,conceptSBar,conceptSelected);
  sliderW=(int)(height*0.4);
  nbSelect=drawScrollBar(110,50,sliderW,selectionSBar,nbSelect);
  if(!prevYear.equals(yearSelected)||!prevConcept.equals(conceptSelected)||!prevSel.equals(nbSelect)){
    termsForce=generateTermForce(yearSelected,conceptSelected,nbSelect);
    arrange(termsForce); 
  }
}

void initTable(){
  tableConcept=loadTable("../projetTermConceptYear.csv");
  for (TableRow row : tableConcept.rows()) {
    String or[]=row.getString(0).split(":");
    String year = or[0];
    String word="";
    if(or.length>1){
      word = or[1];
    }else{
      continue;
    }
    String con[]=row.getString(1).substring(1,row.getString(1).length()-2).split(",");
    Float []doubleCon=new Float[con.length];
    for(int i=0;i<con.length;i++){
      doubleCon[i]=Float.parseFloat(con[i]);
    }
    if(!wordByYear.containsKey(year)){
      wordByYear.put(year,new LinkedHashMap());
    }
    wordByYear.get(year).put(word,doubleCon);
    
  }
}
void initScrollBar(){
  int nb=2021-2006;
  datesSBar=new String[nb];
  for (int i=0;i<nb;i++){
     datesSBar[i]=Integer.toString(2006+i);
  }
  conceptSBar=new String[20];
  for (int i=0;i<20;i++){
     conceptSBar[i]=Integer.toString(i+1);
  }
  selectionSBar=new String[]{"20","50","100","200","500","1000"};
}

String drawScrollBar( int x,int y,int h,String []list,String selection){
   textSize(12);
  int baseW=(int)Math.rint(h/list.length);
  line(x, y, x, y+h-baseW);
  String select=selection;
  for (int i=0;i<list.length;i++){
      String name=list[i];
      int xCoo=x;
      int yCoo=y+i*baseW;
      double txtSize=textWidth(name);
      boolean hover=mouseX>xCoo-5&&mouseX<xCoo+txtSize+15&&
      mouseY>yCoo-10&&mouseY<yCoo+10;
      
      drawTextIndex(xCoo,yCoo,name,name.equals(selection),hover);
      if(mousePressed &&hover){
        select=name;
      }
  }
  return select;
}
void drawTextIndex(int baseX,int baseY,String text,boolean selected,boolean hov){
 
  if(hov){
    fill(0, 182, 203, 254);
  }else{
    fill(0, 102, 153, 204);
  }
  Float sText= textAscent() * 0.9;
  if(!selected&&!hov){
    noFill();
  }
  text(text, baseX+13, baseY+sText); 
  triangle(baseX, baseY, baseX+6, baseY+6, baseX, baseY+12);
}

// calcule de la spirale des mots
void arrange(ArrayList<TermForce>  arranging) {
     //cntre de la spirale
    float cx=width/2+50,cy=height/2;
    //Eloignement et angle
    float R=0.0,dR=1.0,theta=0.0,dTheta=0.05;
    //bruit
    float Rnoise=0.0,dRnoise=1.5;
      R=0.0;
      theta=0.0;
      ArrayList<TermForce>  bases = arranging;
      ArrayList<TermForce> arrayCalcul=new ArrayList();
      for(TermForce arrange:bases){
              R=0.0;
        theta=random(100)/100;
        arrange.calculateValue();
        arrange.calculateDisplay();
        int loop=0;
        do{
          float radd=theta+(noise(Rnoise)*200)-100;
          arrange.x=(int)(cx+R*cos(radd));
          arrange.y=(int)(cy+R*sin(radd));
                    
          theta+=dTheta;
          R+=dR;
          Rnoise+=dRnoise;
          loop++;
        }while(check(arrayCalcul,arrange)&&loop<10000);
        arrayCalcul.add(arrange);
      }
      
    

}
{'fraction_non_alphanumeric': 0.1686723023371457, 'fraction_numerical': 0.03252113376429637, 'mean_word_length': 3.973293768545994, 'pattern_counts': {'":': 2, '<': 42, '<?xml version=': 0, '>': 33, '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': '319199', 'n_tokens_mistral': 3840, 'n_tokens_neox': 3634, 'n_words': 541}