Examples of termText()


Examples of org.apache.lucene.analysis.Token.termText()

            StringBuffer sb = new StringBuffer(statement);
            for (int i = suggestions.length - 1; i >= 0; i--)
            {
               Token t = tokens.get(i);
               // only replace if word acutally changed
               if (!t.termText().equalsIgnoreCase(suggestions[i]))
               {
                  sb.replace(t.startOffset(), t.endOffset(), suggestions[i]);
               }
            }
            // if suggestion is same as a statement return null
View Full Code Here

Examples of org.apache.lucene.analysis.Token.termText()

            while ((t = ts.next()) != null)
            {
               String origWord = statement.substring(t.startOffset(), t.endOffset());
               if (t.getPositionIncrement() > 0)
               {
                  words.add(t.termText());
                  tokens.add(t);
               }
               else
               {
                  // very simple implementation: use termText with length
View Full Code Here

Examples of org.apache.lucene.analysis.Token.termText()

               else
               {
                  // very simple implementation: use termText with length
                  // closer to original word
                  Token current = tokens.get(tokens.size() - 1);
                  if (Math.abs(origWord.length() - current.termText().length()) > Math.abs(origWord.length()
                     - t.termText().length()))
                  {
                     // replace current token and word
                     words.set(words.size() - 1, t.termText());
                     tokens.set(tokens.size() - 1, t);
View Full Code Here

Examples of org.apache.lucene.analysis.Token.termText()

            StringBuffer sb = new StringBuffer(statement);
            for (int i = suggestions.length - 1; i >= 0; i--)
            {
               Token t = tokens.get(i);
               // only replace if word acutally changed
               if (!t.termText().equalsIgnoreCase(suggestions[i]))
               {
                  sb.replace(t.startOffset(), t.endOffset(), suggestions[i]);
               }
            }
            // if suggestion is same as a statement return null
View Full Code Here

Examples of org.apache.lucene.analysis.Token.termText()

            while ((t = ts.next()) != null)
            {
               String origWord = statement.substring(t.startOffset(), t.endOffset());
               if (t.getPositionIncrement() > 0)
               {
                  words.add(t.termText());
                  tokens.add(t);
               }
               else
               {
                  // very simple implementation: use termText with length
View Full Code Here

Examples of org.apache.lucene.analysis.Token.termText()

               else
               {
                  // very simple implementation: use termText with length
                  // closer to original word
                  Token current = tokens.get(tokens.size() - 1);
                  if (Math.abs(origWord.length() - current.termText().length()) > Math.abs(origWord.length()
                     - t.termText().length()))
                  {
                     // replace current token and word
                     words.set(words.size() - 1, t.termText());
                     tokens.set(tokens.size() - 1, t);
View Full Code Here

Examples of org.apache.lucene.analysis.Token.termText()

            StringBuffer sb = new StringBuffer(statement);
            for (int i = suggestions.length - 1; i >= 0; i--)
            {
               Token t = tokens.get(i);
               // only replace if word acutally changed
               if (!t.termText().equalsIgnoreCase(suggestions[i]))
               {
                  sb.replace(t.startOffset(), t.endOffset(), suggestions[i]);
               }
            }
            // if suggestion is same as a statement return null
View Full Code Here

Examples of org.apache.lucene.analysis.Token.termText()

            while ((t = ts.next()) != null)
            {
               String origWord = statement.substring(t.startOffset(), t.endOffset());
               if (t.getPositionIncrement() > 0)
               {
                  words.add(t.termText());
                  tokens.add(t);
               }
               else
               {
                  // very simple implementation: use termText with length
View Full Code Here

Examples of org.apache.lucene.analysis.Token.termText()

               else
               {
                  // very simple implementation: use termText with length
                  // closer to original word
                  Token current = tokens.get(tokens.size() - 1);
                  if (Math.abs(origWord.length() - current.termText().length()) > Math.abs(origWord.length()
                     - t.termText().length()))
                  {
                     // replace current token and word
                     words.set(words.size() - 1, t.termText());
                     tokens.set(tokens.size() - 1, t);
View Full Code Here

Examples of org.apache.lucene.analysis.Token.termText()

      try
      {
        token = ts.next();
        while(token != null)
        {
          stringList.add(token.termText());
          token = ts.next();
        }
      }
      catch(IOException ex)
      {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.