简体   繁体   中英

How do I set up extJWNL in a Java project?

I am trying to determine whether a set of strings, from an English sentence, are all words from the WordNet dictionary. I put the JARs in a folder in my project in eclipse.

I've downloaded the binary release of extJWNL and put the JARs in a folder called lib.

Eclipse IDE中的项目层次结构,带有名为lib的文件夹,其中包含扩展的JAR

I also added these jar files to the class path and the module path using Right Click > Build Path > Configure Build Path:

Eclipse中当前Java项目的属性中的modulepath和classpath下的JAR文件

I used the following code to try to import dictionary

import net.sf.extjwnl.dictionary;

This error is shown on the import statement

The package net.sf.extjwnl.dictionary is accessible from more than one module: <unnamed>, extjwnl

I thought that this error was showing up because it was a package, not a class/type. But adding a new class and trying to change the package doesn't show this new package, namely WORDNET_JARS, just the default package.

Why is this error being returned and what do I need to do to get rid of the error and import the wordnet packages?

Platforms

I am using Eclipse IDE, and write all this code in Java. The API I am trying to import is the WordNet API.

Edit (8/21/2019)

By removing the module path, it gives a new error:

Only a type can be imported. net.sf.extjwnl.dictionary resolves to a package

I'm surprised it was this easy:

Instead of

import net.sf.extjwnl.dictionary

I had to do

import net.sf.extjwnl.dictionary.*

to get all the types. The only other thing that had to be done had already been done where I add the JARs to the class path

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM