Erreu syntaxique
unknown
-
unknown -
unknown -
Bonjour,
j'ai implémenté le code de Tf d'un fichier texte mais quand je execute : s'affiche ce message la s'il veux plais quelque aide
j'ai implémenté le code de Tf d'un fichier texte mais quand je execute : s'affiche ce message la s'il veux plais quelque aide
Please enter the required word :
m
The word inputted is m
_________________
| File = abc0.txt |
File is not found
The word inputted is m
_________________
| File = abc1.txt |
File is not found
The word inputted is m
_________________
| File = abc2.txt |
File is not found
The word inputted is m
_________________
| File = abc3.txt |
File is not found
The word inputted is m
_________________
| File = abc4.txt |
File is not found
The word inputted is m
_________________
| File = abc5.txt |
File is not found
The word inputted is m
_________________
| File = abc6.txt |
File is not found
The word inputted is m
_________________
| File = abc7.txt |
File is not found
The word inputted is m
_________________
| File = abc8.txt |
File is not found
The word inputted is m
_________________
| File = abc9.txt |
File is not found
The word inputted is m
_________________
| File = abc10.txt |
File is not found
package o; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class o{ @SuppressWarnings("resource") public static void main(String[] args) throws IOException { // TODO Auto-generated method stub // Calculating term frequency System.out.println("Please enter the required word :"); Scanner scan = new Scanner(System.in); String word = scan.nextLine(); String[] array = word.split(" "); int filename = 11; String[] fileName = new String[filename]; int a = 0; int totalCount = 0; int wordCount = 0; for (a = 0; a < filename; a++) { try { System.out.println("The word inputted is " + word); File file = new File("C:/Users/IBB INFO/workspace/imene" + a + "a.txt"); System.out.println(" _________________"); System.out.print("| File = abc" + a + "a.txt | \t\t \n"); for (int i = 0; i < array.length; i++) { totalCount = 0; wordCount = 0; Scanner s = new Scanner(file); { while (s.hasNext()) { totalCount++; if (s.next().equals(array[i])) wordCount++; } System.out.print(array[i] + " ---> Word count = " + "\t\t " + "|" + wordCount + "|"); System.out.print(" Total count = " + "\t\t " + "|" + totalCount + "|"); System.out.printf(" Term Frequency = | %8.4f |", (double) wordCount / totalCount); System.out.println("\t "); } } } catch (FileNotFoundException e) { System.out.println("File is not found"); } } } }
1 réponse
Bonjour,
"j'ai implémenté le code"
Pourquoi ne pas assumer que ce programme n'est pas le tien ?
Si tu avais toi même fait ce code tu comprendrais le message d'erreur et tu ne poserais pas cette question...
Le code d'origine est là : https://stackoverflow.com/questions/5281476/why-do-i-only-get-one-result-of-tf-idf
L'auteur charge ses fichiers (abc0.txt, abc1.txt... abc10.txt) grâce à :
Toi tu as remplacé cette ligne par :
Sauf que bien sûr les fichiers imene0.txt, imene1.txt... imene10.txt n'existent pas et ça renvoie une FileNotFoundException d'où le message.
"j'ai implémenté le code"
Pourquoi ne pas assumer que ce programme n'est pas le tien ?
Si tu avais toi même fait ce code tu comprendrais le message d'erreur et tu ne poserais pas cette question...
Le code d'origine est là : https://stackoverflow.com/questions/5281476/why-do-i-only-get-one-result-of-tf-idf
L'auteur charge ses fichiers (abc0.txt, abc1.txt... abc10.txt) grâce à :
new File("C:\\Users\\user\\fypworkspace\\TextRenderer\\abc" + a + ".txt");
Toi tu as remplacé cette ligne par :
new File("C:/Users/IBB INFO/workspace/imene" + a + "a.txt");
Sauf que bien sûr les fichiers imene0.txt, imene1.txt... imene10.txt n'existent pas et ça renvoie une FileNotFoundException d'où le message.
unknown
après ton explication et j'arrive pas de comprendre que-dois-je-faire stp !!