Package net.sourceforge.chaperon.model.lexicon

Examples of net.sourceforge.chaperon.model.lexicon.Lexeme


    if ((violations!=null) && (violations.getViolationCount()>0))
      throw new IllegalArgumentException("Lexicon is not valid: "+violations.getViolation(0));

    LexicalAutomaton automaton = new LexicalAutomaton(lexicon.getLexemeCount());

    Lexeme lexeme;
    PatternAutomaton definition = null;

    for (int i = 0; i<lexicon.getLexemeCount(); i++)
    {
      lexeme = lexicon.getLexeme(i);
      automaton.setLexemeSymbol(i, (lexeme.getSymbol()!=null) ? lexeme.getSymbol().getName() : null);

      definition = (new PatternAutomatonBuilder(lexeme.getDefinition())).getPatternAutomaton();
      if (definition!=null)
        automaton.setLexemeDefinition(i, definition);
      else
        throw new IllegalArgumentException("Couldn't create PatternAutomaton for "+
                                           lexeme.getSymbol()+" of \""+lexeme.getDefinition()+"\"");
    }

    this.automaton = automaton;
  }
View Full Code Here

TOP

Related Classes of net.sourceforge.chaperon.model.lexicon.Lexeme

Copyright © 2018 www.massapicom. 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.