MCPcopy Index your code
hub / github.com/KBNLresearch/europeananp-ner

github.com/KBNLresearch/europeananp-ner @v0.0.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.0.2 ↗ · + Follow
139 symbols 254 edges 27 files 50 documented · 36%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Named Entity Recognition Tool for

Europeana Newspapers Build Status

This tool takes container documents (MPEG21-DIDL, METS), parses out all references to ALTO files and tries to find named entities in the pages (with most models: Location, Person, Organisation, Misc). The aim is to keep the physical location on the page available through the whole process to be able to highlight the results in a viewer. Read more about it on the KBNLresearch blog.

Currently, Stanford NER is used for tagging.

At the moment, the following output formats are implemented:

  • ALTO-with-Alternatives
  • ALTO 2.1
  • HTML
  • CSV (comma separated values)
  • SQL

Basic usage:

Help:

 java -jar NerAnnotator.jar --help

Print result to stdout for German language:

 java -Xmx800m -jar NerAnnotator.jar -c mets -f alto -l de -m de=/path/to/trainingmodels/german/hgc_175m_600.crf.ser.gz -n 2 /path/to/mets/AZ_19260425/AZ_19260425_mets.xml

Training classifiers

To be able to compare your results with a baseline we provide you with some test files located in the 'test-files' directory.

Run the following command:

java -Xmx5G -cp target/NerAnnotator-0.0.2-SNAPSHOT-jar-with-dependencies.jar edu.stanford.nlp.ie.crf.CRFClassifier -prop test-files/austen_dutch.prop

This should result in a file called 'eunews_dutch.crf.gz' located in the directory 'test-files'. The size of the generated classifier should be around 1MB.

To verify the NER software use the created classifier to process the provided example file.

java -jar target/NerAnnotator-0.0.2-SNAPSHOT-jar-with-dependencies.jar -c alto -d out -f alto -l nl -m nl=./test-files/eunews_dutch.crf.gz -n 8 ./test-files/dutch_alto.xml

Now you can compare the output with the example output provided.

diff out/dutch_alto.xml-annotations/dutch_alto.xml.alto.xml ./test-files/dutch_alto_processed_output.xml

The same prcedure can be applied using the German example files.

The austen.prop file (basic version) can be found here:

http://nlp.stanford.edu/downloads/ner-example/austen.prop

Extension points exported contracts — how you extend this code

ContainerProcessor (Interface)
Processor for a container format @author rene @author Willem Jan Faber [6 implementers]
src/main/java/nl/kbresearch/europeana_newspapers/NerAnnotator/container/ContainerProcessor.java
ResultHandler (Interface)
Output handler for the result of the NER process on a single ALTO document @author rene [14 implementers]
src/main/java/nl/kbresearch/europeana_newspapers/NerAnnotator/output/ResultHandler.java

Core symbols most depended-on inside this repo

cleanWord
called by 9
src/main/java/nl/kbresearch/europeana_newspapers/NerAnnotator/TextElementsExtractor.java
close
called by 9
src/main/java/nl/kbresearch/europeana_newspapers/NerAnnotator/output/ResultHandler.java
nullsafe
called by 8
src/main/java/nl/kbresearch/europeana_newspapers/NerAnnotator/TextElementsExtractor.java
getOutputDirectory
called by 5
src/main/java/nl/kbresearch/europeana_newspapers/NerAnnotator/container/ContainerContext.java
getCRFClassifierForLanguage
called by 3
src/main/java/nl/kbresearch/europeana_newspapers/NerAnnotator/NERClassifiers.java
getWordToLabel
called by 3
src/main/java/nl/kbresearch/europeana_newspapers/NerAnnotator/TextElementsExtractor.java
calcuateAltoStringID
called by 3
src/main/java/nl/kbresearch/europeana_newspapers/NerAnnotator/TextElementsExtractor.java
handlePotentialAltoFile
called by 3
src/main/java/nl/kbresearch/europeana_newspapers/NerAnnotator/alto/AltoProcessor.java

Shape

Method 113
Class 22
Function 2
Interface 2

Languages

Java99%
Python1%

Modules by API surface

src/main/java/nl/kbresearch/europeana_newspapers/NerAnnotator/output/DbResultHandler.java12 symbols
src/main/java/nl/kbresearch/europeana_newspapers/NerAnnotator/output/LogResultHandler.java11 symbols
src/main/java/nl/kbresearch/europeana_newspapers/NerAnnotator/output/HtmlResultHandler.java11 symbols
src/main/java/nl/kbresearch/europeana_newspapers/NerAnnotator/output/CsvResultHandler.java11 symbols
src/main/java/nl/kbresearch/europeana_newspapers/NerAnnotator/output/BioResultHandler.java11 symbols
src/main/java/nl/kbresearch/europeana_newspapers/NerAnnotator/output/AnnotatedAltoResultHandler.java11 symbols
src/main/java/nl/kbresearch/europeana_newspapers/NerAnnotator/output/Alto2_1ResultHandler.java11 symbols
src/main/java/nl/kbresearch/europeana_newspapers/NerAnnotator/output/ResultHandler.java10 symbols
src/main/java/nl/kbresearch/europeana_newspapers/NerAnnotator/TextElementsExtractor.java10 symbols
src/main/java/nl/kbresearch/europeana_newspapers/NerAnnotator/App.java5 symbols
src/main/java/nl/kbresearch/europeana_newspapers/NerAnnotator/container/ContainerHandleThread.java4 symbols
src/main/java/nl/kbresearch/europeana_newspapers/NerAnnotator/NERClassifiers.java4 symbols

For agents

$ claude mcp add europeananp-ner \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page