fangfangli / cleartk

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

crfsuite fails on Mac OS X #313

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run "mvn test"

What is the expected output?

Tests run: 2, Failures: 0, Errors: 0, Skipped: 0

What do you see instead?

Running org.cleartk.classifier.crfsuite.CrfSuiteClassifierTest
Jul 18, 2012 2:54:31 PM 
org.cleartk.classifier.crfsuite.CRFSuiteClassifierBuilder trainClassifier(86)
INFO: Start learning CRFsuite classifier
Jul 18, 2012 2:54:32 PM 
org.cleartk.classifier.crfsuite.CRFSuiteWrapper$Executables getExecutable(176)
WARNING: The executable could not be found at crfsuite/mac os 
x_x86_64/bin/crfsuite
Jul 18, 2012 2:54:32 PM 
org.cleartk.classifier.crfsuite.CRFSuiteWrapper$Executables getExecutable(176)
WARNING: The executable could not be found at crfsuite/mac os 
x_x86_64/bin/crfsuite
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 1.288 sec <<< 
FAILURE!

Please use labels and text to provide additional information.

Looks like the problem is in PlatformDetection, assuming that Mac OS X will 
just be named "osx", while mine comes out as "Mac OS X". This is definitely the 
wrong way to test for Mac - here's the officially correct way:

https://developer.apple.com/library/mac/#technotes/tn2002/tn2110.html#FINDINGMAC

But perhaps you could replace this whole PlatformDetection code with the better 
maintained Apache Commons Lang one?

http://commons.apache.org/lang/api-3.1/org/apache/commons/lang3/SystemUtils.html

That would allow you to do something like:

  public PlatformDetection() {
    // resolve OS
    if (SystemUtils.IS_OS_WINDOWS) {
      this.os = OS_WINDOWS;
    } else if (SystemUtils.IS_OS_MAC_OSX) {
      this.os = OS_OSX;
    } else if (SystemUtils.IS_OS_SOLARIS) {
      this.os = OS_SOLARIS;
    } else if (SystemUtils.IS_OS_LINUX) {
      this.os = OS_LINUX;
    } else {
      throw new IllegalArgumentException("Unknown operating system" + SystemUtils.OS_NAME);
    }

    // resolve architecture
    Map<String, String> archMap = new HashMap<String, String>();
    archMap.put("x86", ARCH_X86_32);
    archMap.put("i386", ARCH_X86_32);
    archMap.put("i486", ARCH_X86_32);
    archMap.put("i586", ARCH_X86_32);
    archMap.put("i686", ARCH_X86_32);
    archMap.put("amd64", ARCH_X86_64);
    archMap.put("powerpc", ARCH_PPC);
    this.arch = archMap.get(SystemUtils.OS_ARCH);
    if (this.arch == null) {
      throw new IllegalArgumentException("Unknown architecture" + SystemUtils.OS_ARCH);
    }
  }

Original issue reported on code.google.com by steven.b...@gmail.com on 18 Jul 2012 at 9:41

GoogleCodeExporter commented 9 years ago
Fixed the PlatformDetection issue in r3916.

Original comment by steven.b...@gmail.com on 18 Jul 2012 at 11:55

GoogleCodeExporter commented 9 years ago

Original comment by steven.b...@gmail.com on 5 Aug 2012 at 8:46