我正在做关于“网络视频分类”的最后一年项目,其中一部分是找到特定单词的相似(同义词)单词,我想从中删除相似的术语。
我知道 Java 语言,所以我选择了“Java Word Similarity” ws4j
为此,我只使用了 WS4J1.0.1 jar 文件,即使我没有下载任何额外的文件,如WordNet词法数据库或sqlite数据库来存储它。因为在那个网站上,他们提到所有都包含在这个 jar 文件中。
当我执行演示程序SimilarityCalculationDemo.java时,出现以下错误:
java.sql.BatchUpdateException: batch entry 0: [SQLITE_CORRUPT] The database disk image is malformed (database disk image is malformed)
at org.sqlite.Stmt.executeBatch(Stmt.java:226)
at org.sqlite.Stmt.executeBatch(Stmt.java:226)
at edu.cmu.lti.jawjaw.db.SQL.createIndexIfNotExists(SQL.java:118)
at edu.cmu.lti.jawjaw.db.SQL.createSQLConnection(SQL.java:98)
at edu.cmu.lti.jawjaw.db.SQL.<init>(SQL.java:55)
at edu.cmu.lti.jawjaw.db.SQL.<clinit>(SQL.java:45)
at edu.cmu.lti.jawjaw.db.WordDAO.findWordsByLemmaAndPos(WordDAO.java:124)
at edu.cmu.lti.jawjaw.util.WordNetUtil.wordToSynsets(WordNetUtil.java:38)
at edu.cmu.lti.lexical_db.NictWordNet.getAllConcepts(NictWordNet.java:38)
atedu.cmu.lti.ws4j.util.WordSimilarityCalculator.calcRelatednessOfWords(WordSimilarityCalculator.java:79)
at edu.cmu.lti.ws4j.RelatednessCalculator.calcRelatednessOfWords(RelatednessCalculator.java:61)
at web_cat.SimilarityCalculationDemo.run(SimilarityCalculationDemo.java:37)
at web_cat.SimilarityCalculationDemo.main(SimilarityCalculationDemo.java:43)
java.sql.SQLException: [SQLITE_CORRUPT] The database disk image is malformed (database disk image is malformed)
at org.sqlite.DB.newSQLException(DB.java:383)
at org.sqlite.DB.newSQLException(DB.java:387)
at org.sqlite.DB.throwex(DB.java:374)
at org.sqlite.NativeDB.prepare(Native Method)
at org.sqlite.DB.prepare(DB.java:123)
at org.sqlite.Stmt.execute(Stmt.java:113)
at edu.cmu.lti.jawjaw.db.SQL.setPragmaCacheSize(SQL.java:137)
at edu.cmu.lti.jawjaw.db.SQL.createSQLConnection(SQL.java:99)
at edu.cmu.lti.jawjaw.db.SQL.<init>(SQL.java:55)
at edu.cmu.lti.jawjaw.db.SQL.<clinit>(SQL.java:45)
at edu.cmu.lti.jawjaw.db.WordDAO.findWordsByLemmaAndPos(WordDAO.java:124)
at edu.cmu.lti.jawjaw.util.WordNetUtil.wordToSynsets(WordNetUtil.java:38)
at edu.cmu.lti.lexical_db.NictWordNet.getAllConcepts(NictWordNet.java:38)
at edu.cmu.lti.ws4j.util.WordSimilarityCalculator.calcRelatednessOfWords(WordSimilarityCalculator.java:79)
at edu.cmu.lti.ws4j.RelatednessCalculator.calcRelatednessOfWords(RelatednessCalculator.java:61)
at web_cat.SimilarityCalculationDemo.run(SimilarityCalculationDemo.java:37)
at web_cat.SimilarityCalculationDemo.main(SimilarityCalculationDemo.java:43)
java.sql.SQLException: [SQLITE_CORRUPT] The database disk image is malformed (database disk image is malformed)
at org.sqlite.DB.newSQLException(DB.java:383)
at org.sqlite.DB.newSQLException(DB.java:387)
at org.sqlite.DB.throwex(DB.java:374)
at org.sqlite.NativeDB.prepare(Native Method)
at org.sqlite.DB.prepare(DB.java:123)
at org.sqlite.PrepStmt.<init>(PrepStmt.java:42)
at org.sqlite.Conn.prepareStatement(Conn.java:404)
at org.sqlite.Conn.prepareStatement(Conn.java:399)
at org.sqlite.Conn.prepareStatement(Conn.java:383)
at edu.cmu.lti.jawjaw.db.SQL.prepareStatements(SQL.java:151)
at edu.cmu.lti.jawjaw.db.SQL.<init>(SQL.java:56)
at edu.cmu.lti.jawjaw.db.SQL.<clinit>(SQL.java:45)
at edu.cmu.lti.jawjaw.db.WordDAO.findWordsByLemmaAndPos(WordDAO.java:124)
at edu.cmu.lti.jawjaw.util.WordNetUtil.wordToSynsets(WordNetUtil.java:38)
at edu.cmu.lti.lexical_db.NictWordNet.getAllConcepts(NictWordNet.java:38)
at edu.cmu.lti.ws4j.util.WordSimilarityCalculator.calcRelatednessOfWords(WordSimilarityCalculator.java:79)
at edu.cmu.lti.ws4j.RelatednessCalculator.calcRelatednessOfWords(RelatednessCalculator.java:61)
at web_cat.SimilarityCalculationDemo.run(SimilarityCalculationDemo.java:37)
at web_cat.SimilarityCalculationDemo.main(SimilarityCalculationDemo.java:43)
Exception in thread "main" java.lang.NullPointerException
at edu.cmu.lti.jawjaw.db.WordDAO.findWordsByLemmaAndPos(WordDAO.java:125)
at edu.cmu.lti.jawjaw.util.WordNetUtil.wordToSynsets(WordNetUtil.java:38)
at edu.cmu.lti.lexical_db.NictWordNet.getAllConcepts(NictWordNet.java:38)
at edu.cmu.lti.ws4j.util.WordSimilarityCalculator.calcRelatednessOfWords(WordSimilarityCalculator.java:79)
at edu.cmu.lti.ws4j.RelatednessCalculator.calcRelatednessOfWords(RelatednessCalculator.java:61)
at web_cat.SimilarityCalculationDemo.run(SimilarityCalculationDemo.java:37)
at web_cat.SimilarityCalculationDemo.main(SimilarityCalculationDemo.java:43)
Java Result: 1
我正在使用带有 JDK 6 的 Netbeans IDE 7.4。
任何人都可以帮助我,如何克服这个问题,因为互联网上关于ws4j的文档较少。