Examples of TokenSequence


Examples of cc.mallet.types.TokenSequence

  {
  }
 
  public Instance pipe (Instance carrier)
  {
    carrier.setData(new TokenSequence((CharSequence[]) carrier.getData()));
    return carrier;
  }
View Full Code Here

Examples of com.antlersoft.query.environment.TokenSequence

  }
  class ViewLabelProvider extends LabelProvider implements ITableLabelProvider {
    public String getColumnText(Object obj, int index) {
      String name=(String)obj;
      String result=null;
      TokenSequence seq;
      switch ( index)
      {
      case 0:
        result=name;
        break;
      case 1:
        seq=Bbq_eclipsePlugin.getDefault().getQueryParser().getStoredSequence(name);
        if ( seq!=null)
        {
          if ( seq.getResult() instanceof Transform)
            result="Transform";
          else
            result="Set Expression";
        }
        break;
      case 2:
        seq=Bbq_eclipsePlugin.getDefault().getQueryParser().getStoredSequence(name);
        if ( seq!=null)
        {
          result=seq.toString();
        }
        break;
      }
      return result;
    }
View Full Code Here

Examples of org.netbeans.api.lexer.TokenSequence

        AbstractDocument doc = (AbstractDocument) context.getDocument();
        doc.readLock();
        try {
            TokenHierarchy th = TokenHierarchy.get(doc);
            TokenSequence ts = th.tokenSequence();
            Token token = findTokenAtContext(ts, context.getSearchOffset());
            if (token == null) {
                return null;
            }
            int ordinal = token.id().ordinal();
            for (BracePair bp : bracePairs) {
                if (ordinal == bp.open) {
                    originToken = bp.open;
                    matchToken = bp.close;
                    searchForward = true;
                    ret = new int[]{ts.offset(), ts.offset() + token.length()};
                } else if (ordinal == bp.close) {
                    originToken = bp.close;
                    matchToken = bp.open;
                    searchForward = false;
                    ret = new int[]{ts.offset(), ts.offset() + token.length()};
                }
            }
        } finally {
            ((AbstractDocument) context.getDocument()).readUnlock();
        }
View Full Code Here

Examples of org.netbeans.api.lexer.TokenSequence

        AbstractDocument doc = (AbstractDocument) context.getDocument();
        doc.readLock();
        try {
            TokenHierarchy th = TokenHierarchy.get(doc);
            TokenSequence ts = th.tokenSequence();
            //System.out.println("--------------------");
            ret = findPaar(ts, context.getSearchOffset(), originToken, matchToken, searchForward);
        } finally {
            ((AbstractDocument) context.getDocument()).readUnlock();
        }
View Full Code Here

Examples of org.netbeans.api.lexer.TokenSequence

    }

    private void reformat(Context context, int indent) {
        Document doc = context.document();
        TokenHierarchy th = TokenHierarchy.get(doc);
        TokenSequence ts = th.tokenSequence();
        ts.moveStart();
        int newIndent = 0;
        boolean nextIndent = false;
        TreeMap<Integer, Integer> newIdentMap = new TreeMap<Integer, Integer>(new ReverseOrderInteger());
        do {
            Token token = ts.token();
            if (token != null && token.id().ordinal() != PL_SQLLexer.WHITESPACE) {
                if (nextIndent) {
                    newIndent += indent;
                    nextIndent = false;
                }
                if (FORMAT_TOKEN_LIST.contains(token.id().ordinal())) {
                    nextIndent = true;
                }
                if (LA(token, ts)) {
                    newIndent -= indent;
                }
                if (newIndent < 0) {
                    newIndent = 0;
                }
                try {
                    newIdentMap.put(context.lineStartOffset(ts.offset()), newIndent);
                } catch (BadLocationException ex) {
                    Exceptions.printStackTrace(ex);
                }
            }
        } while (ts.moveNext());
        for (Integer line : newIdentMap.keySet()) {
            //System.out.println(line + " : " + newIdentMap.get(line));
            setIndent(context, line, newIdentMap.get(line));
        }
        //System.out.println("--------------------");
View Full Code Here

Examples of org.netbeans.api.lexer.TokenSequence

    }

    public void reindent(Context context) {
        Document doc = context.document();
        TokenHierarchy th = TokenHierarchy.get(doc);
        TokenSequence ts = th.tokenSequence();
        int startOffset = context.startOffset();
        /*int endOffset = context.endOffset();
        System.out.println("startOffset=" + startOffset);
        System.out.println("endOffset=" + endOffset);*/
        try {
View Full Code Here

Examples of uk.ac.cam.ch.wwmm.oscar3.recogniser.document.TokenSequence

   *
   * @param word The string to test.
   */
  public static void destroyInstanceIfWordTokenises(String word) {
    if(myInstance == null) return;
    TokenSequence ts = Tokeniser.getInstance().tokenise(word);
    if(ts.getTokens().size() > 1) myInstance = null;
  }
View Full Code Here

Examples of uk.ac.cam.ch.wwmm.oscar3.recogniser.document.TokenSequence

   *
   * @param word The string to test.
   */
  public static void destroyInstanceIfWordTokenises(String word) {
    if(myInstance == null) return;
    TokenSequence ts = Tokeniser.getInstance().tokenise(word);
    if(ts.getTokens().size() > 1) myInstance = null;
  }
View Full Code Here

Examples of uk.ac.cam.ch.wwmm.oscar3.recogniser.document.TokenSequence

        ontDFANumber++;
      }
      type = type + "_" + ontDFANumber;*/
    }

    TokenSequence ts = Tokeniser.getInstance().tokenise(ne);
    List<String> tokens = ts.getTokenStringList();

    if(!alwaysAdd && tokens.size() == 1 && !ne.contains("$")) return;
    StringBuffer sb = new StringBuffer();
    for(String token : tokens) {
      sb.append(getRepForToken(token));
View Full Code Here

Examples of uk.ac.cam.ch.wwmm.oscar3.recogniser.document.TokenSequence

                featuresForAbbrev.add(abbrMode + "abbr<" + thresh);
              }             
            }
          } else {
            int tokID = ne.getFirstToken().getId();
            TokenSequence tokSeq = ne.getFirstToken().getTokenSequence();
            int length = surf.length();
            boolean isAcro = false;
            if(allCaps.matcher(surf).matches()) {
              if(length <= (tokID - 1)) {
                isAcro = true;
                for(int i=0;i<length;i++) {
                  if(!tokSeq.getToken(tokID - length - 1 + i).getValue().toUpperCase().startsWith(surf.substring(i,i+1))) isAcro = false;
                }
                if(isAcro) {
                  featuresForAbbrev.add("allUpperAbbrev");
                }
              }
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.