sdx-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RE : RE : [sdx-developers] Re: RE : [sdx-users] Analyseur arabe


From: Pierrick Brihaye
Subject: Re: RE : RE : [sdx-developers] Re: RE : [sdx-users] Analyseur arabe
Date: Tue, 18 Nov 2003 13:28:31 +0100
User-agent: Mozilla/5.0 (Windows; U; Win98; fr-FR; rv:1.0.2) Gecko/20030208 Netscape/7.02

Re,

Rasik Pandey a écrit:


if (
Utilities.checkString(termText) && !termText.equals(lastHilitedTermFromText) && this.terms != null &&
(this.terms.contains(termText) ||
this.terms.contains(originalTextAtTokenPosition) )
----------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^

Si on l'ajoute qu'en penses-tu?

Euh... ça n'ira pas :

"word1" donne "analysis_of_word1"
"word2" donne "first_analysis_of_word2"
        *et* "second_analysis_of_word2"

En arabe, le cas où "word" est analysé comme "word" est assez rare (mots étrangers par exemple). Donc... l'analyse est souvent différente du terme d'origine. Ca sera pareil pour "UpperCase" analysé en "lowercase".

Ce qu'il faudrait c'est faire une espèce de pile d'évènements SAX (ou de trucs permettant d'en générer) :

lastStartOffset = 0;
lastendOffset = 0;
while ((token = stream.next()) != null) {
  startOffset = token.startOffset();
  endOffset = token.endOffset();

  //Is this a new token ?
  if (lastStartOffset != startOffset) || (lastEndOffset != endOffset)
 {

    //Process previous token's events
    PopAllEvents();

    //process the text between previous and current token
char[] chars = text.substring(lastEndOffset, startOffset).toCharArray();
    if (chars != null && chars.length > 0)
      this.xmlConsumer.characters(chars, 0, chars.length);

    //Mark the current token as beiing processed
    lastStartOffset = startOffset;
    lastEndOffset = endOffset;
  }
  //Process the current token
  PushOneEvent();
}
//Process last token's events
PopAllEvents();

Ensuite, sur la stack on met soit : le terme original (une fois au maximum)
soit : des hilites

Une des questions qui se posent est comment faire plusieurs hilites ?

<sdx:hilite no="1" term="first_analysis_of_word2">word2</sdx:hilite>
<sdx:hilite no="2" term="second_analysis_of_word2">word2</sdx:hilite>

ou bien :

<sdx:hilite no="1" terms ="first_analysis_of_word2 second_analysis_of_word2">word2</sdx:hilite>

ou encore :

<sdx:hilite no="1">
  <sdx:term term="first_analysis_of_word2"/>
  <sdx:term term="second_analysis_of_word2"/>
  <sdx:originalText>word2</sdx:originalText>
</sdx:hilite>

A+

--
Pierrick Brihaye, informaticien
Service régional de l'Inventaire
DRAC Bretagne
mailto:address@hidden





reply via email to

[Prev in Thread] Current Thread [Next in Thread]