я выполнил этот код:RetrievalException в WordNet код
package edu.smu.tspell.wordnet;
import java.util.Scanner;
public class TestJAWS
{
/**
* Main entry point. The command-line arguments are concatenated together
* (separated by spaces) and used as the word form to look up.
*/
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
args = new String[] {"airplane"};
if (args.length > 0)
{
// Concatenate the command-line arguments
StringBuffer buffer = new StringBuffer();
for (int i = 0; i < args.length; i++)
{
buffer.append((i > 0 ? " " : "") + args[i]);
}
String wordForm = buffer.toString();
// Get the synsets containing the wrod form
WordNetDatabase database = WordNetDatabase.getFileInstance();
Synset[] synsets = database.getSynsets(wordForm);
// Display the word forms and definitions for synsets retrieved
if (synsets.length > 0)
{
System.out.println("The following synsets contain '" +
wordForm + "' or a possible base form " +
"of that text:");
for (int i = 0; i < synsets.length; i++)
{
System.out.println("");
String[] wordForms = synsets[i].getWordForms();
for (int j = 0; j < wordForms.length; j++)
{
System.out.print((j > 0 ? ", " : "") +
wordForms[j]);
}
System.out.println(": " + synsets[i].getDefinition());
}
}
else
{
System.err.println("No synsets exist that contain " +
"the word form '" + wordForm + "'");
}
}
else
{
System.err.println("You must specify " +
"a word form for which to retrieve synsets.");
}
}
}
, но я получаю эту ошибку:
Exception in thread "main" edu.smu.tspell.wordnet.impl.file.RetrievalException: Error opening index file: .\C:\Users\piyush_p\Desktop\workspace\Wordnet\src\WordNet-3.0\dict\index.sense (The filename, directory name, or volume label syntax is incorrect)
at edu.smu.tspell.wordnet.impl.file.SenseIndexReader.getInstance(SenseIndexReader.java:88)
at edu.smu.tspell.wordnet.impl.file.WordFormLookup.loadSynsets(WordFormLookup.java:273)
at edu.smu.tspell.wordnet.impl.file.WordFormLookup.getSynsets(WordFormLookup.java:230)
at edu.smu.tspell.wordnet.impl.file.WordFormLookup.getSynsets(WordFormLookup.java:172)
at edu.smu.tspell.wordnet.impl.file.FileDatabase.getSynsets(FileDatabase.java:87)
at edu.smu.tspell.wordnet.WordNetDatabase.getSynsets(WordNetDatabase.java:61)
at edu.smu.tspell.wordnet.TestJAWS.main(TestJAWS.java:28)
Caused by: java.io.FileNotFoundException: .\C:\Users\piyush_p\Desktop\workspace\Wordnet\src\WordNet-3.0\dict\index.sense (The filename, directory name, or volume label syntax is incorrect)
at java.io.RandomAccessFile.open(Native Method)
at java.io.RandomAccessFile.<init>(Unknown Source)
at edu.smu.tspell.wordnet.impl.RandomAccessReader.<init>(RandomAccessReader.java:75)
at edu.smu.tspell.wordnet.impl.LineLocator.<init>(LineLocator.java:54)
at edu.smu.tspell.wordnet.impl.MultipleLineLocator.<init>(MultipleLineLocator.java:48)
at edu.smu.tspell.wordnet.impl.file.SenseIndexReader.<init>(SenseIndexReader.java:102)
at edu.smu.tspell.wordnet.impl.file.SenseIndexReader.getInstance(SenseIndexReader.java:83)
... 6 more`enter code here`
чека, если словарь присутствует в пути –
И вопрос? –
Вызвано: java.io.FileNotFoundException:. \ C: \ Users \ piyush_p \ Desktop \ workspace \ Wordnet \ src \ WordNet-3.0 \ dict \ index.sense (неверно имя файла, имя каталога или тома) .. довольно легко, да? –