2016-04-20 16:10:56 -04:00
|
|
|
[[analysis-fingerprint-analyzer]]
|
|
|
|
=== Fingerprint Analyzer
|
|
|
|
|
|
|
|
The `fingerprint` analyzer implements a
|
|
|
|
https://github.com/OpenRefine/OpenRefine/wiki/Clustering-In-Depth#fingerprint[fingerprinting algorithm]
|
|
|
|
which is used by the OpenRefine project to assist in clustering.
|
|
|
|
|
2016-05-11 08:17:56 -04:00
|
|
|
Input text is lowercased, normalized to remove extended characters, sorted,
|
|
|
|
deduplicated and concatenated into a single token. If a stopword list is
|
|
|
|
configured, stop words will also be removed.
|
2016-04-20 16:10:56 -04:00
|
|
|
|
2016-05-11 08:17:56 -04:00
|
|
|
[float]
|
|
|
|
=== Definition
|
2016-04-20 16:10:56 -04:00
|
|
|
|
2016-05-11 08:17:56 -04:00
|
|
|
It consists of:
|
2016-04-20 16:10:56 -04:00
|
|
|
|
2016-05-11 08:17:56 -04:00
|
|
|
Tokenizer::
|
|
|
|
* <<analysis-standard-tokenizer,Standard Tokenizer>>
|
2016-04-20 16:10:56 -04:00
|
|
|
|
2016-05-12 09:34:15 -04:00
|
|
|
Token Filters (in order)::
|
|
|
|
1. <<analysis-lowercase-tokenfilter,Lower Case Token Filter>>
|
|
|
|
2. <<analysis-asciifolding-tokenfilter>>
|
|
|
|
3. <<analysis-stop-tokenfilter,Stop Token Filter>> (disabled by default)
|
|
|
|
4. <<analysis-fingerprint-tokenfilter>>
|
2016-04-20 16:10:56 -04:00
|
|
|
|
2016-05-11 08:17:56 -04:00
|
|
|
[float]
|
|
|
|
=== Example output
|
2016-04-20 16:10:56 -04:00
|
|
|
|
2016-05-11 08:17:56 -04:00
|
|
|
[source,js]
|
|
|
|
---------------------------
|
|
|
|
POST _analyze
|
|
|
|
{
|
|
|
|
"analyzer": "fingerprint",
|
|
|
|
"text": "Yes yes, Gödel said this sentence is consistent and."
|
|
|
|
}
|
|
|
|
---------------------------
|
|
|
|
// CONSOLE
|
2016-04-20 16:10:56 -04:00
|
|
|
|
2016-05-11 08:17:56 -04:00
|
|
|
The above sentence would produce the following single term:
|
2016-04-20 16:10:56 -04:00
|
|
|
|
2016-05-11 08:17:56 -04:00
|
|
|
[source,text]
|
|
|
|
---------------------------
|
|
|
|
[ and consistent godel is said sentence this yes ]
|
|
|
|
---------------------------
|
|
|
|
|
|
|
|
[float]
|
|
|
|
=== Configuration
|
|
|
|
|
|
|
|
The `fingerprint` analyzer accepts the following parameters:
|
|
|
|
|
|
|
|
[horizontal]
|
|
|
|
`separator`::
|
|
|
|
|
|
|
|
The character to use to concate the terms. Defaults to a space.
|
|
|
|
|
|
|
|
`max_output_size`::
|
|
|
|
|
|
|
|
The maximum token size to emit. Defaults to `255`. Tokens larger than
|
|
|
|
this size will be discarded.
|
|
|
|
|
|
|
|
`preserve_original`::
|
|
|
|
|
|
|
|
If `true`, emits two tokens: one with ASCII-folding of terms that contain
|
|
|
|
extended characters (if any) and one with the original characters.
|
|
|
|
Defaults to `false`.
|
|
|
|
|
|
|
|
`stopwords`::
|
|
|
|
|
|
|
|
A pre-defined stop words list like `_english_` or an array containing a
|
|
|
|
list of stop words. Defaults to `_none_`.
|
|
|
|
`stopwords_path`::
|
|
|
|
|
|
|
|
The path to a file containing stop words.
|
|
|
|
|
|
|
|
See the <<analysis-stop-tokenfilter,Stop Token Filter>> for more information
|
|
|
|
about stop word configuration.
|
|
|
|
|
|
|
|
|
|
|
|
[float]
|
|
|
|
=== Example configuration
|
|
|
|
|
|
|
|
In this example, we configure the `fingerprint` analyzer to use the
|
|
|
|
pre-defined list of English stop words, and to emit a second token in
|
|
|
|
the presence of non-ASCII characters:
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
----------------------------
|
|
|
|
PUT my_index
|
|
|
|
{
|
|
|
|
"settings": {
|
|
|
|
"analysis": {
|
|
|
|
"analyzer": {
|
|
|
|
"my_fingerprint_analyzer": {
|
|
|
|
"type": "fingerprint",
|
|
|
|
"stopwords": "_english_",
|
|
|
|
"preserve_original": true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GET _cluster/health?wait_for_status=yellow
|
|
|
|
|
|
|
|
POST my_index/_analyze
|
|
|
|
{
|
|
|
|
"analyzer": "my_fingerprint_analyzer",
|
|
|
|
"text": "Yes yes, Gödel said this sentence is consistent and."
|
|
|
|
}
|
|
|
|
----------------------------
|
|
|
|
// CONSOLE
|
|
|
|
|
|
|
|
The above example produces the following two terms:
|
|
|
|
|
|
|
|
[source,text]
|
|
|
|
---------------------------
|
|
|
|
[ consistent godel said sentence yes, consistent gödel said sentence yes ]
|
|
|
|
---------------------------
|