Copyright ©
Mindbreeze GmbH, A-4020 Linz, 2024.
All rights reserved. All hardware and software names are brand names and/or trademarks of their respective manufacturers.
These documents are strictly confidential. The submission and presentation of these documents does not confer any rights to our software, our services and service outcomes or other protected rights. The dissemination, publication or reproduction hereof is prohibited.
For ease of readability, gender differentiation has been waived. Corresponding terms and definitions apply within the meaning and intent of the equal treatment principle for both sexes.
In order for the enrichment processes to be applied, the new metadata must first be added to the aggregated metadata keys in the index settings. For example:
This chapter deals with the concept, setup, and troubleshooting methods for configuring entity recognition.
In this chapter, the concept of entity recognition is explained using a simple example.
To set up entity recognition, follow these steps:
In our concrete example:
rule=/\// digits /\//.
digits=/\d+/.
Explanation:
The first rule defines that all numbers between two slashes should match (regex):
Example: test/1234test1234/test/543/test (543 is extracted)
Now add a new “Metadata Definition“ to apply the rules for metadata.
Example:
In this example, Mindbreeze searches for numbers between two slashes in the string of the existing metadata with the name “fullstring”. If there are numbers between two slashes, Mindbreeze takes the part of the matches configured in the sub-rule “digits” and writes it as a string in the new metadata “myextractedVal”.
Example:
fullstring: xyz/1234/herbert543/345test
Match of the rule “rule”: /1234/
Value of the rule “digits”: 1234
Value of the metadata myextractedVal==1234
When configuring as a metadata in Mindbreeze InSpire, the following fields must be filled in:
This chapter uses a simple example to explain entity recognition and its setup with Mindbreeze.
Pattern Rules:
host=/[^\\]+/.
share=/[^\\]+/.
directory=/[^\\]+/.
UNCPath="\\\\" host "\\" share "\\" directory "\\".
Metadata-Definition 1:
If Rule Matches: UNCPath
Name: FileShare
Value: {{share}}
In Existing Metadata: datasource/mes:key
Metadata-Definition 2:
If Rule Matches: UNCPath
Name: ProjectPath
Value: {{directory}}
In Existing Metadata: datasource/mes:key
Aggregated Metadata Keys (; separated): FileShare; ProjectPath
Date formats for entity recognition are based on the ICU patterns (e.g. locale … de_AT)
If the rules are ambiguous, alternative rules, ordering by naming and correct ordering of the metadata extraction definitions can be used to enable more complex usecases. The path as metadata is lower-case and thus better for CSV mapping.
Even a complex use case, in which the rules are ambiguous can be achieved using alternative rules and sequencing by name, as well as the correct sequencing of the multiple metadata extraction. The path, a metadata, is lower-case and thus better for CSV mapping.
Note: An OR (|) operator of sub-rules does not work!
Simple solution without exception:
Pattern rules:
LWPath=/\\\\[^\\]+\\[^\\]+\\[^\\]+\\[^\\]+/.
FilePath=/[^\\]+/.
FullPath=LWPath "\\" FilePath.
Solution with an exception (data\it):
Pattern rules:
ASpecialPath="data\\it".
OtherPath=/[^\\]+/.
BaseShare=/\\\\[^\\]+\\[^\\]+\\[^\\]+/.
LWPathA= BaseShare "\\" ASpecialPath.
LWPathOther= BaseShare "\\" OtherPath.
FilePathA=/[^\\].*/.
FilePathOther=/[^\\].*/.
FullPathA=LWPathA "\\" FilePathA.
FullPathOther=LWPathOther "\\" FilePathOther.
The following screenshot demonstrates the configuration of the rules.
CSV-transform: the extracted value (file share) is case sensitive, so the cases must match. That way the path can be used as source metadata.
fileshare;letter
\\fileserver.mycompany.com\qa\fstest\projekte;U:
\\fileserver.mycompany.com\qa\fstest\vorlagen;T:
\\fileserver.mycompany.com\qa\fstest\allgemein;G:
\\fileserver.mycompany.com\qa\fstest\spezial;M:
\\fileserver.mycompany.com\qa\fstest\data\it;H:
\\fileserver.mycompany.com\qa\fstest\data;H:
\\fileserver.mycompany.com\qa\fstest\data-services;H:
\\fileserver.mycompany.com\qa\fstest\allgemein-retail;G:
Note: A match with mes:key only works in CSV transformation (as well as in ER rules) using: In Property = datasource/mes:key.
Attention: /documents-Servlet does not provide values that are created via index re-invert!
This chapter deals with troubleshooting the entity recognition rules.
Check the index status at http://localhost:8443/index/<Indexport>/statistics
Entity Recognition rules are usually greedy. In the following example, the selected rows are matched:
Rule
R1=/ (?s)(test)(?P<line>.+)\s+(.*Page) /.
Match:
If greedy is deactivated, not everything is matched. Instead, only those blocks that start with test and end with Page are matched:
Rule:
(?U)(?s)(test)(?P<line>.+)\s+(.*Page)(?U)
Match:
An error with the following error message occurred while parsing the ER rules:
“MesQuery::Text::RE2Tokenizer ERROR: Matched empty (epsilon) token, pattern is”
… for instance, a „\“ at the end of a regex is not supported (LWPath=/\\\\[^\\]+\\/. … and an error occurs. Better: LWPath=/\\\\[^\\]+/ “\\“.).
There can also be possible problems with “.*“ in rules.
Entity recognition rules are analyzed in alphabetical order and the first complete match wins.
Regex rules for German words do not match all characters (umlauts, etc.) with \w. Instead, you can use \pL to match all unicode characters.
\d{4}(\s|\.|\-)\d{6}
Example
1237 010180
1237.010180
1237-010180
(\+)([\s.\(\)]*\d{1}){8,13}(-)?(\d{1,5})
Example
+43 732 606162-0
+43 732 606162-609
+49(732)606162-609
RegEx
z1=/\d/.z2=/\d/. (…)Dlmtr=/[\s\-_.:]?/.
z1 Dlmtr z2 Dlmtr z3 Dlmtr z4 Dlmtr z5 Dlmtr z6.
Example
12-34567
12 34 56-7
1-2 3456.7
((\d{1,3}(\.(\d){3})*)|\d*)(,\d{1,2})
Example
0.84
100,000.49
100,000.00
1,000,000,000,000.00
Handbook for date formats: http://userguide.icu-project.org/formatparse/datetime
(([0-1]?[0-9])|([2][0-3])):([0-5]?[0-9])(:([0-5]?[0-9]))?
Example
11:00:23
12:30
([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})
Example
david.porter@inspire.mindbreeze.com
egov@mindbreeze.com
AT\d{18}
Example
AT002105017000123456
In this example a list of entries separated by semicolon will be interpreted as well as List in Mindbreeze InSpire.
Input: List of word, word,…
value=/[^\s,][^,]*[^,\s]?/.
rule= /\s*/ value /\s*(,\s*|$)/.
New metadata is added to a document. The new metadata is created using a “catalog” (e.g. CSV file).
The following options are outlined here:
This section focuses on metadata enrichment using a CSV file. In doing this, it is possible to compare the value of a metadata with the value of a particular column in the CSV. If the value from the metadata matches the value from the column, you can write the value of another column from the same row to a new metadata and attach it to the result.
This chapter uses a concrete example to illustrate setting up CSV transformation. The following steps must be performed for the configuration:
Connect to the management center (default: https://IhreAppliance:8443).
Navigate to the Indices tab, enable the Advanced Settings, and then expand your Index.
Search for the “CSV Transformation” settings and set the function as shown in the example below.
CSV File Path: Path on the server of the CSV file copied by you
If Expression Matches: The name of the column in the CSV, which must match the value of a metadata for the transformation to be performed
In Property: The existing metadata which should be compared with the value from the column in the CSV
Name: The name of the metadata which should contain the new enriched value
Value: The name of the column, the value of which is to be written to the new metadata "Name" in order to enrich the result
Copy any CSV file to the /data/ directory on your Mindbreeze InSpire.
The value of the existing metadata (“medication”) is compared with the value from the column “Medikament”. If a row was found in which these two values were equivalent, the value is extracted from the ATC_CODE column and attached to the metadata ATC_CODE.
If you edit the CSV using a spreadsheet program such as Excel, you must ensure that the CSV is still in UTF8 format rather than UTF8-BOM format after processing.
You can check this with any text editor such as Notepad++ and, if necessary, convert it back to the UTF8 format.
Using Synthesized Metadata Definitions, rules can be created to enrich documents with metadata. These rules are dynamically evaluated at the time of the search.
Name | Name of the synthesized metadata |
Property Expression | Expression in Mindbreeze Property Expression Language used to synthesize the metadata value. |
Using Precomputed Synthesized Metadata Definitions, rules can be created to enrich documents with metadata. These rules are evaluated during index inversion to synthesize metadata.
Please note that only a subset of Mindbreeze Property Expression Language is supported for Precomputed Synthesized Metadata Definitions. All expressions in Mindbreeze Property Expression Language - Search specific language elements are not supported, which also affects expressions that contain references, such as paths or inverse references. If you want to use expressions with references, you can create Synthesized Metadata Definitions instead.
Please note that predefined Metadata, like mes:key, Category, CategoryInstance and FQCategory are not available for Precomputed Synthesized Metadata Definitions. Instead, Synthesized Metadata can be used.
The following options are available:
Name | Name of the synthesized metadata |
Property Expression | Expression in Mindbreeze Property Expression Language used to synthesize the metadata value |
Transformation Pipeline Slot | Defines where the metadata should be synthesized in the semantic pipeline. The following options are available:
|
Merge Strategy | The following options are available:
|
Aggregatable | Defines whether the synthesized metadata should be aggregatable. The following options are available:
|
This plugin annotates special words in PDF documents, which are specified in a CSV file. These annotated words (matches) are displayed in the PDF preview as clickable hyperlinks. Custom actions can be linked to these hyperlinks in a custom client. For example, a mouse-over on a particular word can display an explanation in the form of a tool tip. Additionally, the plugin can generate metadata for matches and annotate entities.
To use the plugin, the MetadataTransformationService plugin must be added to your Mindbreeze installation by loading the appropriate plugin.
The plugin is generally started as an independent service (much like caching principal resolution services). References to the service are configured in the indices. The plugin itself is configured in the section “Services”:
“Display Name“ | For simple assignment to the index, select a name that is as descriptive as possible. |
“Nodes“ | Select the node on which you want the service to run. Only indices on the same node can use the service. |
“Bind port” | A free TCP port that is not used by any other service. |
“Max Threads“ | The maximum number of threads the service is allowed to use when processing requests. |
Transformation Timeout (ms) (Advanced Setting) | Defines the timeout (in ms) after which the transformation is aborted. The metadata transformed up to this moment is saved. Default value: 250000 ms. |
Document Exclusion Rules | Rules that skip the transformation of documents with certain metadata. See the section below. |
CSV File Path | Paths to the CSV files. Column labels are expected in the first line of the CSV file. You can add several CSV files by clicking the “Add” button. The CSV files are automatically re-imported after a change. |
CSV Delimiter Character | The CSV delimiter. A character. (usually a semicolon) |
Term Column Name | Name of the CSV column used for matching in the documents. |
Entity Column Name | Name of the CSV column used for annotating entities in the documents. (Not compatible with "Entity Value") |
Entity Value | Static value which will be added as entity annotation for all matches. (Not compatible with "Entity Column Name") |
Source Metadata Name | Specifies the metadata from which the text will be taken in order to perform the matching. If this setting is empty, the text of the document is used for matching (default). |
Enable Build Hierarchy | The plugin can be switched to a hierarchy mode with this option. For this, the CSV must have a parent-child relationship between the entries, which is mapped via another column pointing to the parent entry. The hierarchy itself is then used as the metadata value. |
Parent Column Name | Name of the CSV column pointing to the parent entry (the Term-Column in the CSV). This option only has an effect when Enable Build Hierarchy is enabled. |
Skip Root Element | If this option is enabled, the root of the hierarchy is not added to the metadata value. |
Target Metadata Name | Name of the metadata which will be generated. |
Target Metadata Name Pattern | Template pattern from which the metadata name is generated. In placeholders, the CSV column names can be used in double curly brackets, for example: {{Meta Name}}. |
Target Metadata Value Pattern | Template pattern from which the metadata value is generated. In placeholders, the CSV column names can be used in double curly brackets, for example: {{Term Name}} (non-hierarchy mode). |
Merge Strategy | The solution strategy can be defined here if there is already a metadata with the same name. Either “Keep Existing“ or “Overwrite Existing“ |
Overlapping Match Strategy | If multiple overlapping matches are found in one place in the document, this option determines which matches will ultimately be used. Two strategies are available: "Longest" uses only the longest match (number of letters). Note: if "All" is used, overlapping annotations may occur in combination with the "Link HREF Pattern" option. |
Target Metadata Property Constraints | Here you can specify conditions under which a metadata value is to be added. The conditions correspond to the item properties and are configured as a comma-separated list of key value pairs, with the key value pairs separated by an equal sign, for example: name=bob,person=true. This function is usually used to prevent metadata values that are already included in the attribute metadata anyway from being added to the ("normal") metadata. The default value is empty. (all values are added) |
Target Metadata Item Name | Name of the “item” metadata. The plugin can also create a complex metadata containing the corresponding CSV entries for all matches. In addition, a list of events with properties is kept for each CSV entry. |
Target Metadata Item Default Properties | The default values of the properties in the event for the metadata item can be defined here. The properties are configured as a comma-separated list of key value pairs, where the key value pairs are separated by an equal sign. E.g. name=bob,person=true. |
Link HREF Pattern | Template pattern from which the URL is generated with which the PDF document is annotated. The CSV column names in double brackets can be used in placeholders, for example: http://www.example.com/{{Term Name}}. Note: The URL must be valid. The value of the placeholder is URL-encoded. In order for the URL to also be displayed in the PDF preview, in the settings “Aggregated Metadata Keys” of the relevant index the value “@content” must be set. |
Add Additional HREF Link HTML Annotation | If this option is enabled, additional HTML tags are created for HREF links. This makes the links also work in document previews other than PDF, such as HTML or docx. All annotations will be aggregated as well. If this option is to be enabled, a Precomputed Synthesized metadata must also be set over the content in the respective index:
"Transformation Pipeline Slot" and "Aggregatable" can be left at the default value. |
Enable Stemmer | Enables the stemmer. This increases the number of matches, as the modified forms of words also generate matches. |
Stemmer Language | The language of the stemmer. E.g. german, english, russian |
Stemmer Skip Short Roots Length | When using the stemmer, false-positive matches can occur if words in their root form become too short. This setting specifies that the stemmer will not be used for very short stem forms. Defines the minimum length of the stem form as of which the stem is no longer used. |
Stopword Vocabulary Path | Path to a text file with stop words. Stop words are ignored and skipped. One word per line applies in the text file. Case sensitive. |
Replacement Patterns | Replacement rules to replace any character string with another character rule. One rule per line. A rule consists of two parts that are separated by the character string “|>”. The left side is a regular expression (Java regular expression), the right side is any character string. Note: These replacement rules do not change the actual document content, but only affect the generation of new metadata, for example: “(?i:ö)|>oe” replaces the character “ö” with the character string “oe”. |
Attributes | Rules for adding properties to the metadata under certain conditions. See the next section. |
Filter Patterns | Rules from regular expressions (Java) to remove matches. Used to remove false positives. One rule per line. A rule consists of up to three parts. The parts are separated with <| and |>. The three parts correspond to a “prefix", “infix" and “postfix" expression of regular expressions used around a match. If all specified expressions apply, the rule is active and the match is removed. E.g. The rule John\s$<|^Joe$|>^\sDoe removes the match „Joe“, if, for instance, it occurs in connection with: “His name is John Joe Doe, she said.” To simplify, parts of the rule can also be omitted. For example, the following rules are also allowed: ^Joe$|>^\sDoe or John\s$<| The rules are case sensitive. |
Usually, every document in the index that has configured the transformation service is transformed. With this rule, however, certain documents can be omitted on the basis of metadata and will remain unchanged.
“Metadata Name“ | Name of the metadata to which the rule refers. |
“Exclusion Pattern“ | Regular expression (Java) that is matched to the value of the metadata. If there is a match, the document is not transformed. |
Metadata can be modified for matches based on rules from regular expressions. Add attributes with the plus icon.
“PatternPosition“ | The rule applies immediately before the actual match ("prefix") or immediately after the actual match ("postfix"). |
“Patterns“ | List of regular expressions (Java). One expression per line. The regular expressions are applied directly before ("prefix") or after ("postfix") the actual match. If an expression matches, the rule is active. The rules are case insensitive. For example, the rule “no\s+$” becomes active in the match "animal" when it occurs in the following context: "no animal was hurt." |
“Add Metadata Name“ | If the rule is active, a metadata item with this name is created. The value of the metadata is the same as in "Target Metadata." |
“Append HREF Value“ | If the rule is active, this string is added to the "Link HREF Pattern." Note: The URL must remain valid. No automatic URL escaping is carried out. |
“Target Metadata Item Properties“ | If the rule is active, these properties are added or overwritten to the metadata item in the event. The properties are configured as a comma-separated list of key value pairs, where the key value pairs are separated by an equal sign. E.g. name=printer,person=false |
In order for the index to use the configured service, the service must be referenced in the index settings under "Item Transformation Services." To do this, click "Add" and select the service you have specified.
A property "launchedserviceid" is automatically created; there is no need to change it.
With the installation of the MetadataTransformationService plugin, a filter plugin "FilterPlugin.HierarchicalCsvEnricher" is also registered, which can be enabled for the extension “textcatalogenricher." Navigate to the "Filter" tab in the settings. The configuration is similar to the "ItemTransformer.HierarchicalCsvEnricher" plugin. The following metadata must be set in the filter request:
“extension“ | Must be set to "textcatalogenricher" |
“contentextension“ | Determines the extension that the plugin sets after processing. E.g. “txt“ |
Enable the "Advanced Settings" and add settings for the “FilterPlugin.HierarchicalCsvEnricher – Plugin" under "Global Filter Plugin Properties."
This chapter deals with the use of the File Metadata Enricher. This plugin allows you to enrich indexed documents (e.g. PDF files) with external sources such as an XML file or a CSV file. This chapter differentiates between XML file metadata enrichment and catalog settings.
The file metadata enricher is available as an ItemTransformationService plugin and as a PostFilter plugin.
You can configure as the item transformation service for an index service:
The file metadata enricher for a filter can be configured as a post filter plugin. The transformation then happens after filtering.
This mechanism is very similar to the mechanism of CSV transformation. In essence, this is about the possibility of comparing the value of a metadata with the value in an XML file. If, for example, there is a file with content (e.g. mindbreeze.pdf) in a data source and another file that contains the metadata separately (e.g. mindbreeze.xml), they can be merged into one result to link the content to the metadata. This mechanism is explained in more detail in the following example:
File Path Source: Name of a metadata used as a source for the enrichment. For example, a metadata containing the path of the current result can be used. For instance, in the Microsoft File Connector, datasource/mes:key contains smb://myserver/testdaten/Content/.
File Path Pattern: Limits the enricher’s scope of application. All results where the mes:key values do not match the regex regex from File Path Pattern are ignored (The enricher is not applied).
File Path Replacement: The path that contains the metadata of a file is specified here. The files must be located locally on the appliance or at least mounted on it. It is possible to reference a matching value of the regex specified in File Path Pattern as a variable here. The matching groups (REGEX) can be referenced in ascending order with $1 (e.g. $1, $2, $3, ...). The group (.*) can therefore be referenced with $1. In our case, the name of the file is extracted from the string that matches the File Path Pattern.
Metadata Node XPath: Each XML node that is made by this XPATH is interpreted by the enricher as an object with metadata.
Metadata Key XPath: The string that is matched by this XPATH expression is used by the enricher as the name of the new metadata.
Metadata Value XPath: The string that is matched by this XPATH expression is used by the enricher as the value of the new metadata.
Date Format: If a format is specified in Java Simple Date Format, the enricher will try to interpret each string that is matched by Metadata Value XPath as a date in the specified format to provide the entire functionality of the Mindbreeze date format. If the string is not in the specified format, the enricher performs a fallback and interprets the matching string as a string.
This chapter uses a concrete example of the enricher for illustration.
<?xml version="1.0" encoding="utf-8"?>
<Document>
<UserID>4711_12</UserID>
<DocID>PDF_4711_12_CV_001.pdf</DocID>
<DocType>CV</DocType>
</Document>
If it matches the regex from the file path pattern, the metadata datasource/mes:key is compared with all local or mounted file names from the file path replacement path for each result that was configured for the index on which the metadata enricher is configured. In so doing, the file name that was defined as a regex group in the file path pattern is used in the File Path Replacement at the reference point.
Example:
Source file: …/1.pdf File Path Replacement: …/1.xml
If the paths match, the XML node /<Document>/* is searched for in the .xml and all child nodes of the node are interpreted as relevant information. The name of the node is interpreted as the metadata name of the new metadata to be created. If the current child node contains a text(), this is set as the value for the newly created metadata, and the metadata is attached to the current result in the index.
Example:
In our case, the following indexed metadata would be attached to the already indexed file 1.pdf:
UserID: 4711_12
DocID: PDF_4711_12_CV_001.pdf
DocType: CV
This mechanism uses a CSV file for enrichment. As with CSV transformation, information from Mindbreeze is compared with the value of a column in the CSV. Unlike CSV transformation, the metadata cannot be selected for comparison because the plugin is actively searching for matches in the content of the file. Another important function of the plugin is the recognition of negations. If, for example, there is a match for renal failure, but renal failure is not mentioned in the text, renal failure is attached to the result as a negation in a separate metadata. Additionally, this feature allows automatic links to be attached behind the hits and visualized in the PDF preview. The detailed operation of this function is explained in the following section.
Catalog File: This setting includes the path of the CSV file to be used for enrichment. The file must be located locally on the Mindbreeze InSpire Appliance or mounted on it.
Catalog Match On: This setting specifies which column of the CSV file is compared with the information from the content of the results in order to recognize a match.
Extract Metadata: In this field, the name of the metadata is specified in which the text of the Metadata Value column is inserted if there is a match. The metadata is attached to the result.
Extract Negated Metadata: With this setting, you specify the name of the metadata that contains the text of the Metadata Value column if it is matched in the case of a negation. This metadata is attached to the result. The match must be recognized as follows:
Negation Prefix Pattern + Catalog Match On (string for matching) + Negation Postfix Pattern
Extract Metadata Item: This metadata contains a structured form of the entire applied CSV. This metadata is not intended to be a filter and is only intended to support the development of Insight Apps.
Metadata Value: This field must contain the column name of the CSV defined in the Catalog File setting. If the value of the Catalog Match On column matches the string currently compared from the content of the result, the value of the column specified in the Metadata Value field is attached as a string to the metadata Extract Metadata.
Link HREF Pattern: In this setting, a link can be assembled using the extracted metadata. This link is then available in the PDF preview of the client. This link can be interpreted by the developer of the Insight App. The format of the link can be specified as follows:
https://entity.mindbreeze.com/meddra/?code={{pt_code}}
Instead of the placeholder {{pt_code}}, the value that was actually extracted is inserted in the column pt_code from the CSV at time of inversion.
Catalog ID Column: This setting determines which column of the CSV file is unique. This is used internally by Mindbreeze.
Sentence Split Pattern: This setting serves to divide the content of a sentence into sentence parts. The enricher is applied only in those parts of sentences that correspond to the regular expression given here.
Negation Prefix Pattern: This pattern specifies the prefix (usually text) to be used to recognize a negation. Here again, syntax means the syntax of the regular expressions.
Negation Postfix Pattern: This pattern specifies the Postfix (usually text) to be used to recognize a negation. Here again, the syntax means the syntax of the regular expressions.
Replacement Patterns: This field allows certain occurrences of words, sentences, or letters to be synonymous for the enricher. For example, this means it would be possible for ä to be ae and also for ae to be ä. The syntax for this is shown in the following example:
(?i:ä|ae)|>(ä|ae)
(?i:ae|ä)|>(ae|ä)
The symbol, |>, is used as separator. Each rule must be entered as a separate line in the configuration field.
The document Development of Insight Apps illustrates how the metadata can be used in a PDF preview when developing Insight Apps.