ca marche
This commit is contained in:
parent
501f644eda
commit
5fedc6bc16
|
|
@ -14,8 +14,15 @@ public class Avis {
|
|||
film = f;
|
||||
url = u;
|
||||
}
|
||||
|
||||
public Avis() {
|
||||
commentaire = "com";
|
||||
positif = 0;
|
||||
film = 0;
|
||||
url = "u";
|
||||
}
|
||||
|
||||
public static int Analyse(List<String> a, Dictionnaire dico) {
|
||||
public int Analyse(List<String> a, Dictionnaire dico) {
|
||||
int moyenne = 0;
|
||||
int sommenote = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public class Dictionnaire {
|
|||
|
||||
try {
|
||||
String nom = valeurs[0].trim();
|
||||
int sentiment = Integer.parseInt(valeurs[3].trim());
|
||||
double sentiment = Double.parseDouble(valeurs[3].trim());;
|
||||
int apparitionsTotal = Integer.parseInt(valeurs[1].trim());
|
||||
int apparitionsPositives = Integer.parseInt(valeurs[2].trim());
|
||||
Mot m = new Mot(nom, sentiment, apparitionsTotal, apparitionsPositives);
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public class ListeAvis {
|
|||
|
||||
listeAvis.add(new Avis(numeroFilm, url, commentaire, polarite));
|
||||
} catch (NumberFormatException e) {
|
||||
System.err.println("Erreur de conversion dans la ligne : " + ligne);
|
||||
System.err.println("Erreur deffffffffffffff conversion dans la ligne : " + ligne);
|
||||
}
|
||||
}
|
||||
System.out.println("Fichier CSV chargé avec succès !");
|
||||
|
|
|
|||
|
|
@ -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,12 +17,13 @@ public class Main {
|
|||
// Avis.Analyse(a, dictionnaire);
|
||||
|
||||
|
||||
dictionnaire.apprentissageSentiment(listeAvis.getListeAvis());
|
||||
// dictionnaire.apprentissageSentiment(listeAvis.getListeAvis());
|
||||
|
||||
dictionnaire.sauvegarderDictionnaireCSV(cheminSauvegarde);
|
||||
dictionnaire.getDico()
|
||||
// dictionnaire.sauvegarderDictionnaireCSV(cheminSauvegarde);
|
||||
// dictionnaire.getDico()
|
||||
;
|
||||
///Dictionnaire d =new Dictionnaire("C:\\Users\\Qpelu\\Downloads\\dictionnaire.csv");
|
||||
//System.out.println(d);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
|
@ -41,7 +41,7 @@ public class inter extends JFrame {
|
|||
private ListeAvis listeAvis;
|
||||
|
||||
// Cache des données
|
||||
private final Map<Integer, List<String>> commentairesFilms = new HashMap<>();
|
||||
// private final Map<Integer, List<String>> commentairesFilms = new HashMap<>();
|
||||
private final Map<Integer, Integer> notesFilms = new HashMap<>();
|
||||
private final Map<String, Integer> dictionnaireSentiments = new HashMap<>();
|
||||
|
||||
|
|
@ -200,8 +200,9 @@ public class inter extends JFrame {
|
|||
private int calculerNoteMoyenne(int filmNumber) {
|
||||
int totalNotes= 0;
|
||||
Dictionnaire dico=new Dictionnaire("C:\\Users\\Qpelu\\Downloads\\dictionnaire.csv");
|
||||
Avis av = new Avis();
|
||||
|
||||
totalNotes += Avis.Analyse(listeAvis.getCommentairesParFilm(filmNumber), dico);
|
||||
totalNotes += av.Analyse(listeAvis.getCommentairesParFilm(filmNumber), dico);
|
||||
System.out.println(totalNotes);
|
||||
|
||||
|
||||
|
|
@ -393,11 +394,12 @@ public class inter extends JFrame {
|
|||
private void ajouterCommentaire(int filmNumber, String c) {
|
||||
// Récupérer la liste des commentaires
|
||||
Dictionnaire dico = new Dictionnaire("C:\\Users\\Qpelu\\Downloads\\dictionnaire.csv");
|
||||
Avis av =new Avis();
|
||||
List<String> commentaires = listeAvis.getCommentairesParFilm(filmNumber);
|
||||
commentaires.add(c);
|
||||
|
||||
// Calculer la nouvelle note moyenne
|
||||
int noteMoyenne = Avis.Analyse(commentaires, dico);
|
||||
int noteMoyenne = av.Analyse(commentaires, dico);
|
||||
notesFilms.put(filmNumber, noteMoyenne);
|
||||
|
||||
// Mettre à jour l'interface
|
||||
|
|
|
|||
Loading…
Reference in New Issue