Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
H

holmes-extractor

> 数据库
Open source

Information extraction from English and German texts based on predicate logic

395 stars0 likes2 views
WebsiteGitHub

About

Information extraction from English and German texts based on predicate logic

Holmes

Author: Richard Paul Hudson, Explosion AI

  • 1. Introduction
    • 1.1 The basic idea
    • 1.2 Installation
      • 1.2.1 Prerequisites
      • 1.2.2 Library installation
      • 1.2.3 Installing the spaCy and coreferee models
      • 1.2.4 Comments about deploying Holmes in an enterprise environment
      • 1.2.5 Resource requirements
    • 1.3 Getting started
  • 2. Word-level matching strategies
    • 2.1 Direct matching
    • 2.2 Derivation-based matching
    • 2.3 Named-entity matching
    • 2.4 Ontology-based matching
    • 2.5 Embedding-based matching
    • 2.6 Named-entity-embedding-based matching
    • 2.7 Initial-question-word matching
  • 3. Coreference resolution
  • 4. Writing effective search phrases
    • 4.1 General comments
      • 4.1.1 Lexical versus grammatical words
      • 4.1.2 Use of the present active
      • 4.1.3 Generic pronouns
      • 4.1.4 Prepositions
    • 4.2 Structures not permitted in search phrases
      • 4.2.1 Multiple clauses
      • 4.2.2 Negation
      • 4.2.3 Conjunction
      • 4.2.4 Lack of lexical words
      • 4.2.5 Coreferring pronouns
    • 4.3 Structures strongly discouraged in search phrases
      • 4.3.1 Ungrammatical expressions
      • 4.3.2 Complex verb tenses
      • 4.3.3 Questions
      • 4.3.4 Compound words
    • 4.4 Structures to be used with caution in search phrases
      • 4.4.1 Very complex structures
      • 4.4.2 Deverbal noun phrases
  • 5. Use cases and examples
    • 5.1 Chatbot
    • 5.2 Structural extraction
    • 5.3 Topic matching
    • 5.4 Supervised document classification
  • 6 Interfaces intended for public use
    • 6.1 Manager
    • 6.2 manager.nlp
    • 6.3 Ontology
    • 6.4 SupervisedTopicTrainingBasis (returned from Manager.get_supervised_topic_training_basis())
    • 6.5 SupervisedTopicModelTrainer (returned from SupervisedTopicTrainingBasis.train())
    • 6.6 SupervisedTopicClassifier (returned from SupervisedTopicModelTrainer.classifier() and Manager.deserialize_supervised_topic_classifier())
    • 6.7 Dictionary returned from Manager.match()
    • 6.8 Dictionary returned from Manager.topic_match_documents_against()
  • 7 A note on the license
  • 8 Information for developers
    • 8.1 How it works
      • 8.1.1 Structural matching (chatbot and structural extraction)
      • 8.1.2 Topic matching
      • 8.1.3 Supervised document classification
    • 8.2 Development and testing guidelines
    • 8.3 Areas for further development
      • 8.3.1 Additional languages
      • 8.3.2 Use of machine learning to improve matching
      • 8.3.3 Remove names from supervised document classification models
      • 8.3.4 Improve the performance of supervised document classification training
      • 8.3.5 Explore the optimal hyperparameters for topic matching and supervised document classification
    • 8.4 Version history
      • 8.4.1 Version 2.0.x
      • 8.4.2 Version 2.1.0
      • 8.4.3 Version 2.2.0
      • 8.4.4 Version 2.2.1
      • 8.4.5 Version 3.0.0
      • 8.4.6 Version 4.0.0

1. Introduction

1.1 The basic idea

Holmes is a Python 3 library (v3.6—v3.10) running on top of spaCy (v3.1—v3.3) that supports a number of use cases involving information extraction from English and German texts. In all use cases, the information extraction is based on analysing the semantic relationships expressed by the component parts of each sentence:

  • In the chatbot use case, the system is configured using one or more search phrases. Holmes then looks for structures whose meanings correspond to those of these search phrases within a searched document, which in this case corresponds to an individual snippet of text or speech entered by the end user. Within a match, each word with its own meaning (i.e. that does not merely fulfil a grammatical function) in the search phrase corresponds to one or more such words in the document. Both the fact that a search phrase was matched and any structured information the search phrase extracts can be used to drive the chatbot.

  • The structural extraction use case uses exactly the same structural matching technology as the chatbot use case, but searching takes place with respect to a pre-existing document or documents that are typically much longer than the snippets analysed in the chatbot use case, and the aim is to extract and store structured information. For example, a set of business articles could be searched to find all the places where one company is said to be planning to take over a second company. The identities of the companies concerned could then be stored in a database.

  • The topic matching use case aims to find passages in a document or documents whose meaning is close to that of another document, which takes on the role of the query document, or to that of a query phrase entered ad-hoc by the user. Holmes extracts a number of small phraselets from the query phrase or query document, matches the documents being searched against each phraselet, and conflates the results to find the most relevant passages within the documents. Because there is no strict requirement that every word with its own meaning in the query document match a specific word or words in the searched documents, more matches are found than in the structural extraction use case, but the matches do not contain structured information that can be used in subsequent processing. The topic matching use case is demonstrated by a website allowing searches within six Charles Dickens novels (for English) and around 350 traditional stories (for German).

  • The supervised document classification use case uses training data to learn a classifier that assigns one or more classification labels to new documents based on what they are about. It classifies a new document by matching it against phraselets that were extracted from the training documents in the same way that phraselets are extracted from the query document in the topic matching use case. The technique is inspired by bag-of-words-based classification algorithms that use n-grams, but aims to derive n-grams whose component words are related semantically rather than that just happen to be neighbours in the surface representation of a language.

In all four use cases, the individual words are matched using a number of strategies. To work out whether two grammatical structures that contain individually matching words correspond logically and constitute a match, Holmes transforms the syntactic parse information provided by the spaCy library into semantic structures that allow texts to be compared using predicate logic. As a user of Holmes, you do not need to understand the intricacies of how this works, although there are some important tips around writing effective search phrases for the chatbot and structural extraction use cases that you should try and take on board.

Holmes aims to offer generalist solutions that can be used more or less out of the box with relatively little tuning, tweaking or training and that are rapidly applicable to a wide range of use cases. At its core lies a logical, programmed, rule-based system that describes how syntactic representations in each language express semantic relationships. Although the supervised document classification use case does incorporate a neural network and although the spaCy library upon which Holmes builds has itself been pre-trained using machine learning, the essentially rule-based nature of Holmes means that the chatbot, structural extraction and topic matching use cases can be put to use out of the box without any training and that the supervised document classification use case typically requires relatively little training data, which is a great advantage because pre-labelled training data is not available for many real-world problems.

Holmes has a long and complex history and we are now able to publish it under the MIT license thanks to the goodwill and openness of several companies. I, Richard Hudson, wrote the versions up to 3.0.0 while working at msg systems, a large international software consultancy based near Munich. In late 2021, I changed employers and now work for Explosion, the creators of spaCy and Prodigy. Elements of the Holmes library are covered by a US patent that I myself wrote in the early 2000s while working at a startup called Definiens that has since been acquired by AstraZeneca. With the kind permission of both AstraZeneca and msg systems, I am now maintaining Holmes at Explosion and can offer it for the first time under a permissive license: anyone can now use Holmes under the terms of the MIT license without having to worry about the patent.

The library was originally developed at msg systems, but is now being maintained at Explosion AI. Please direct any new issues or discussions to the Explosion repository.

1.2 Installation

1.2.1 Prerequisites

If you do not already have Python 3 and [pip](https://pypi.org/project/pip

Issues· 2 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Pythoninformation-extractionmachine-learningnlpontology

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category数据库
PricingOpen source

> Related tools

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库