opener-project / language-identifier Goto Github PK
View Code? Open in Web Editor NEWLanguage identifier with support for many different languages.
License: Other
Language identifier with support for many different languages.
License: Other
In https://github.com/opener-project/language-identifier/blob/master/lib/opener/language_identifier/cli.rb#L72 a call is being made to see if STDIN.tty?
If true - input is set to nil
If false - input is set to STDIN.read
I don't immediately see the reason for this, so the question is: why?
It seems to be broken now, I get a "length" is not defined for nil error.
Did you consider maybe using ARGF.read so that the LanguageIdentifier works both with STDIN and with filenames?
Hi,
I installed the language-identifier but once I run the example (i.e. echo "This is absolutelty great" | language-identifier ) I get the following error:
NoMethodError: undefined method `length' for nil:NilClass
short_input? at /home/user/.gem/jruby/2.3.1/gems/opener-language-identifier-4.2.2/lib/opener/language_identifier/detector.rb:166
determine_profiles at /home/user/.gem/jruby/2.3.1/gems/opener-language-identifier-4.2.2/lib/opener/language_identifier/detector.rb:158
new_detector at /home/user/.gem/jruby/2.3.1/gems/opener-language-identifier-4.2.2/lib/opener/language_identifier/detector.rb:112
detect at /home/user/.gem/jruby/2.3.1/gems/opener-language-identifier-4.2.2/lib/opener/language_identifier/detector.rb:84
run at /home/user/.gem/jruby/2.3.1/gems/opener-language-identifier-4.2.2/lib/opener/language_identifier.rb:62
block in configure_slop at /home/user/.gem/jruby/2.3.1/gems/opener-language-identifier-4.2.2/lib/opener/language_identifier/cli.rb:74
parse! at /home/user/.gem/jruby/2.3.1/gems/slop-3.6.0/lib/slop.rb:260
parse at /home/user/.gem/jruby/2.3.1/gems/slop-3.6.0/lib/slop.rb:211
run at /home/user/.gem/jruby/2.3.1/gems/opener-language-identifier-4.2.2/lib/opener/language_identifier/cli.rb:20
<main> at /home/user/.gem/jruby/2.3.1/gems/opener-language-identifier-4.2.2/bin/language-identifier:7
load at org/jruby/RubyKernel.java:977
<main> at /home/user/.gem/jruby/2.3.1/bin/language-identifier:22
Could you help me debug the error?
Thanks
Running the following:
bundle exec rake compile
Yields the following error:
Checking for java... yes
mvn package
Checking for java >= 1.7.0... yes
Checking for mvn... yes
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building LanguageDetection 0.0.1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ LanguageDetection ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 55 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ LanguageDetection ---
[INFO] Compiling 12 source files to /home/yorickpeterse/Private/Projects/opener/language-identifier/core/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ LanguageDetection ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/yorickpeterse/Private/Projects/opener/language-identifier/core/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ LanguageDetection ---
[INFO] Compiling 1 source file to /home/yorickpeterse/Private/Projects/opener/language-identifier/core/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ LanguageDetection ---
[INFO] Surefire report directory: /home/yorickpeterse/Private/Projects/opener/language-identifier/core/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running org.vicomtech.opennlp.LanguageDetection.AppTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.007 sec
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ LanguageDetection ---
[INFO] Building jar: /home/yorickpeterse/Private/Projects/opener/language-identifier/core/target/LanguageDetection-0.0.1.jar
[INFO]
[INFO] --- maven-shade-plugin:2.0:shade (default) @ LanguageDetection ---
[INFO] Including net.arnx:jsonic:jar:1.3.0 in the shaded jar.
[INFO] Including org.knallgrau.utils:textcat:jar:1.0.1 in the shaded jar.
[INFO] Replacing original artifact with shaded artifact.
[INFO] Replacing /home/yorickpeterse/Private/Projects/opener/language-identifier/core/target/LanguageDetection-0.0.1.jar with /home/yorickpeterse/Private/Projects/opener/language-identifier/core/target/LanguageDetection-0.0.1-shaded.jar
[INFO] Dependency-reduced POM written at: /home/yorickpeterse/Private/Projects/opener/language-identifier/core/dependency-reduced-pom.xml
[WARNING] Error injecting: org.apache.maven.shared.dependency.graph.internal.Maven3DependencyGraphBuilder
java.lang.NoClassDefFoundError: org/sonatype/aether/graph/DependencyNode
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2521)
at java.lang.Class.getDeclaredMethods(Class.java:1845)
at com.google.inject.spi.InjectionPoint.getInjectionPoints(InjectionPoint.java:674)
at com.google.inject.spi.InjectionPoint.forInstanceMethodsAndFields(InjectionPoint.java:366)
at com.google.inject.internal.ConstructorBindingImpl.getInternalDependencies(ConstructorBindingImpl.java:165)
at com.google.inject.internal.InjectorImpl.getInternalDependencies(InjectorImpl.java:609)
at com.google.inject.internal.InjectorImpl.cleanup(InjectorImpl.java:565)
at com.google.inject.internal.InjectorImpl.initializeJitBinding(InjectorImpl.java:551)
at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:865)
at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:790)
at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:278)
at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:210)
at com.google.inject.internal.InjectorImpl.getProviderOrThrow(InjectorImpl.java:986)
at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:1019)
at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:982)
at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1032)
at org.eclipse.sisu.reflect.AbstractDeferredClass.get(AbstractDeferredClass.java:44)
at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:86)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:55)
at com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInternalFactory.java:70)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:100)
at org.eclipse.sisu.plexus.lifecycles.PlexusLifecycleManager.onProvision(PlexusLifecycleManager.java:134)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:109)
at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:55)
at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:68)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:47)
at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1054)
at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
at com.google.inject.Scopes$1$1.get(Scopes.java:59)
at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:997)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1047)
at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:993)
at org.eclipse.sisu.locators.LazyBeanEntry.getValue(LazyBeanEntry.java:82)
at org.eclipse.sisu.plexus.locators.LazyPlexusBean.getValue(LazyPlexusBean.java:52)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:259)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:239)
at org.apache.maven.shared.dependency.graph.internal.DefaultDependencyGraphBuilder.buildDependencyGraph(DefaultDependencyGraphBuilder.java:60)
at org.apache.maven.plugins.shade.mojo.ShadeMojo.updateExcludesInDeps(ShadeMojo.java:965)
at org.apache.maven.plugins.shade.mojo.ShadeMojo.createDependencyReducedPom(ShadeMojo.java:938)
at org.apache.maven.plugins.shade.mojo.ShadeMojo.execute(ShadeMojo.java:544)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:318)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:153)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:414)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:357)
Caused by: java.lang.ClassNotFoundException: org.sonatype.aether.graph.DependencyNode
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
... 64 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.473s
[INFO] Finished at: Thu Sep 26 13:52:13 CEST 2013
[INFO] Final Memory: 24M/171M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:2.0:shade (default) on project LanguageDetection: Execution default of goal org.apache.maven.plugins:maven-shade-plugin:2.0:shade failed: A required class was missing while executing org.apache.maven.plugins:maven-shade-plugin:2.0:shade: org/sonatype/aether/graph/DependencyNode
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.apache.maven.plugins:maven-shade-plugin:2.0
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/home/yorickpeterse/.m2/repository/org/apache/maven/plugins/maven-shade-plugin/2.0/maven-shade-plugin-2.0.jar
[ERROR] urls[1] = file:/home/yorickpeterse/.m2/repository/org/sonatype/sisu/sisu-inject-bean/1.4.2/sisu-inject-bean-1.4.2.jar
[ERROR] urls[2] = file:/home/yorickpeterse/.m2/repository/org/sonatype/sisu/sisu-guice/2.1.7/sisu-guice-2.1.7-noaop.jar
[ERROR] urls[3] = file:/home/yorickpeterse/.m2/repository/org/sonatype/aether/aether-util/1.7/aether-util-1.7.jar
[ERROR] urls[4] = file:/home/yorickpeterse/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14.jar
[ERROR] urls[5] = file:/home/yorickpeterse/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
[ERROR] urls[6] = file:/home/yorickpeterse/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
[ERROR] urls[7] = file:/home/yorickpeterse/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[8] = file:/home/yorickpeterse/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar
[ERROR] urls[9] = file:/home/yorickpeterse/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.1/plexus-utils-3.0.1.jar
[ERROR] urls[10] = file:/home/yorickpeterse/.m2/repository/asm/asm/3.3.1/asm-3.3.1.jar
[ERROR] urls[11] = file:/home/yorickpeterse/.m2/repository/asm/asm-commons/3.3.1/asm-commons-3.3.1.jar
[ERROR] urls[12] = file:/home/yorickpeterse/.m2/repository/asm/asm-tree/3.3.1/asm-tree-3.3.1.jar
[ERROR] urls[13] = file:/home/yorickpeterse/.m2/repository/org/jdom/jdom/1.1/jdom-1.1.jar
[ERROR] urls[14] = file:/home/yorickpeterse/.m2/repository/org/apache/maven/shared/maven-dependency-tree/2.0/maven-dependency-tree-2.0.jar
[ERROR] urls[15] = file:/home/yorickpeterse/.m2/repository/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar
[ERROR] urls[16] = file:/home/yorickpeterse/.m2/repository/org/vafer/jdependency/0.7/jdependency-0.7.jar
[ERROR] urls[17] = file:/home/yorickpeterse/.m2/repository/commons-io/commons-io/1.3.2/commons-io-1.3.2.jar
[ERROR] urls[18] = file:/home/yorickpeterse/.m2/repository/asm/asm-analysis/3.2/asm-analysis-3.2.jar
[ERROR] urls[19] = file:/home/yorickpeterse/.m2/repository/asm/asm-util/3.2/asm-util-3.2.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------: org.sonatype.aether.graph.DependencyNode
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/AetherClassNotFound
rake aborted!
Command failed with status (1): [mvn package...]
/home/yorickpeterse/.gem/ruby/1.9.3/gems/opener-build-tools-0.2.10/lib/opener/build-tools/tasks/java.rb:11:in `block (3 levels) in <top (required)>'
/home/yorickpeterse/.gem/ruby/1.9.3/gems/opener-build-tools-0.2.10/lib/opener/build-tools/tasks/java.rb:10:in `chdir'
/home/yorickpeterse/.gem/ruby/1.9.3/gems/opener-build-tools-0.2.10/lib/opener/build-tools/tasks/java.rb:10:in `block (2 levels) in <top (required)>'
Tasks: TOP => compile => java:compile
(See full trace by running task with --trace)
Java version:
java version "1.7.0_40"
OpenJDK Runtime Environment (IcedTea 2.4.1) (ArchLinux build 7.u40_2.4.1-3-x86_64)
OpenJDK 64-Bit Server VM (build 24.0-b50, mixed mode)
Hello!
I've followed the getting started instructions for a local installation from here: http://www.opener-project.eu/getting-started/how-to/local-installation.html
Everything worked fine until I tried to execute the first example:
echo "This is absolutelty great" | language-identifier
When I do this, I get a load error for a .jar:
[...]/opener-language-identifier-4.2.2/lib/opener/language_identifier.rb:5:in
require_relative': cannot load such file -- [...]/opener-language-identifier-4.2.2/core/target/LanguageDetection-1.0.0.jar (LoadError)`
The .jar file is present in the specified path, so I really don't understand what the problem is...
Can you help me, please?
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.