### Install and Initialize SDKMAN Source: https://github.com/clulab/processors/blob/master/README-M1.md This snippet provides the commands to download and install sdkman from its source, followed by initializing it in the current shell session. It concludes with a command to verify the successful installation of sdkman. ```bash # install sdkman from source: curl -s "https://get.sdkman.io" | bash # open a new terminal window and run the following: source "$HOME/.sdkman/bin/sdkman-init.sh" # test your installation: sdk version ``` -------------------------------- ### Install SVM-Rank and SVMLight Binaries via Homebrew Source: https://github.com/clulab/processors/blob/master/docs/install.md This Bash command sequence demonstrates how to install the optional `svm-rank` and `svmlight` external binaries on Mac OS X. It involves adding a custom Homebrew tap and then installing the packages. ```Bash brew tap myedibleenso/nlp brew install svmlight svmrank ``` -------------------------------- ### Install Python Dependencies for Text Analysis Script Source: https://github.com/clulab/processors/blob/master/library/src/main/python/embedding_generator/README.md This command installs all necessary Python libraries for the `main.py` script by reading the `requirements.txt` file. It ensures the environment is set up correctly to run the text analysis tool. ```bash pip install -r requirements.txt ``` -------------------------------- ### Install SBT and Scala with SDKMAN Source: https://github.com/clulab/processors/blob/master/README-M1.md These commands facilitate the installation of sbt (version 1.6.1) and scala (version 2.12.15) via sdkman. These are essential tools for Scala development and are installed to be compatible with the M1 architecture. ```bash # sbt 1.6 sdk install sbt 1.6.1 # scala 2.12 sdk install scala 2.12.15 ``` -------------------------------- ### Standard Odin ExtractorEngine Initialization Source: https://github.com/clulab/processors/blob/master/docs/debugging.md This snippet demonstrates the typical setup for an Odin ExtractorEngine, including processor annotation and rule-based extraction, before any debugger integration. ```scala import org.clulab.odin.ExtractorEngine import org.clulab.processors.clu.CluProcessor ... val sentence = "..." val processor = new CluProcessor() val document = processor.annotate(sentence) val rules = "..." val extractorEngine = ExtractorEngine(rules) val mentions = extractorEngine.extractFrom(document) ``` -------------------------------- ### Integrating DebuggingExtractorEngine (Replacement Approach) Source: https://github.com/clulab/processors/blob/master/docs/debugging.md An alternative integration method where the DebuggingExtractorEngine directly replaces the instantiation of the standard ExtractorEngine. This simplifies the setup by creating the debugging engine from the start. ```scala import org.clulab.odin.ExtractorEngine import org.clulab.odin.debugger.odin.DebuggingExtractorEngine import org.clulab.processors.clu.CluProcessor ... val sentence = "..." val processor = new CluProcessor() val document = processor.annotate(sentence) val rules = "..." val extractorEngine = DebuggingExtractorEngine(ExtractorEngine(rules)) val mentions = extractorEngine.extractFrom(document) ``` -------------------------------- ### Run Text Analysis Script with Hugging Face Dataset Source: https://github.com/clulab/processors/blob/master/library/src/main/python/embedding_generator/README.md This example shows how to run the `main.py` script using a specific Hugging Face dataset (e.g., 'wikipedia') and an optional subpart. It includes all required parameters like model, tokenizer, context size, device, token count, and a random seed, allowing for analysis on external datasets. ```bash /home/gigi/hdd/DeBERTa/env/bin/python main.py --context_size 512 --model_type 'microsoft/deberta-base' --tokenizer 'microsoft/deberta-base' --device 'cuda' --number_of_tokens 1000 --huggingface_dataset wikipedia --huggingface_subpart 20220301.en --seed 42 ``` -------------------------------- ### Run Webapp in SBT Development Mode Source: https://github.com/clulab/processors/blob/master/webapp/README.md Start the webapp directly from within sbt for local development. The web page will be accessible at http://localhost:9000. ```sbt webapp/run ``` -------------------------------- ### Run Text Analysis Script with Default Dataset Source: https://github.com/clulab/processors/blob/master/library/src/main/python/embedding_generator/README.md This example demonstrates how to execute the `main.py` script using its default dataset (`text_data.json`). It specifies essential parameters such as the model type, tokenizer, context size, processing device, number of tokens to analyze, and a random seed for reproducible results. ```bash /home/gigi/hdd/DeBERTa/env/bin/python main.py --context_size 512 --model_type 'microsoft/deberta-base' --tokenizer 'microsoft/deberta-base' --device 'cuda' --number_of_tokens 1000 --seed 42 ``` -------------------------------- ### Install ARM64 Java 11 with SDKMAN Source: https://github.com/clulab/processors/blob/master/README-M1.md This command installs a specific ARM64-compatible distribution of Java 11 (Zulu 11.0.14) using sdkman. This version is recommended for M1 Macs and is also compatible with Intel machines. ```bash sdk install java 11.0.14-zulu ``` -------------------------------- ### Configure CLULAB Processors Dependencies in sbt Build Source: https://github.com/clulab/processors/blob/master/docs/install.md This Scala snippet shows the equivalent dependency configuration for `processors` and `processors-model` within an `sbt` build file. Remember to substitute `x.x.x` and `y.y.y` with the appropriate library version numbers. ```Scala libraryDependencies ++= { Seq( "org.clulab" %% "processors" % "x.x.x", "org.clulab" % "processors-model" % "y.y.y" ) } ``` -------------------------------- ### Annotating Entire Documents with BalaurProcessor (Scala) Source: https://github.com/clulab/processors/blob/master/docs/processors.md This Scala example demonstrates how to use the `BalaurProcessor` to annotate a full document, performing various NLP tasks like tokenization, lemmatization, POS tagging, and named entity recognition. It iterates through sentences and prints detailed annotations including words, offsets, lemmas, POS tags, chunks, entities, normalized entities, and syntactic dependencies. ```scala package org.clulab.processors.apps import org.clulab.processors.{Document, Processor} import org.clulab.struct.DirectedGraphEdgeIterator object ProcessorsScalaExample extends App { val proc = Processor() // The actual work is done here. val doc: Document = proc.annotate("John Smith went to China. He visited Beijing on January 10th, 2013.") // Let's print the sentence-level annotations. for ((sentence, sentenceIndex) <- doc.sentences.zipWithIndex) { println("Sentence #" + sentenceIndex + ":") println("Tokens: " + mkString(sentence.words)) println("Start character offsets: " + mkString(sentence.startOffsets)) println("End character offsets: " + mkString(sentence.endOffsets)) // These annotations are optional, so they are stored using Option objects, // hence the foreach statement. sentence.lemmas.foreach(lemmas => println("Lemmas: " + mkString(lemmas))) sentence.tags.foreach(tags => println("POS tags: " + mkString(tags))) sentence.chunks.foreach(chunks => println("Chunks: " + mkString(chunks))) sentence.entities.foreach(entities => println("Named entities: " + mkString(entities))) sentence.norms.foreach(norms => println("Normalized entities: " + mkString(norms))) sentence.dependencies.foreach { dependencies => println("Syntactic dependencies:") val iterator = new DirectedGraphEdgeIterator[String](dependencies) iterator.foreach { dep => // Note that we use offsets starting at 0 unlike CoreNLP, which uses offsets starting at 1. println(" head: " + dep._1 + " modifier: " + dep._2 + " label: " + dep._3) } } println() } def mkString[T](elems: Array[T]): String = elems.mkString(" ") } ``` -------------------------------- ### Odin Debugger Stack View Log Example Source: https://github.com/clulab/processors/blob/master/docs/debugging.md This log snippet illustrates the output of the Odin Debugger's Stack View. It shows the execution flow of the Odin algorithm, detailing method calls, loop iterations, and token processing within the DebuggingExtractorEngine and related components. The output is designed to be clickable in IntelliJ, linking directly to source code locations. ```Log beg loop org.clulab.odin.debugger.odin.InnerDebuggingExtractorEngine#extract(DebuggingExtractorEngine.scala:17)[](loop = 1) beg extractor org.clulab.odin.debugger.odin.DebuggingTokenExtractor#findAllIn(DebuggingTokenExtractor.scala:23)["four-As"]() beg tokenPattern org.clulab.odin.debugger.odin.DebuggingTokenExtractor#findAllIn(DebuggingTokenExtractor.scala:24)["tokenPattern"]() beg sentence org.clulab.odin.debugger.odin.DebuggingTokenExtractor#findAllIn(DebuggingTokenExtractor.scala:29)[](index = 0, sentence = "John Doe eats cake .") beg start org.clulab.odin.debugger.odin.DebuggingTokenPattern#findFirstIn loop r(DebuggingTokenPattern.scala:26)[](start = 0) beg tok org.clulab.odin.debugger.odin.DebuggingThompsonVM.DebuggingEvaluator#mkThreads(DebuggingThompsonVM.scala:56)[](tok = 0) instMatches org.clulab.odin.debugger.odin.DebuggingThompsonVM.DebuggingEvaluator#mkThreads loop(DebuggingThompsonVM.scala:78)[](matches = true, ...) end tok org.clulab.odin.debugger.odin.DebuggingThompsonVM.DebuggingEvaluator#mkThreads(DebuggingThompsonVM.scala:56)[](tok = 0) beg tok org.clulab.odin.debugger.odin.DebuggingThompsonVM.DebuggingEvaluator#stepSingleThread(DebuggingThompsonVM.scala:114)[](tok = 0) ... ``` -------------------------------- ### Add CLULAB Processors Dependencies to Maven pom.xml Source: https://github.com/clulab/processors/blob/master/docs/install.md This XML snippet illustrates how to declare the `processors` and `processors-model` libraries as dependencies in a Maven `pom.xml` file. Users should replace `x.x.x` and `y.y.y` with the latest stable version numbers, such as `10.0.0` for `processors` and `0.3.1` for `processors-model`. ```XML org.clulab processors_2.12 x.x.x org.clulab processors-model y.y.y ``` -------------------------------- ### Debug Webapp with Remote JVM Debugging Source: https://github.com/clulab/processors/blob/master/webapp/README.md Enable remote JVM debugging for the webapp by starting sbt with a debug port. This allows setting breakpoints in an IDE like IntelliJ. ```sbt sbt -jvm-debug 5005 ``` -------------------------------- ### Configure SDKMAN for ARM64 Compatibility Source: https://github.com/clulab/processors/blob/master/README-M1.md This configuration line, to be added or modified in the sdkman config file, ensures that sdkman only lists and installs ARM64-compatible versions of software. Setting sdkman_rosetta2_compatible to false prevents the listing of Intel-only distributions. ```properties sdkman_rosetta2_compatible=false ``` -------------------------------- ### Process Text with CLULAB Processors in Java Source: https://github.com/clulab/processors/blob/master/docs/processors.md This Java example demonstrates how to initialize a CLULAB Processor, annotate a given text, and then iterate through the resulting Document and Sentence objects to extract various linguistic annotations such as tokens, lemmas, POS tags, chunks, named entities, normalized entities, and syntactic dependencies. It includes helper methods for string formatting and converting Scala iterators to Java iterables. ```java package org.clulab.processors.apps; import org.clulab.processors.Document; import org.clulab.processors.Processor; import org.clulab.processors.Processor$; import org.clulab.processors.Sentence; import org.clulab.struct.DirectedGraphEdgeIterator; import org.clulab.utils.JavaUtils; import java.util.Iterator; public class ProcessorsJavaExample { public static void main(String [] args) throws Exception { // Create the processor Processor proc = Processor$.MODULE$.mkProcessor(); // The actual work is done here. Document doc = proc.annotate("John Smith went to China. He visited Beijing on January 10th, 2013.", false); // You are basically done. The rest of this code simply prints out the annotations. // Let's print the sentence-level annotations. for (int sentenceIndex = 0; sentenceIndex < doc.sentences().length; sentenceIndex++) { Sentence sentence = doc.sentences()[sentenceIndex]; System.out.println("Sentence #" + sentenceIndex + ":"); System.out.println("Tokens: " + mkString(sentence.words())); System.out.println("Start character offsets: " + mkString(sentence.startOffsets())); System.out.println("End character offsets: " + mkString(sentence.endOffsets())); // These annotations are optional, so they are stored using Option objects, // hence the isDefined() and get() calls. if (sentence.lemmas().isDefined()) System.out.println("Lemmas: " + mkString(sentence.lemmas().get())); if (sentence.tags().isDefined()) System.out.println("POS tags: " + mkString(sentence.tags().get())); if (sentence.chunks().isDefined()) System.out.println("Chunks: " + mkString(sentence.chunks().get())); if (sentence.entities().isDefined()) System.out.println("Named entities: " + mkString(sentence.entities().get())); if (sentence.norms().isDefined()) System.out.println("Normalized entities: " + mkString(sentence.norms().get())); if (sentence.dependencies().isDefined()) { System.out.println("Syntactic dependencies:"); Iterator> iterator = JavaUtils.asJava(new DirectedGraphEdgeIterator<>(sentence.dependencies().get())); for (scala.Tuple3 dep: iteratorToIterable(iterator)) { // Note that we use offsets starting at 0 unlike CoreNLP, which uses offsets starting at 1. System.out.println(" head: " + dep._1() + " modifier: " + dep._2() + " label: " + dep._3()); } } System.out.println(); System.out.println(); } } public static String mkString(String[] strings, String sep) { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < strings.length; i ++) { if (i > 0) stringBuilder.append(sep); stringBuilder.append(strings[i]); } return stringBuilder.toString(); } public static String mkString(String[] strings) { return mkString(strings, " "); } public static String mkString(int[] ints, String sep) { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < ints.length; i ++) { if (i > 0) stringBuilder.append(sep); stringBuilder.append(ints[i]); } return stringBuilder.toString(); } public static String mkString(int[] ints) { return mkString(ints, " "); } public static Iterable iteratorToIterable(Iterator iterator) { return () -> iterator; } } ``` -------------------------------- ### Customizing Inspector HTML Output with Filters (Scala) Source: https://github.com/clulab/processors/blob/master/docs/debugging.md Shows how to use DynamicInspectorFilter to control the types of views displayed in the HTML output generated by the Inspector. Examples include a verbose filter and a custom filter to suppress local action views, applied during inspectDynamicAsHtml calls. ```scala import org.clulab.odin.debugger.Inspector import org.clulab.odin.debugger.debug.Transcript import org.clulab.odin.debugger.debug.filter.DynamicInspectorFilter import org.clulab.odin.debugger.debug.finished.FinishedLocalAction import org.clulab.odin.impl.Extractor import org.clulab.processors.Sentence ... val debuggingExtractorEngine = ... val verboseFilter = DynamicInspectorFilter.verbose val noLocalActionFilter = new DynamicInspectorFilter { def showLocalActionView(extractor: Extractor, sentence: Sentence, transcript: Transcript[FinishedLocalAction]): Boolean = false } Inspector(debuggingExtractorEngine) .inspectDynamicAsHtml("../debug-verbose-dynamic.html", filter = verboseFilter) .inspectDynamicAsHtml("../debug-localactionless-dynamic.html", filter = noLocalActionFilter) ``` -------------------------------- ### Publish Processors Webapp Artifacts Source: https://github.com/clulab/processors/blob/master/webapp/README.md Commands to publish the webapp to different repositories. `webapp/publish` is for Artifactory, while `webapp/publishSigned` followed by `webapp/sonatypeRelease` is for Maven Central. ```sbt webapp/publish ``` ```sbt webapp/publishSigned ``` ```sbt webapp/sonatypeRelease ``` -------------------------------- ### Parse Text File with Processors JAR Source: https://github.com/clulab/processors/blob/master/docs/basic.md Demonstrates how to parse a single plain text file using the downloaded 'fat' JAR. Specifies input and output file paths. The output is in a CoNLL-U compatible format with additional custom columns for offsets, entities, and chunks. ```Java java -jar -input -output ``` ```Text John Doe visited China. His visit was on Jan 1st, 2024. ``` ```Text 1 John john NNP _ _ 2 compound _ 0 4 B-PER _ B-NP 2 Doe doe NNP _ _ 3 nsubj _ 5 8 I-PER _ I-NP 3 visited visit VBD _ _ 0 root _ 9 16 O _ B-VP 4 China china NNP _ _ 3 dobj _ 17 22 B-LOC _ B-NP 5 . . . _ _ 3 punct _ 23 24 O _ O 1 His his PRP$ _ _ 2 nmod:poss _ 26 29 O _ B-NP 2 visit visit NN _ _ 5 nsubj _ 30 35 O _ I-NP 3 was be VBD _ _ 5 cop _ 36 39 O _ B-VP 4 on on IN _ _ 5 case _ 40 42 O _ B-PP 5 Jan jan NNP _ _ 0 root _ 43 46 B-DATE 2024-01-01 B-NP 6 1st 1st CD _ _ 5 nummod _ 47 50 I-DATE 2024-01-01 I-NP 7 , , , _ _ 5 punct _ 51 52 I-DATE 2024-01-01 I-NP 8 2024 2024 CD _ _ 5 nummod _ 53 57 I-DATE 2024-01-01 I-NP 9 . . . _ _ 5 punct _ 60 61 O _ O ``` -------------------------------- ### Run Processors in Interactive Shell Mode Source: https://github.com/clulab/processors/blob/master/docs/basic.md Explains how to run the 'processors' JAR without specifying an input file, enabling an interactive shell where users can type text directly for parsing. Output is displayed upon pressing Enter. ```Java java -jar ``` -------------------------------- ### Integrating DebuggingExtractorEngine (Additive Approach) Source: https://github.com/clulab/processors/blob/master/docs/debugging.md This approach shows how to introduce the DebuggingExtractorEngine by adding new lines of code. It takes an existing ExtractorEngine instance and wraps it with the debugging version, allowing for parallel execution and data collection. ```scala import org.clulab.odin.debugger.odin.DebuggingExtractorEngine ... val debuggingExtractorEngine = DebuggingExtractorEngine(extractorEngine) val debuggingMentions = debuggingExtractorEngine.extractFrom(document) ``` -------------------------------- ### Display Processors Output to Standard Output Source: https://github.com/clulab/processors/blob/master/docs/basic.md Describes how to direct the 'processors' output to the standard output (console) by omitting the output file parameter. The output will be in CoNLL-U format. ```Java java -jar -input ``` -------------------------------- ### List ARM64-Compatible Java Versions Source: https://github.com/clulab/processors/blob/master/README-M1.md Execute this command in a new terminal after configuring sdkman for ARM64 compatibility. It will display a list of Java distributions that are natively compatible with Apple M1 processors. ```bash sdk list java ``` -------------------------------- ### Process Input File with Tokenized Sentences Per Line Source: https://github.com/clulab/processors/blob/master/docs/basic.md Shows how to process an input file where each line contains a single, pre-tokenized sentence, with tokens separated by whitespace. The '-tokens' flag is used for this format, producing the same structured output. ```Text John Doe visited China . His visit was on Jan 1st , 2024 . ``` ```Java java -jar -input input.txt -tokens -output output.txt ``` -------------------------------- ### Open SDKMAN Configuration File Source: https://github.com/clulab/processors/blob/master/README-M1.md Use this command to open the sdkman configuration file (~/.sdkman/etc/config) in your default text editor. This allows for manual adjustments to sdkman's behavior and settings. ```bash sdk config ``` -------------------------------- ### BalaurProcessor Capabilities Overview Source: https://github.com/clulab/processors/blob/master/docs/processors.md Details the functionalities provided by the `BalaurProcessor` class, which integrates various NLP tools for document annotation. It outlines the specific tasks performed and the underlying technologies used for each. ```APIDOC BalaurProcessor: - Tokenization (implemented with Antlr) - Lemmatization (using MorphaStemmer) - Part-of-speech (POS) tagging - Numeric entity recognition (e.g., dates, money) (implemented using Odin) - Named entity recognition (NER) - Shallow syntactic parsing or chunking - Syntactic dependency parsing (using Amini et al., 2023 algorithm) ``` -------------------------------- ### Add Glove Dependency to SBT Build Source: https://github.com/clulab/processors/blob/master/RESOURCES.md To restore the text version of Glove embeddings, add this dependency line to your `main/build.sbt` file. This artifact is hosted on the CLU Lab Artifactory server and requires the server to be listed among your SBT resolvers. ```SBT "org.clulab" % "glove-840b-300d-10f" % "1.0.0", ``` -------------------------------- ### Annotating Documents from Pre-tokenized Input (Scala) Source: https://github.com/clulab/processors/blob/master/docs/processors.md Demonstrates how to annotate documents using the `proc.annotateFromTokens` method when the input text is already split into sentences and tokenized. The method takes a list of lists of strings, where each inner list represents a sentence's tokens. ```scala val doc = proc.annotateFromTokens(List( List("John", "Smith", "went", "to", "China", "."), List("There", ",", "he", "visited", "Beijing", ".") )) // Everything else stays the same. ``` -------------------------------- ### Run Dockerized Processors Webapp Image Source: https://github.com/clulab/processors/blob/master/webapp/README.md Execute the built Docker image for the processors webapp. This command runs the container in detached mode, maps port 9000, and requires a secret key for application security. ```bash docker run -d --env secret= -p 9000:9000 --restart unless-stopped processors-webapp:latest & ``` -------------------------------- ### Annotating Pre-Split Sentences with BalaurProcessor (Scala) Source: https://github.com/clulab/processors/blob/master/docs/processors.md This Scala snippet shows how to annotate a document when sentences are already provided as a list of strings, using the `annotateFromSentences` method. The subsequent processing and output structure remain identical to annotating an entire document. ```scala val doc = proc.annotateFromSentences(List("John Smith went to China.", "He visited Beijing.")) // Everything else stays the same. ``` -------------------------------- ### HTML Static Rule View Source: https://github.com/clulab/processors/blob/master/docs/debugging.md Shows a simple table visualization of Odin rules, useful for debugging YAML formatting, indentation, and special character issues. It helps clarify problems related to the YAML file and explain unexpected behavior. ```APIDOC Rule View (HTML): Format: Simple table Content: Visualization of Odin rules (originally in YAML) Purpose: Debugging issues related to YAML formatting, indentation, special characters, or unexpected behavior. ``` -------------------------------- ### HTML Static Graphical Extractor View Source: https://github.com/clulab/processors/blob/master/docs/debugging.md Visualizes internal Extractor structures as a directed graph, showing possible states a Thread can be in during extractor execution. It highlights loops and branches from `*`, `+`, and `|` operations in TokenPatterns. For rules to match, the outermost 'Done Inst' needs to be reached. This view requires Mermaid.js CDN access for rendering. ```APIDOC Graphical Extractor View (HTML): Format: Directed graph (Mermaid.js) Content: Internal structures of Extractors, showing Thread states during execution. Key Elements: - Loops and branches: Related to *, +, | operations in TokenPatterns. - Done Inst: Must be reached for rules to match. Dependencies: Mermaid.js CDN access required for rendering. Purpose: Understand extractor execution flow, especially for complex patterns. ``` -------------------------------- ### Process Input File with One Sentence Per Line Source: https://github.com/clulab/processors/blob/master/docs/basic.md Demonstrates how to process an input file where each line contains a single, untokenized sentence. The '-sentences' flag is used to indicate this input format, adjusting character offsets accordingly. ```Text John Doe visited China. His visit was on Jan 1st, 2024. ``` ```Java java -jar -input input.txt -sentences -output output.txt ``` -------------------------------- ### CompactWordEmbeddingMap Class API for Word Embeddings Source: https://github.com/clulab/processors/blob/master/RESOURCES.md The `CompactWordEmbeddingMap` class provides factory methods for loading word embedding maps from various serialization formats (text, Java, Kryo) and instance methods for saving them. It is designed to handle the serialization and deserialization of word embeddings efficiently. ```APIDOC CompactWordEmbeddingMap: Companion Object (Factory Methods): loadTxt(): Loads a word embedding map from a text file. loadSer(): Loads a word embedding map from a Java serialized file. loadKryo(): Loads a word embedding map from a Kryo serialized file. Instance Methods: save(path: String): Saves the word embedding map to a file. saveKryo(path: String): Saves the word embedding map to a Kryo serialized file. ``` -------------------------------- ### Using the Debugger Inspector to Generate Reports Source: https://github.com/clulab/processors/blob/master/docs/debugging.md This snippet illustrates how to utilize the Inspector component, which is created from the DebuggingExtractorEngine, to generate static and dynamic HTML reports based on the collected debugging information. ```scala import org.clulab.odin.debugger.Inspector ... val debuggingExtractorEngine = ... Inspector(debuggingExtractorEngine) .inspectStaticAsHtml("../debug-static.html") .inspectDynamicAsHtml("../debug-dynamic.html") ``` -------------------------------- ### clulab/processors Class Hierarchy Overview Source: https://github.com/clulab/processors/blob/master/docs/debugging.md Detailed hierarchical listing of classes, packages, and class members within the clulab/processors project, illustrating their organization. This structure helps in understanding the project's architecture, particularly for components related to applications, debugging, and the core library. ```APIDOC processors-apps org.clulab.processors.apps CommandLineInterface processors-debugger main org.clulab.odin.debugger Debugger Inspector apps DebuggingOdinStarterApp debug Transcript context filter DynamicDebuggerFilter DynamicInspectorFilter concise verbose StaticDebuggerFilter StaticInspectorFilter concise verbose matches MentionMatch ThreadMatch odin (debugging classes) DebuggingExtractorEngine test org.clulab.odin.debugger.extractor DebugCrossSentenceExtractor DebugTokenExtractor graph DebugRelationGraphExtractor DebugTriggerMentionGraphExtractor DebugTriggerPatternGraphExtractor processors-library org.clulab.odin ExtractorEngine Mention State impl CrossSentenceExtractor ``` -------------------------------- ### Plain Text Static Rule View Source: https://github.com/clulab/processors/blob/master/docs/debugging.md Offers a version of the HTML Rule View that can simply be printed to the console and observed by a human without assistance of a web browser. ```APIDOC Rule View (Text): Format: Plain text Content: Visualization of Odin rules (similar to HTML Rule View) Purpose: Console-based inspection of rules without a web browser. ``` -------------------------------- ### HTML Dynamic Global Action View Source: https://github.com/clulab/processors/blob/master/docs/debugging.md Summarizes the Mentions found across an entire document by all the rules. It lists Mentions that enter and exit the global action, providing clues if rules are working but something is wrong with the action, such as filtering or transformation issues. ```APIDOC Global Action View (HTML): Location: Top of HTML report Content: Summary of Mentions found across a document by all rules. Sections: - Left: Mentions entering global action (includes filtered/transformed mentions). - Right: Mentions exiting global action (includes new mentions). Comparison: Mentions compared by reference (eq()) for filtering/transformation. Purpose: Debug issues with rule actions, especially filtering or transformation of Mentions. ``` -------------------------------- ### HTML Dynamic Parse View Source: https://github.com/clulab/processors/blob/master/docs/debugging.md Applies to sentences and resembles the webapp output, showing the tokenization, part-of-speech tags, named entities, and dependencies of sentences being processed. The parse for each sentence is followed by views for all the Extractors being applied, helping to identify if an incorrect parse is the cause of unexpected rule behavior. ```APIDOC Parse View (HTML): Applies To: Sentences Content: Tokenization, part-of-speech tags, named entities, dependencies of processed sentences. Structure: Parse for each sentence followed by views for all applied Extractors. Purpose: Identify if incorrect sentence parsing is causing unexpected rule behavior. ``` -------------------------------- ### Plain Text Static Extractor View Source: https://github.com/clulab/processors/blob/master/docs/debugging.md As with the HTML version, this view shows the data structure of parsed and compiled rules, but in a text-only format, suitable for console output. ```APIDOC Extractor View (Text): Format: Plain text Content: Data structures of parsed and compiled rules (similar to HTML Extractor View) Purpose: Console-based inspection of extractor data structures. ``` -------------------------------- ### Add Processors Debugger Dependency Source: https://github.com/clulab/processors/blob/master/docs/debugging.md To integrate the Odin debugger into your Scala project, add the following dependency line to your `build.sbt` file. It is crucial to match the debugger's version number with your main processors project to ensure compatibility and avoid errors. ```Scala libraryDependencies += "org.clulab" %% "processors-debugger" % "x.x.x" ``` -------------------------------- ### Serializing Document and Mention Instances to/from JSON (APIDOC) Source: https://github.com/clulab/processors/blob/master/docs/processors.md Documents the capability to serialize `Document` and `Mention` instances to and from JSON format, available since v5.9.6. This method offers a compact and interoperable way to store and exchange annotations. ```APIDOC Document: - JSON Serialization (v5.9.6+) - save(document: Document): String (JSON format) - load(jsonString: String): Document Mention: - JSON Serialization (v5.9.6+) - save(mention: Mention): String (JSON format) - load(jsonString: String): Mention ``` -------------------------------- ### Serializing Document Annotations to/from Writers and Readers (Scala) Source: https://github.com/clulab/processors/blob/master/docs/processors.md Illustrates how to save and load document annotations using `org.clulab.serialization.DocumentSerializer` with `PrintWriter` for saving and `BufferedReader` for loading. This method allows for persistent storage and retrieval of annotations. ```scala // saving to a PrintWriter val someAnnotation = proc.annotate(someText) val serializer = new org.clulab.serialization.DocumentSerializer serializer.save(someAnnotation, printWriter) // loading from an BufferedReader val someAnnotation2 = serializer.load(bufferedReader) ``` -------------------------------- ### Applying Debugger Filters to DebuggingExtractorEngine (Scala) Source: https://github.com/clulab/processors/blob/master/docs/debugging.md Demonstrates how to instantiate and apply DynamicDebuggerFilter and StaticDebuggerFilter to a DebuggingExtractorEngine. These filters restrict the debugger to collect information only for a specified extractor and sentence, reducing the volume of data in Transcripts. ```scala import org.clulab.odin.debugger.debug.filter.{DynamicDebuggerFilter, StaticDebuggerFilter} import org.clulab.odin.debugger.odin.DebuggingExtractorEngine ... val extractorEngine = ... val extractor = ... val sentence = "..." val dynamicDebuggerFilter = DynamicDebuggerFilter.extractorFilter(extractor).sentenceFilter(sentence) val staticDebuggerFilter = StaticDebuggerFilter.extractorFilter(extractor) val debuggingExtractorEngine = DebuggingExtractorEngine(extractorEngine, dynamicDebuggerFilter = dynamicDebuggerFilter, staticDebuggerFilter = staticDebuggerFilter, active = true, verbose = true) ``` -------------------------------- ### HTML Static Textual Extractor View Source: https://github.com/clulab/processors/blob/master/docs/debugging.md Displays the data structures of parsed and compiled Odin rules converted into Extractor types (TokenExtractor, GraphExtractor, CrossSentenceExtractor). This view helps experienced rule writers verify that a rule is properly understood by Odin and not misunderstood due to syntax issues, typos, or misnamed identifiers. ```APIDOC Textual Extractor View (HTML): Format: Textual representation of data structures Content: Parsed and compiled rules converted into Extractor objects Extractor Types: - TokenExtractor: For "token" rules - GraphExtractor: For "dependency" rules - CrossSentenceExtractor: For "cross-sentence" rules Purpose: Verify Odin's understanding of rules, identify syntax issues, typos, or misnamed identifiers. ``` -------------------------------- ### Serializing Document Annotations to/from Strings (Scala) Source: https://github.com/clulab/processors/blob/master/docs/processors.md Shows how to serialize document annotations to and from a `String` using `org.clulab.serialization.DocumentSerializer`. This is useful for in-memory serialization or when passing annotations as string data. ```scala // saving to a String val someAnnotation = proc.annotate(someText) val serializer = new org.clulab.serialization.DocumentSerializer val string = serializer.save(someAnnotation) // loading from a String val someAnnotation2 = serializer.load(string) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.