Reputation: 121
I'm using WNetSS API in my research to calculate semantic similarity between words. I followed their instructions listed in this page. I run the first example and it worked perfectly and the database has loaded successfully, but when I tried to run the second example, this error has been shown:
run:
The database WordnetSemanticSimilarity is created.
Feb 13, 2018 11:34:07 PM net.sf.extjwnl.dictionary.Dictionary setInstance
INFO: Installing dictionary net.sf.extjwnl.dictionary.FileBackedDictionary@e73f9ac
Loading WordNet2.1 in progress ...
Exception in thread "main" com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '1740-noun' for key 'PRIMARY'
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.Util.getInstance(Util.java:386)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1040)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4074)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4006)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2468)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2629)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2719)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2155)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2450)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2371)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2355)
at WordNetSemanticSimilarity.WordNetTreatment.WordNetProcessing.LoadWordNetInDataBase(WordNetProcessing.java:259)
at wnetssexamples.Example0.main(Example0.java:39)
C:\Users\Administrator\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned: 1
BUILD FAILED (total time: 1 second)
I tried to open the created DB from the first example and I found that there four rows have the same key value, but not sure if this is will change the logic of the api:
When I tried further to find how many duplicated rows in that table I found a huge number as shown in the following figure:
Please I'm not sure how to fix this issue since I didn't create the DB myself I'm just loading it. Not sure if this is the author's fault or I did something wrong. Your fast response will help a lot.
Thank you
Upvotes: 1
Views: 286
Reputation: 414
This is because you runned example 0 twice which will duplicate records in the dataset, what should be done is run example 0 , then example 1 run it four time each with changing the following line:
For the first time POS pos=POS.ADVERB;
The second time POS pos=POS.ADJECTIVE;
The third time POS pos=POS.NOUN;
The fourth time POS pos=POS.VERB;
Then run example 6 four times with the same modifications done in example 1.
Then try to comment these classes and never run them again so the database and tables will not be overwritten.
Upvotes: 1