How to get multiple corrections with phrase suggester?


(Alexey Kotlyarov) #1

I want to correct multiple terms in a phrase at a time using the phrase
suggester. However, ES only suggests changing one or the other, and not
both.

My setup: https://www.found.no/play/gist/9316842

Data:
[
{ "value": "broken" },
{ "value": "problem" }
]

Query:

{
    "suggest": {
        "text": "braken prablem",
        "simple_phrase": {
            "phrase": {
                "field": "value"
            }
        }
    },
    "size": 0
}

I get back "braken problem" and "broken prablem". How do I reformulate the
query so I get the expected "broken problem"?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/c60a821d-e6c4-4196-814b-0a90dd731880%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Nik Everett) #2

Set max_errors to 2. Numbers greater than two can get quite slow so try to
stick with 1 or 2.

On Sun, Mar 2, 2014 at 9:28 PM, Alexey Kotlyarov koterpillar@gmail.comwrote:

I want to correct multiple terms in a phrase at a time using the phrase
suggester. However, ES only suggests changing one or the other, and not
both.

My setup: https://www.found.no/play/gist/9316842

Data:
[
{ "value": "broken" },
{ "value": "problem" }
]

Query:

{
    "suggest": {
        "text": "braken prablem",
        "simple_phrase": {
            "phrase": {
                "field": "value"
            }
        }
    },
    "size": 0
}

I get back "braken problem" and "broken prablem". How do I reformulate the
query so I get the expected "broken problem"?

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/c60a821d-e6c4-4196-814b-0a90dd731880%40googlegroups.comhttps://groups.google.com/d/msgid/elasticsearch/c60a821d-e6c4-4196-814b-0a90dd731880%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAPmjWd2av98ZsknKqPvpWes3Sws7h6Y-3C4F4QC3tKhqkmvYTA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Alexey Kotlyarov) #3

No luck: now I've run into inconsistency between found.no and my own
instance.

Here's the updated
fiddle: https://www.found.no/play/gist/a9b668ffd8019a73cb00

And here's my own attempt to reproduce:

curl -XDELETE http://localhost:9200/zzzz
curl -XPUT http://localhost:9200/zzzz/yyyy/1 -d '{"value": "broken"}'
curl -XPUT http://localhost:9200/zzzz/yyyy/2 -d '{"value": "problem"}'
curl -XPOST http://localhost:9200/zzzz/_refresh
curl -XPOST 'http://localhost:9200/zzzz/yyyy/_search?pretty=1' -d '{
"suggest": {
"text": "borken porblem",
"simple_phrase": {
"phrase": {
"field": "value",
"max_errors": 3,
"size": 100
}
}
},
"size": 0
}'

found.no returns the following options (with scores):
"broken problem": 0.47322324
"borken problem": 0.37071815
"broken porblem": 0.36621025

My own instance:
"borken problem": 0.6768855
"broken porblem": 0.6686546

Why are the scores different? Why do the results differ? How do I get the
"broken problem" (and, ideally, no other suggestions)?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/defc99f7-c765-42c3-8587-0d74d55aec9f%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #4