You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@manifoldcf.apache.org by Maciej Liżewski <ma...@gmail.com> on 2012/10/08 17:03:01 UTC
question about multiple languages
Hi,
I would like to know what is the default approach to handle multiple
languages in documents? I know that there is a component for
"update"/"extract" process that can "automagically" guess the
languages and put the language name in attribute and map field names
to "*_[lang]" (I know that this is not general solr forum, but I think
there are experienced developers)
Now there are two possibilities:
1. when fields are untouched - processing data (stemming, etc) is same
for every document, which is rather wrong because polish stemming is
different from english one... :)
2. attributes are mapped to *_lang and every *_lang field has
different processing definition (stemming, stop words, etc).
This part I understand,
but I am confused on how to perform valid queries in both cases? I
have single (simple) page which should work google-like: you enter a
text and get results. But there is no "language guess" process for
queries... Do I have to specify on each query whether it should search
in 'text_en' or 'text_pl' fields? If so - it is not very good because
I would like users to get all documents that match query no matter
what language they are written in. There are many similar words,
technical names, etc, which are same in many languages...
In other words - how to achieve google-like search with stemming for
multiple languages and without to force users to select language they
would like to search in?
Re: question about multiple languages
Posted by Maciej Liżewski <ma...@gmail.com>.
Thanks Erlen for your hints!
2012/10/9 Erlend Garåsen <e....@usit.uio.no>:
> On 09.10.12 14.19, Maciej Liżewski wrote:
>>>
>>> Google does a guessing about the query language. If you hit
>>> www.google.com,
>>> you will be redirected to www.google.pl if you're sitting in Poland. This
>>> may also be achieved in your application by detecting the browser's
>>> locale
>>> etc. Many web application frameworks have support for this. Then you may
>>> give (at query time) a higher boost to the fields belonging to the
>>> language
>>> detected.
>>
>>
>> ...but even when searching in google.pl I will get results in any
>> language if only it match my query :)
>
>
> Yes, but what I suggested was to use a higher boost value for the Polish
> search fields if Polish was the detected language. This can be done by
> specifying the boost value in your query for these fields. You will still
> search the English fields as well, but the boost value for the Polish fields
> are higher. And vice versa.
>
>
>> anyway - thanks for your help (both of you). Reading your answers and
>> googling let me achieve desired efect. What really I needed was dismax
>> and searching multiple fields.
>> one more time - sorry for bothering.
>
>
> Use edismax instead. This opens up for nice features you would like to use,
> for instance give higher rank to newer documents:
> http://wiki.apache.org/solr/ExtendedDisMax
>
> Good luck!
>
>
> Erlend
>
> --
> Erlend Garåsen
> Center for Information Technology Services
> University of Oslo
> P.O. Box 1086 Blindern, N-0317 OSLO, Norway
> Ph: (+47) 22840193, Fax: (+47) 22852970, Mobile: (+47) 91380968, VIP: 31050
Re: question about multiple languages
Posted by Erlend Garåsen <e....@usit.uio.no>.
On 09.10.12 14.19, Maciej Liżewski wrote:
>> Google does a guessing about the query language. If you hit www.google.com,
>> you will be redirected to www.google.pl if you're sitting in Poland. This
>> may also be achieved in your application by detecting the browser's locale
>> etc. Many web application frameworks have support for this. Then you may
>> give (at query time) a higher boost to the fields belonging to the language
>> detected.
>
> ...but even when searching in google.pl I will get results in any
> language if only it match my query :)
Yes, but what I suggested was to use a higher boost value for the Polish
search fields if Polish was the detected language. This can be done by
specifying the boost value in your query for these fields. You will
still search the English fields as well, but the boost value for the
Polish fields are higher. And vice versa.
> anyway - thanks for your help (both of you). Reading your answers and
> googling let me achieve desired efect. What really I needed was dismax
> and searching multiple fields.
> one more time - sorry for bothering.
Use edismax instead. This opens up for nice features you would like to
use, for instance give higher rank to newer documents:
http://wiki.apache.org/solr/ExtendedDisMax
Good luck!
Erlend
--
Erlend Garåsen
Center for Information Technology Services
University of Oslo
P.O. Box 1086 Blindern, N-0317 OSLO, Norway
Ph: (+47) 22840193, Fax: (+47) 22852970, Mobile: (+47) 91380968, VIP: 31050
Re: question about multiple languages
Posted by Maciej Liżewski <ma...@gmail.com>.
> Google does a guessing about the query language. If you hit www.google.com,
> you will be redirected to www.google.pl if you're sitting in Poland. This
> may also be achieved in your application by detecting the browser's locale
> etc. Many web application frameworks have support for this. Then you may
> give (at query time) a higher boost to the fields belonging to the language
> detected.
...but even when searching in google.pl I will get results in any
language if only it match my query :)
anyway - thanks for your help (both of you). Reading your answers and
googling let me achieve desired efect. What really I needed was dismax
and searching multiple fields.
one more time - sorry for bothering.
Re: question about multiple languages
Posted by Erlend Garåsen <e....@usit.uio.no>.
On 08.10.12 17.03, Maciej Liżewski wrote:
> Now there are two possibilities:
> 1. when fields are untouched - processing data (stemming, etc) is same
> for every document, which is rather wrong because polish stemming is
> different from english one... :)
> 2. attributes are mapped to *_lang and every *_lang field has
> different processing definition (stemming, stop words, etc).
The latter seems more reasonable for me and is more common practice.
There are different stemmers you may try out such as Hunspell.
If you want to detect languages, I would use
TikaLanguageIdentifierUpdateProcessorFactory:
http://wiki.apache.org/solr/LanguageDetection
It can be configured by using an Update Request Processor:
http://wiki.apache.org/solr/UpdateRequestProcessor
> This part I understand,
> but I am confused on how to perform valid queries in both cases? I
> have single (simple) page which should work google-like: you enter a
> text and get results. But there is no "language guess" process for
> queries... Do I have to specify on each query whether it should search
> in 'text_en' or 'text_pl' fields? If so - it is not very good because
> I would like users to get all documents that match query no matter
> what language they are written in. There are many similar words,
> technical names, etc, which are same in many languages...
I think you should search in both fields, yes. I will explain why
further down.
> In other words - how to achieve google-like search with stemming for
> multiple languages and without to force users to select language they
> would like to search in?
Google does a guessing about the query language. If you hit
www.google.com, you will be redirected to www.google.pl if you're
sitting in Poland. This may also be achieved in your application by
detecting the browser's locale etc. Many web application frameworks have
support for this. Then you may give (at query time) a higher boost to
the fields belonging to the language detected.
Erlend
--
Erlend Garåsen
Center for Information Technology Services
University of Oslo
P.O. Box 1086 Blindern, N-0317 OSLO, Norway
Ph: (+47) 22840193, Fax: (+47) 22852970, Mobile: (+47) 91380968, VIP: 31050
Re: question about multiple languages
Posted by Karl Wright <da...@gmail.com>.
Hi Maciej,
Did you intend to send this to the Solr/Lucene dev list? This really
isn't a ManifoldCF question.
I can help a little perhaps. You are correct that stemming and
normalization rules might well differ from language to language, but
it is worth noting that for at least normalization it is possible to
chain together normalization filters that do not collide with one
another. For stemming, this is often true as well. But if you are
using a language set where there are likely to be different treatments
for the same word, you need to basically do BOTH filters in parallel.
One way to do it is to use n different analyses on each query string,
and put together a dismax OR term query for each different analysis.
Karl
On Mon, Oct 8, 2012 at 11:03 AM, Maciej Liżewski
<ma...@gmail.com> wrote:
> Hi,
>
> I would like to know what is the default approach to handle multiple
> languages in documents? I know that there is a component for
> "update"/"extract" process that can "automagically" guess the
> languages and put the language name in attribute and map field names
> to "*_[lang]" (I know that this is not general solr forum, but I think
> there are experienced developers)
>
> Now there are two possibilities:
> 1. when fields are untouched - processing data (stemming, etc) is same
> for every document, which is rather wrong because polish stemming is
> different from english one... :)
> 2. attributes are mapped to *_lang and every *_lang field has
> different processing definition (stemming, stop words, etc).
>
> This part I understand,
> but I am confused on how to perform valid queries in both cases? I
> have single (simple) page which should work google-like: you enter a
> text and get results. But there is no "language guess" process for
> queries... Do I have to specify on each query whether it should search
> in 'text_en' or 'text_pl' fields? If so - it is not very good because
> I would like users to get all documents that match query no matter
> what language they are written in. There are many similar words,
> technical names, etc, which are same in many languages...
>
> In other words - how to achieve google-like search with stemming for
> multiple languages and without to force users to select language they
> would like to search in?