lum-ai / odinson

Odinson is a powerful and highly optimized open-source framework for rule-based information extraction. Odinson couples a simple, yet powerful pattern language that can operate over multiple representations of text, with a runtime system that operates in near real time.
https://lum.ai/odinson/docs/
Apache License 2.0
65 stars 23 forks source link

How to operate the extra shell #370

Open xinghanlab opened 2 years ago

xinghanlab commented 2 years ago

Hello, there. I am a beginner in NLP. I am also interested in Odinson but don't have much experience with sbt.

I would like to run the Odinson locally via sbt according to your documentation.

According to the Walkthrough Example. I have finished step1 and step2, and then I want to try Querying using the shell according to README.md. I got some message like:

sbt:odinson> extra/runMain ai.lum.odinson.extra.Shell
[info] running (fork) ai.lum.odinson.extra.Shell
[info] 12:17:31,470 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml
[info] 12:17:31,470 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
[info] 12:17:31,470 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [jar:file:/C:/Program%20Files/Git/repository/test/odinson/target/bg-jobs/sbt_83a6d158/target/b90ecadb/8aa91fb0/odinson-core_2.12-0.6.2-SNAPSHOT.jar!/logback.xml]
[info] 12:17:31,475 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@5f8edcc5 - URL [jar:file:/C:/Program%20Files/Git/repository/test/odinson/target/bg-jobs/sbt_83a6d158/target/b90ecadb/8aa91fb0/odinson-core_2.12-0.6.2-SNAPSHOT.jar!/logback.xml] is not of type file
[info] 12:17:31,519 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
[info] 12:17:31,520 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
[info] 12:17:31,522 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
[info] 12:17:31,540 |-WARN in ch.qos.logback.core.ConsoleAppender[STDOUT] - This appender no longer admits a layout as a sub-component, set an encoder instead.
[info] 12:17:31,540 |-WARN in ch.qos.logback.core.ConsoleAppender[STDOUT] - To ensure compatibility, wrapping your layout in LayoutWrappingEncoder.
[info] 12:17:31,540 |-WARN in ch.qos.logback.core.ConsoleAppender[STDOUT] - See also http://logback.qos.ch/codes.html#layoutInsteadOfEncoder for details
[info] 12:17:31,541 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [ai.lum.odinson] to DEBUG
[info] 12:17:31,541 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting additivity of logger [ai.lum.odinson] to false
[info] 12:17:31,541 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ai.lum.odinson]
[info] 12:17:31,541 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to ERROR
[info] 12:17:31,541 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
[info] 12:17:31,541 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
[info] 12:17:31,541 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@7b02881e - Registering current configuration as safe fallback point
[info] Welcome to odinson-core v0.6.2-SNAPSHOT (c160833*)
[info] Type :help for a list of commands

In my opinion, I can type :help or some queries. But whatever I try to type anything, there is no code inside command line. So How should I do to issue my query in the shell.

Besides, I have another question. When I re-start CMD and type extra/runMain ai.lum.odinson.extra.Shell again, I got some error message:

[error] Exception in thread "main" org.apache.lucene.store.LockObtainFailedException: Lock held by another program: C:\Users\wang_\data\odinson\index\write.lock
[error]         at org.apache.lucene.store.NativeFSLockFactory.obtainFSLock(NativeFSLockFactory.java:118)
[error]         at org.apache.lucene.store.FSLockFactory.obtainLock(FSLockFactory.java:41)
[error]         at org.apache.lucene.store.BaseDirectory.obtainLock(BaseDirectory.java:45)
[error]         at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:800)
[error]         at ai.lum.odinson.lucene.index.IncrementalOdinsonIndex.<init>(IncrementalOdinsonIndex.scala:62)
[error]         at ai.lum.odinson.lucene.index.OdinsonIndex$.fromConfig(OdinsonIndex.scala:229)
[error]         at ai.lum.odinson.ExtractorEngine$.fromConfig(ExtractorEngine.scala:734)
[error]         at ai.lum.odinson.extra.Shell$.delayedEndpoint$ai$lum$odinson$extra$Shell$1(Shell.scala:54)
[error]         at ai.lum.odinson.extra.Shell$delayedInit$body.apply(Shell.scala:25)
[error]         at scala.Function0.apply$mcV$sp(Function0.scala:39)
[error]         at scala.Function0.apply$mcV$sp$(Function0.scala:39)
[error]         at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:17)
[error]         at scala.App.$anonfun$main$1$adapted(App.scala:80)
[error]         at scala.collection.immutable.List.foreach(List.scala:392)
[error]         at scala.App.main(App.scala:80)
[error]         at scala.App.main$(App.scala:78)
[error]         at ai.lum.odinson.extra.Shell$.main(Shell.scala:25)
[error]         at ai.lum.odinson.extra.Shell.main(Shell.scala)
[error] Nonzero exit code returned from runner: 1
[error] (extra / Compile / runMain) Nonzero exit code returned from runner: 1
[error] Total time: 12 s, completed 2022-2-9 12:23:00

So, do these mean I can't utilize the annotated text and index again?

I am looking forward to your kind reply.

myedibleenso commented 2 years ago

@xinghanlab , it looks like you're using Odinson from Windows. Is that correct? Can you please provide a bit more information on your system and how you've configured things?

kwalcock commented 2 years ago

The first screen shot or transcript looks OK except that the typing is not echoed to the console. I think that some versions of sbt have problems with this. If you type ":help" and enter, even though you don't see the letters, do you get some help? You mention CMD. I usually use powershell. Could you show what your screen looks like before starting sbt so that it's easier to see the environment or give the value of ComSpec like

> set ComSpec
ComSpec=C:\WINDOWS\system32\cmd.exe

I think the lock file just remains because of abnormal program termination or non-termination. Perhaps it can be delete manually.