Hi all,

I've been using JWNL for about 6 months now to do natural language processing on queries for our text engine and recently ran into problems when porting our product to a Windows 2003 Server environment.

Firstly, excellent library - found it very easy to use and get up to speed with. Performance seems great too.

I found that the main issue was that JWNL uses different index file naming conventions for Win32 vs Linux/MacOS/Solaris (i.e. "noun.idx" for Win32 vs "index.noun" for Linux/MacOS/Solaris)

Is there any reason for this? Windows environments have long been able to handle the same style of file names as Linux. 

Additionally, I found that FileManagerImpl's use of "\\" to construct a path a bit confusing...

public FileManagerImpl(String searchDir, Class dictionaryFileType) throws IOException {
checkFileType(dictionaryFileType);
_files = new DictionaryCatalogSet(searchDir, dictionaryFileType);
_files.open();
       String sense = "\\index.sense";
        if (JWNL.getVersion().getNumber() < 2.1) {
            sense = "\\sense.idx";
}
        senseFile = new File(searchDir + sense);

        

Grep.setFile(senseFile);
}

What's with the "\\" notation? It causes my unit-tests around the JWNL libraries to fail under Windows XP, but started working when I got rid of them and did something like:

public FileManagerImpl(String searchDir, Class dictionaryFileType) throws IOException {
checkFileType(dictionaryFileType);
_files = new DictionaryCatalogSet(searchDir, dictionaryFileType);
_files.open();
        String sense = "index.sense";
        if (JWNL.getVersion().getNumber() < 2.1) {
            sense = "sense.idx";
}
        senseFile = new File(searchDir, sense);
        
Grep.setFile(senseFile);
}

instead.

Perhaps there is something I'm missing here? I did find my local changes to FileManagerImpl and the following change to AbstractPrincetonDictionaryFile made my jwnl.jar file completely portable between Linux, Windows and MacOS environments for our product, using the same index data files as well (no differentiating between Windows or not for file notation).

public abstract class AbstractPrincetonDictionaryFile extends AbstractDictionaryFile {
private static final String NOUN_EXT = "noun";
private static final String VERB_EXT = "verb";
private static final String ADJECTIVE_EXT = "adj";
private static final String ADVERB_EXT = "adv";

private static final Map _posToExtMap;
    private static final Map _fileTypeToFileNameMap;

static {
_posToExtMap = new HashMap(4, 1);
_posToExtMap.put(POS.NOUN, NOUN_EXT);
_posToExtMap.put(POS.VERB,  VERB_EXT);
_posToExtMap.put(POS.ADJECTIVE, ADJECTIVE_EXT);
_posToExtMap.put(POS.ADVERB, ADVERB_EXT);

_fileTypeToFileNameMap = new HashMap(3, 1);
_fileTypeToFileNameMap.put(DictionaryFileType.INDEX, new FileNames("index", "index"));
_fileTypeToFileNameMap.put(DictionaryFileType.DATA, new FileNames("data", "data"));
_fileTypeToFileNameMap.put(DictionaryFileType.EXCEPTION, new FileNames("exc", "exc"));
}