Examples of Token


Examples of org.apache.uima.examples.opennlp.Token

      int mapIdx = 0;

      // iterate over Tokens
      FSIterator tokenIterator = tokenIndex.subiterator(sentence);
      while (tokenIterator.hasNext()) {
        Token token = (Token) tokenIterator.next();

        String word = escapeToken(token.getCoveredText());

        int start = sentenceBuffer.length();
        int end = start + word.length();

        int origIdx = token.getBegin();
        for (mapIdx = start; mapIdx <= end; mapIdx++) {
          offsetMap.putMapping(mapIdx, origIdx);
          if (origIdx < token.getEnd())
            origIdx++;
        }

        sentenceBuffer.append(word + " ");
        wordList.add(word);
View Full Code Here

Examples of org.apache.uima.examples.tagger.trainAndTest.Token

    //    for (int i=0; i<sentences.size(); i++){ // iterate over sentences
         
             List<Token> tokens2 = new ArrayList<Token>(tokens.size());
            
             for (int x=0; x<tokens.size(); x++){ // iterate over tokens of the sentence with their corresponding POS
               Token current_token = (Token)tokens.get(x);
             
               if(current_token.pos.startsWith("N")){
                 current_token.pos="Noun";
               }
               if(current_token.pos.startsWith("V")){
                 current_token.pos="Verb";
               }
               if(current_token.pos.startsWith("ADJ")){
                 current_token.pos="Adjective";
               }
               if(current_token.pos.startsWith("P")){
                 current_token.pos="Pronoun";
               }
               if(current_token.pos.startsWith("KO")){
                 current_token.pos="Conjunction";
               }
               if(current_token.pos.startsWith("AP")){
                 current_token.pos="Preposition";
               }
               if(current_token.pos.startsWith("PTK")){
                 current_token.pos="PTK";
               }
               if(current_token.pos.startsWith("ADV")){
                 current_token.pos="Adverb";
               }
              
               if(current_token.pos.startsWith("ART")){
                 current_token.pos="Article";
               }
              
               if(current_token.pos.startsWith("ITJ")){
                 current_token.pos="Interjection";
               }
              
               Token zwischen = new Token(current_token.word, current_token.pos);
      
               tokens2.add(zwischen);
             }
            return tokens2;
           
View Full Code Here

Examples of org.apache.uima.fit.examples.type.Token

  public static class Annotator1 extends JCasAnnotator_ImplBase {
    @Override
    public void process(JCas jCas) throws AnalysisEngineProcessException {
      String text = jCas.getDocumentText();
      for (int i = 0; i < text.length() - 3; i += 3) {
        new Token(jCas, i, i + 3).addToIndexes();
      }
    }
View Full Code Here

Examples of org.apache.uima.fit.type.Token

    // Index should be added the descriptor and thus end up in the CAS generated from the
    // analysis engine.
    AnalysisEngine desc = createEngine(IndexTestComponent.class);
    JCas jcas = desc.newJCas();

    Token token1 = new Token(jcas, 1, 2);
    token1.addToIndexes();

    // index1 is a sorted index, so when adding a token twice, both remain in the index
    Token token2 = new Token(jcas, 3, 4);
    token2.addToIndexes();
    token2.addToIndexes();

    Sentence sentence1 = new Sentence(jcas, 1, 2);
    sentence1.addToIndexes();

    // index2 is a set index, so even when adding a sentence twice, only one remains in the index
View Full Code Here

Examples of org.apache.velocity.runtime.parser.Token

        return true;
    }

    private String getRoot()
    {
        Token t = getFirstToken();

        /*
         *  we have a special case where something like
         *  $(\\)*!, where the user want's to see something
         *  like $!blargh in the output, but the ! prevents it from showing.
View Full Code Here

Examples of org.apache.ws.secpolicy.model.Token

            return;
        }
       
        ArrayList tokens = suppTok.getTokens();
        for (Iterator iter = tokens.iterator(); iter.hasNext();) {
            Token token = (Token) iter.next();
            if(token instanceof UsernameToken) {
                //Check presence of a UsernameToken
                WSSecurityEngineResult utResult = WSSecurityUtil.fetchActionResult(results, WSConstants.UT);
                if(utResult == null) {
                    throw new RampartException("usernameTokenMissing");
View Full Code Here

Examples of org.apache.ws.security.policy.model.Token

        while (it.hasNext()) {
            if (wst.supportTokens == null) {
                wst.supportTokens = new ArrayList();
            }

            Token tok = (Token) it.next();
            if (tok instanceof X509Token) {
                WSS4JPolicyToken wpt = new WSS4JPolicyToken();
                wst.supportTokens.add(wpt);
                initializeWSS4JPolicyToken(wpt, (X509Token) tok, suite);
            }
View Full Code Here

Examples of org.blueoxygen.cimande.Token

        super();
        initComponents();
        initHibernate();

        sess = sf.openSession();
        token = new Token();
        token.setSession(sess);
        token.setUser((User)sess.get(User.class, userId));
        token.put("LOGIN_TIME", new Timestamp(System.currentTimeMillis()));
    }
View Full Code Here

Examples of org.camunda.bpm.engine.impl.juel.Scanner.Token

  /**
   * consume current token (get next token).
   * @return the consumed token (which was the current token when calling this method)
   */
  protected final Token consumeToken() throws ScanException, ParseException {
    Token result = token;
    if (lookahead.isEmpty()) {
      token = scanner.next();
      position = scanner.getPosition();
    } else {
      LookaheadToken next = lookahead.remove(0);
View Full Code Here

Examples of org.codehaus.groovy.syntax.Token

            //     Day next() {
            //        int ordinal = ordinal().next()
            //        if (ordinal >= values().size()) ordinal = 0
            //        return values()[ordinal]
            //     }
            Token assign = Token.newSymbol(Types.ASSIGN, -1, -1);
            Token ge = Token.newSymbol(Types.COMPARE_GREATER_THAN_EQUAL, -1, -1);
            MethodNode nextMethod = new MethodNode("next", Opcodes.ACC_PUBLIC | Opcodes.ACC_SYNTHETIC, enumClass, new Parameter[0], ClassNode.EMPTY_ARRAY, null);
            nextMethod.setSynthetic(true);
            BlockStatement code = new BlockStatement();
            BlockStatement ifStatement = new BlockStatement();
            ifStatement.addStatement(
                    new ExpressionStatement(
                            new BinaryExpression(new VariableExpression("ordinal"), assign, new ConstantExpression(Integer.valueOf(0)))
                    )
            );

            code.addStatement(
                    new ExpressionStatement(
                            new DeclarationExpression(
                                    new VariableExpression("ordinal"),
                                    assign,
                                    new MethodCallExpression(
                                            new MethodCallExpression(
                                                    VariableExpression.THIS_EXPRESSION,
                                                    "ordinal",
                                                    MethodCallExpression.NO_ARGUMENTS),
                                            "next",
                                            MethodCallExpression.NO_ARGUMENTS
                                    )
                            )
                    )
            );
            code.addStatement(
                    new IfStatement(
                            new BooleanExpression(new BinaryExpression(
                                    new VariableExpression("ordinal"),
                                    ge,
                                    new MethodCallExpression(
                                            new FieldExpression(values),
                                            "size",
                                            MethodCallExpression.NO_ARGUMENTS
                                    )
                            )),
                            ifStatement,
                            EmptyStatement.INSTANCE
                    )
            );
            code.addStatement(
                    new ReturnStatement(
                            new MethodCallExpression(new FieldExpression(values), "getAt", new VariableExpression("ordinal"))
                    )
            );
            nextMethod.setCode(code);
            enumClass.addMethod(nextMethod);
        }

        if (!hasPrevious) {
            // create previous() method, code:
            //    Day previous() {
            //        int ordinal = ordinal().previous()
            //        if (ordinal < 0) ordinal = values().size() - 1
            //        return values()[ordinal]
            //    }
            Token assign = Token.newSymbol(Types.ASSIGN, -1, -1);
            Token lt = Token.newSymbol(Types.COMPARE_LESS_THAN, -1, -1);
            MethodNode nextMethod = new MethodNode("previous", Opcodes.ACC_PUBLIC | Opcodes.ACC_SYNTHETIC, enumClass, new Parameter[0], ClassNode.EMPTY_ARRAY, null);
            nextMethod.setSynthetic(true);
            BlockStatement code = new BlockStatement();
            BlockStatement ifStatement = new BlockStatement();
            ifStatement.addStatement(
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.