JWNL的配置使用

來源:互聯網
上載者:User

標籤:des   style   blog   http   java   color   

JWNL是什嗎?

JWNL is an API for accessing WordNet-style relational dictionaries. It also provides functionality beyond data access, such as relationship discovery and orphological processing. 

 

jwnl是wordnet的一個API,用來訪問wordnet中的詞典,jwnl是基於java的包。

在使用jwnl之前:

1、先從http://wordnet.princeton.edu/wordnet/download/下載wordnet包,我使用的是WIN下的wordnet2.1版本;

2、按部就班安裝wordnet2.1;

3、從http://sourceforge.net/projects/jwordnet/files/jwnl/下載jwnl,我使用的是jwnl1.4版本,雖然此版本預設調用wordnet2.0,但其曆史更新資訊明確說明從1.4到1.3增加了對wordnet2.1相關介面的調用,所以在此,使用wordnet2.0和wordnet2.1都可以;

4、從jwnl14-rc2/config檔案下找到file_properties.xml檔案,開啟它,找到如下一句:

     <version publisher="Princeton" number="2.0" language="en"/>

    number表示你使用的wordnet版本號碼,我使用2.1,於是將其值修改為2.1;

5、繼續往下找到這一句:

    <param name="dictionary_path" value="c:/program files/wordnet/2.0/dict"/>

    將value值改為你wordnet實際安裝的目錄;

6、將jwnl14-rc2根目錄下的jwnl.jar和jwnl14-rc2/lib下的commons-logging.jar和junit-4.1.jar拷貝到JDK的lib目錄下,並在環境變數的classpath中增加這三個包的目錄值。

 

轉自:http://blog.csdn.net/chz870128/article/details/6284170 

jwnl中的Examples.java執行個體在eclipse中的使用:

1、Examples.java存在於jwnl14-rc2/src/net/didion/jwnl/utilities這個目錄下;

2、在eclipse中建立一java工程;

3、將jwnl14-rc2/src目錄下的net檔案夾整個拷貝粘貼到建立的java工程中;

4、包含額外運行庫:右擊工程->Build Path->Configure Build Path...->在Java Build Path中選擇Libraries標籤->Add External JARs...,找到並將jwnl.jar和commons-logging.jar包含進來;

4、在Examples.java對應的回合組態中設定args參數為:

     F:/eclipseWorkSpace/utilities/src/net/didion/jwnl/utilities/file_properties.xml

     即file_properties.xml檔案路徑;

  自己安裝時出現的問題:

    eclipse報錯:

      Exception in thread "main" java.lang.Error: Unresolved compilation problem:
      Invalid escape sequence (valid ones are \b \t \n \f \r \" \‘ \\ )

      at net.didion.jwnl.utilities.Examples.main(Examples.java:36)

    只是由於路徑中的“/”沒有轉化成逸出字元的緣故,故:把其中的“\”——>“\\”就可以了。

5、運行Examples。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.