idilhaq / duke

Automatically exported from code.google.com/p/duke
0 stars 1 forks source link

Can't start the genetic.py script #121

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
 I think the script needs to be adjusted for the new 1.0 duke lib:

Attempt #1:

Traceback (most recent call last):
  File "genetic.py", line 10, in <module>
    from no.priv.garshol.duke import ConfigLoader, Processor, PropertyImpl, DukeConfigException
ImportError: cannot import name PropertyImpl

Attempt #2 (removed PropertyImpl):

Traceback (most recent call last):
  File "genetic.py", line 243, in <module>
    config = ConfigLoader.load(configfile)
    at no.priv.garshol.duke.ConfigLoader.instantiate(ConfigLoader.java:257)
    at no.priv.garshol.duke.ConfigLoader.access$100(ConfigLoader.java:35)
    at no.priv.garshol.duke.ConfigLoader$ConfigHandler.endElement(ConfigLoader.java:202)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2939)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:647)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1132)
    at no.priv.garshol.duke.ConfigLoader.load(ConfigLoader.java:53)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)

no.priv.garshol.duke.DukeConfigException: 
no.priv.garshol.duke.DukeConfigException: Couldn't instantiate class 
no.priv.garshol.duke.Levenshtein: java.lang.ClassNotFoundException: 
no.priv.garshol.duke.Levenshtein

Original issue reported on code.google.com by ale...@yoxel.com on 16 Jun 2013 at 5:53

GoogleCodeExporter commented 9 years ago
Actually, nevermind, the 2nd error must be my .xml config mistake.
But PropertyImpl seems to be an problem.

Original comment by ale...@yoxel.com on 16 Jun 2013 at 5:58

GoogleCodeExporter commented 9 years ago
Ok, I switched to target/classes/ dir instead of duke-1.0.jar:

===== GENERATION 0 ===================================
[GeneticConfiguration 0.96 [Property LAST_NAME SoundexComparator 0.44 0.98 
[Property FIRST_NAME JaroWinklerTokenized 0.27 0.72 [Property ID Non 0.0 0.0 
[Property PHONE NorphoneComparator 0.07 0.86 [Property EMAIL 
WeightedLevenshtein 0.09 0.96] # 0
Traceback (most recent call last):
  File "genetic.py", line 307, in <module>
    f = evaluate(c)
  File "genetic.py", line 234, in evaluate
    testfile.close()
AttributeError: 'no.priv.garshol.duke.matchers.TestFileListener' object has no 
attribute 'close'

Original comment by ale...@yoxel.com on 16 Jun 2013 at 6:03

GoogleCodeExporter commented 9 years ago
Tried to remove that line, new errors. Will need your help here.

===== GENERATION 0 ===================================
[GeneticConfiguration 0.78 [Property LAST_NAME MetaphoneComparator 0.47 0.74 
[Property FIRST_NAME JaroWinklerTokenized 0.24 0.53 [Property ID Non 0.0 0.0 
[Property PHONE GeopositionComparator 0.27 0.62 [Property EMAIL 
WeightedLevenshtein 0.43 0.7] # 0
   0.0 
[GeneticConfiguration 0.78 [Property LAST_NAME Levenshtein 0.4 0.72 [Property 
FIRST_NAME WeightedLevenshtein 0.14 0.53 [Property ID Non 0.0 0.0 [Property 
PHONE SoundexComparator 0.33 0.5 [Property EMAIL Levenshtein 0.04 0.5] # 1
   0.0 
[GeneticConfiguration 0.41 [Property LAST_NAME Levenshtein 0.34 0.94 [Property 
FIRST_NAME QGramComparator 0.49 0.93 [Property ID Non 0.0 0.0 [Property PHONE 
GeopositionComparator 0.42 0.61 [Property EMAIL JaroWinkler 0.24 0.52] # 2
   1.0 

BEST SO FAR: 1.0

Traceback (most recent call last):
  File "genetic.py", line 319, in <module>
    population = sorted(population, key = lambda c: 1.0 - index[c])
  File "genetic.py", line 319, in <lambda>
    population = sorted(population, key = lambda c: 1.0 - index[c])
KeyError: <__main__.GeneticConfiguration instance at 0x2>

Original comment by ale...@yoxel.com on 16 Jun 2013 at 6:21

GoogleCodeExporter commented 9 years ago
My apologies for the first errors: I'm still working on this script (and its 
cousin, active.py). 

The last error is kind of funny, though. If you just take the last 
configuration there, you've got a configuration that, according to your test 
file, is perfect. It always makes the right decision. 

That's never happened before, so clearly that code path has never been tested, 
and it appears there's a bug. :-)

I've pushed a patch for the problem now. However, I think if the third, totally 
random, configuration that is tried comes up with a perfect score, you have a 
test file that's too small. You may want to consider using active.py instead, 
which doesn't need a test file.

Original comment by lar...@gmail.com on 18 Jun 2013 at 7:04

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 44897db32518.

Original comment by lar...@gmail.com on 18 Jun 2013 at 7:05