Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage grammar rules in NooJ CMD #2

Open
roddar92 opened this issue Oct 22, 2019 · 3 comments
Open

Usage grammar rules in NooJ CMD #2

roddar92 opened this issue Oct 22, 2019 · 3 comments

Comments

@roddar92
Copy link

roddar92 commented Oct 22, 2019

Dear colleagues,

I'm exploring NooJ tool for information extraction from Java code directly. There is an example of syntax analysis in tests folder where you check graphical grammars. Could I test the same code with grammar rules, not graphs?
After new grammar inserting (rules set) I caught an exception such as:

`net.nooj4nlp.cmd.io.LinguisticResources$LinguisticResourceException: Invalid statements:
Header not compatible

at net.nooj4nlp.cmd.io.LinguisticResources.loadInto(LinguisticResources.java:38)
at net.nooj4nlp.cmd.NoojTestWithResources.setupLinguisticResources(NoojTestWithResources.java:32)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.rules.ExpectedException$ExpectedExceptionStatement.evaluate(ExpectedException.java:168)
at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)`

Could you tell me what's wrong in my actions? Does your CLI support rules work?

Sincerely yours,
Daria

@numblr
Copy link
Owner

numblr commented Oct 25, 2019

Hi Daria,

It's been quite a while, so I need to look into that in more detail. I just pushed a newer version that has some additional usage information in the README, eventually that could help. The first thing that comes to my mind when looking at the exception is that your files are eventually not the right version? The tool is still on a quite old version of Nooj4j (3.1 from 2014).

Best,
Thomas

@roddar92
Copy link
Author

roddar92 commented Oct 30, 2019

As for me, I'm working with the latest version of NooJ I have found it on their site: http://www.nooj-association.org/index.php?option=com_k2&view=item&layout=item&id=4&Itemid=615. Unfortunately, Maven repository doesn't contain any NooJ version.

The first comment in your grammar file is: #OpenNooJ 1.0
My grammar's comment is:
#NooJ V5 #Syntactic grammar #Input Language is: en #Output Language is: en #Special Start Rule: Main #Special Characters: '=' '<' '>' '\' '"' ':' '|' '+' '-' '/' '$' '_' ';' '#'

Maybe, are these comments valuable for grammar parsing?

Best,
Daria

@numblr
Copy link
Owner

numblr commented Nov 5, 2019

Hey,

I strongly suspect that it is because of the version, as you mentioned our grammar has version #OpenNooJ 1.0 while yours mentions #NooJ V5. One way you could test that is by replacing these headers and see if the error message changes, either in our test or in your grammar.

In case you need the latest version we could try to upgrade this tool to a newer Nooj version, for this we would need to update the Nooj Jar file it uses and the pom.xml for the updated jar to satisfy maven. I don't know, however, if it it requires further changes to get it to work.

Best,
Thomas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants