POS Tagging output is different for the stanford parser and the stanford corenlp online versions? - pos-tagger

Is the model files being used by the parser(http://nlp.stanford.edu:8080/parser/index.jsp) and corenlp(http://nlp.stanford.edu:8080/corenlp/process) are different? Or is there a corenlp version difference at the back end?
Input Text: "I want Hand Wash."
From parser: (ROOT (S (NP (PRP I)) (VP (VBP want) (NP (NNP Hand) (NNP Wash.))) (. .)))
From corenlp: (ROOT (S (NP (PRP I)) (VP (VBP want) (VP (VB Hand) (NP (NNP Wash.)))) (. .)))
I have tried the stanford api calls also but the output resembles the corenlp version, so I want to find the api call which can give me the output similar to the parser version above as that is the corect one.

Related

Go custom package import error

I am trying to write a program where I have a structure like:
Go/src/
-github.com
-myname
-hello
main.go
-vector
vector.go
When I import the package in my code inside of the main.go file using a command like:
import(
"vector"
)
I get the error message:
Can't find package "vector" in any of:
C:\Go\src\vendor\vector (vendor tree)
C:\Go\src\vertex (from $GOROOT)
C:\Go\src\github.com\myname\src\vertex (from $GOPATH)
Why is it adding src on that last line? Shouldn't it replace the src with the hello folder since that is where I'm running the file from? Also, it runs if I import it from the full file structure like github.com/myname/hello/vertex which seems strange to me.
I am executing using go run hello.go to simplify my interaction with the program.
Your Go code (as opposed to Go's stdlib) is meant to be under $GOPATH/src (edit: not $GOROOT, as I initially said!), and it's standard to always use the full import path, in your case starting with github.com/ (even if you figured out a way to avoid having to).
There is more in How to Write Go Code by the Go team, and other answers here describing project layout and the first steps to setting a workspace up.

How do I build ANTLR 3 grammars with import using Gradle?

I have a base grammar (FooBase.g) and two grammar that include it:
lexer grammar FooVariantA;
import base = FooBase;
...
lexer grammar FooVariantB;
import base = FooBase;
...
If I put all three files into src/main/antlr, the base grammar is compiled and this of course fails: it shouldn't be compiled, because it refers to some rules that are only defined in the "final" FooVariantA and FooVariantB grammars.
However, it seems I also cannot create src/main/antlr/imports subdirectory as with Maven, as Gradle ANTLR plugin never looks there:
error(7): cannot find or open file: FooBase.g; reason: java.io.FileNotFoundException: /home/test/test/src/main/antlr/FooBase.g (No such file or directory)
How can I make only the two final grammars compile and still be able to find the imported base grammar?
Turns out to be as simple as this:
generateGrammarSource {
exclude ('**/*Base.g')
}

Spring Boot: Thymeleaf not resolving fragments after packaging

im using fragments like this:
#RequestMapping(value="/fragment/nodeListWithStatus", method= RequestMethod.GET)
public String nodeListWithStatus(Model model) {
// status der nodes
model.addAttribute("nodeList", nodeService.getNodeListWithOnlineStatus());
return "/fragments :: nodeList";
}
The templates are in /src/main/resources/templates. This works fine when starting the application from IntelliJ.
As soon as i create an .jar and start it, above code no longer works. Error:
[2014-10-21 20:37:09.191] log4j - 7941 ERROR [http-nio-666-exec-2] --- TemplateEngine: [THYMELEAF][http-nio-666-exec-2] Exception processing template "/fragments": Error resolving template "/fragments", template might not exist or might not be accessible by any of the configured Template Resolvers
When i open the .jar with winrar, i see /templates/fragments.html - so it seems to be there.
My pom.xml has this part for building the jar (Maven clean, install) :
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>de.filth.Application</mainClass>
<layout>JAR</layout>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Can anyone tell me what im doing wrong here?
Thanks!
You don't need the leading / on the view name, i.e. you should return fragments :: nodeList rather than /fragments :: nodeList. Having made this change Thymeleaf should be able to find the template when run from your IDE or from a jar file.
If you're interested, here's what's happening under the hood:
The view name is used to search for a resource on the classpath. fragments :: nodeList means that the resource name is /templates/fragments.html and /fragments :: nodeList means that the resource name is /templates//fragments.html (note the double slash). When you're running in your IDE the resource is available straight off the filesystem and the double slash doesn't cause a problem. When you're running from a jar file the resource is nested within that jar and the double slash prevents it from being found. I don't fully understand why there's this difference in behaviour and it is rather unfortunate. I've opened an issue so that we (the Spring Boot team) can see if there's anything we can do to make the behaviour consistent.
It's an old topic, but I stumbled upon it while having problem with similar symptoms and different root cause. Wanted to share solution which helped me in case it could help somebody else...
Apparently name of the messages.properties file is case sensitive, but not everywhere. I had mine called "Messages.properties" (with capital M) and it worked just fine from inside IDE (IntelliJ), but once I tried to run app from jar, all messages were replaced with ??parameter.name??. Replacing M with lowercase m resolved the problem.

How to use bnd directives from maven-bundle-plugin?

How can I use bnd directives instruction from maven-bundle-plugin? bnd directives are starting with a '-' character, and this is an invalid xml tag:
<-foo>bar</-foo>
I have checked the official page for maven-bundle-plugin, and they said that it should start with a '-' character as well:
Directives - Any instruction starting with a '-' character is considered to be a directive that informs BND to perform some special processing and is not copied to the manifest.
The bundle goal description doesn't seem to have this information as well.
to perform some special processing and is not copied to the manifest.
Replace the '-' character with '_' character. This will work:
<_foo>bar</_foo>
It is actually vaguely described in the FAQ page:
(this is <_exportcontents> in the POM because a tag can't start with '-')
This improvement also can be found in their issue tracker.
There is an alternative way to define the bnd instructions with less xml clutter:
Configure the plugin like this:
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<_include>-osgi.bnd</_include>
</instructions>
</configuration>
</plugin>
and provide a file (here: osgi.bnd) with the instructions, e.g.
Import-Package: !javax.servlet,\
!org.apache.avalon.framework.logger,\
org.apache.commons.collections;version="[1.0,2)",\
org.apache.commons.collections.comparators;version="[1.0,2)",\
org.apache.commons.collections.keyvalue;version="[1.0,2)",\
org.apache.commons.collections.list;version="[1.0,2)",\
org.apache.commons.collections.set;version="[1.0,2)",\
!org.apache.log,\
!org.apache.log4j,\
*
Export-Package: *
Remark: There is a minus sign in the _include tag before the filename!
A real life example can be found here:
pom.xml file and osgi.bnd file.

How to use clojure's compile function with a script containing :gen-class?

After 3 days of frustration I must ask for help. Being quite new to clojure I want to compile this script from the REPL using (compile 'examples.hello) adapted from AOT page of clojure.org:
(ns examples.hello
(:gen-class))
(defn -main
[greetee]
(println (str "Hello " greetee "!")))
I use JEdit with the clojure console plugin as my editor and for serious projects leiningen.
My dir structure in $HOME is:
clojure-1.3.0 (edited to save space)
|-- classes
|-- clojure-1.3.0.jar
|-- clojure-1.3.0-slim.jar
|-- src
| |-- examples
| | |-- hello.clj
| | `-- hello.clj~
| |-- jvm
|
The error msg is:
FileNotFoundException Could not locate examples/hello__init.class or examples/hello.clj on classpath: clojure.lang.RT.load (RT.java:430)
Some questions:
a) If I am compiling why should the compile function look for the very class files I am attempting to create?
b) What are the 'correct' steps to make the compile function work? c) In my Internet search on this problem there are many reference to 'the classpath' or 'your classpath'; is it correct to assume that classpath refers to clojure.jar etc. and the scripts one is working on and not to java $CLASSPATH which supposedly has been unnecessary since java 1.5?
I apologize for the awkward answer, but I do not yet understand Clojure builds as well as some other languages. So, please bear with me. I am writing this answer from the point of view that you are using a build tool like lein.
Your main -- mine is addr-verify -- must be in the name space specified by the project.clj that accompanies your project. So my main module is core.clj, and it declares its name space as addr-verify, and for lack of a better term declares or uses gen-class.
My project.clj denotes that main is addr-verify.
One of the nice things about lein to build Clojure applications, is it sets all this up for you when you create a project, for example lein create my-test-proj .
Here are the pertinent lines from my ./addr-verify/project.clj
(defproject addr-verify "1.0.0-SNAPSHOT"
:description "TODO: add summary of your project"
:dependencies [[org.clojure/clojure "1.2.1"]
[clojure-csv/clojure-csv "1.2.4"]
[org.clojure/tools.cli "0.1.0"]
[clj-http "0.1.3"]]
:aot [addr-verify]
:main addr-verify)
Here are the first few lines from ./addr-verify/src/addr_verify/core.clj
(ns addr-verify
(:gen-class)
(:require [clojure.string :as cstr])
(:require [clojure.contrib.str-utils :as ustr])
(:require [clj-http.client :as client])
(:use clojure-csv.core)
(:use [clojure.tools.cli])
(:import java.util.Date)
(:import java.lang.Thread)
(:import java.io.File)

Resources