voco
This commit is contained in:
parent
5cb2a2afe7
commit
cfe62d46de
|
|
@ -66,7 +66,7 @@ public class Dictionnaire {
|
|||
if (isStopWord(mot)) continue;
|
||||
|
||||
if (!dico.containsKey(mot)) {
|
||||
dico.put(mot, new Mot(mot, 0));
|
||||
dico.put(mot, new Mot(mot, 0.0));
|
||||
}
|
||||
|
||||
Mot motInfo = dico.get(mot);
|
||||
|
|
@ -74,7 +74,7 @@ public class Dictionnaire {
|
|||
if (positivite > 0) {
|
||||
motInfo.incrementerApparitionsPositives();
|
||||
}
|
||||
motInfo.setSentiment((double) motInfo.getApparitionsPositives() / motInfo.getApparitionsTotal());
|
||||
motInfo.setSentiment(((motInfo.getApparitionsPositives() / motInfo.getApparitionsTotal())-0.5)*2*0.01);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package Main;
|
|||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
|
||||
/* String cheminFichierExcel = "C:\\Users\\Qpelu\\Downloads\\big.csv";
|
||||
String cheminFichierExcel = "C:\\Users\\Qpelu\\Downloads\\big.csv";
|
||||
String cheminSauvegarde = "C:\\Users\\Qpelu\\Downloads\\dictionnaire.csv";
|
||||
|
||||
ListeAvis listeAvis = new ListeAvis(cheminFichierExcel);
|
||||
|
|
@ -17,13 +17,12 @@ public class Main {
|
|||
// Avis.Analyse(a, dictionnaire);
|
||||
|
||||
|
||||
// dictionnaire.apprentissageSentiment(listeAvis.getListeAvis());
|
||||
dictionnaire.apprentissageSentiment(listeAvis.getListeAvis());
|
||||
|
||||
// dictionnaire.sauvegarderDictionnaireCSV(cheminSauvegarde);
|
||||
dictionnaire.sauvegarderDictionnaireCSV(cheminSauvegarde);
|
||||
// dictionnaire.getDico()
|
||||
;
|
||||
///Dictionnaire d =new Dictionnaire("C:\\Users\\Qpelu\\Downloads\\dictionnaire.csv");
|
||||
//System.out.println(d);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,16 +3,16 @@ package Main;
|
|||
public class Mot {
|
||||
private String nom;
|
||||
private double sentiment;
|
||||
private int apparitionsTotal;
|
||||
private int apparitionsPositives;
|
||||
private double apparitionsTotal;
|
||||
private double apparitionsPositives;
|
||||
|
||||
public Mot(String nom, int sentiment) {
|
||||
public Mot(String nom, double sentiment) {
|
||||
this.nom = nom;
|
||||
this.sentiment = sentiment;
|
||||
this.apparitionsTotal = 0;
|
||||
this.apparitionsPositives = 0;
|
||||
}
|
||||
public Mot(String nom, double sentiment, int apparitionsTotal,int apparitionsPositives) {
|
||||
public Mot(String nom, double sentiment, double apparitionsTotal,double apparitionsPositives) {
|
||||
this.nom = nom;
|
||||
this.sentiment = sentiment;
|
||||
this.apparitionsTotal = apparitionsTotal;
|
||||
|
|
@ -39,11 +39,11 @@ public class Mot {
|
|||
this.apparitionsPositives++;
|
||||
}
|
||||
|
||||
public int getApparitionsTotal() {
|
||||
public double getApparitionsTotal() {
|
||||
return apparitionsTotal;
|
||||
}
|
||||
|
||||
public int getApparitionsPositives() {
|
||||
public double getApparitionsPositives() {
|
||||
return apparitionsPositives;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue