Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
wlfxb - a library for creating and processing of TCF data streams. Copyright (C) Yana Panchenko. This file is part of wlfxb. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
 
 
 package eu.clarin.weblicht.wlfxb.tc.xb;
 
 import java.util.List;

Author(s):
Yana Panchenko
 
 public class LemmasLayerStored extends TextCorpusLayerStoredAbstract implements LemmasLayer {
 
     public static final String XML_NAME = "lemmas";
     @XmlElement(name = .)
     private List<LemmaStoredlemmas = new ArrayList<LemmaStored>();
 
     protected LemmasLayerStored() {
     }
 
     protected LemmasLayerStored(TextCorpusLayersConnector connector) {
         this. = connector;
     }
 
     @Override
     protected void setLayersConnector(TextCorpusLayersConnector connector) {
         this. = connector;
         for (int i = 0; i < .size(); i++) {
             LemmaStored lemma = .get(i);
             for (String tokRef : lemma.tokRefs) {
                 connector.token2ItsLemma.put(connector.tokenId2ItsToken.get(tokRef), lemma);
             }
             if (lemma.lemmaId == null) {
                 lemma.lemmaId = . + "_" + i;
             }
             connector.lemmaId2ItsLemma.put(lemma.lemmaIdlemma);
         }
     }
 
     @Override
     public boolean isEmpty() {
         return .isEmpty();
     }
 
     @Override
     public int size() {
         return .size();
     }
 
     @Override
     public Lemma getLemma(int index) {
         Lemma lemma = .get(index);
         return lemma;
     }
 
     @Override
     public Lemma getLemma(Token token) {
         Lemma lemma = ..get(token);
         return lemma;
     }
 
     @Override
     public Token[] getTokens(Lemma lemma) {
         if (lemma instanceof LemmaStored) {
             LemmaStored lemmaStored = (LemmaStoredlemma;
             return WlfUtilities.tokenIdsToTokens(lemmaStored.tokRefs.);
        } else {
            return null;
        }
    }
    @Override
    public Lemma addLemma(String lemmaStringToken lemmaToken) {
        List<TokenlemmaTokens = Arrays.asList(new Token[]{lemmaToken});
        return addLemma(lemmaStringlemmaTokens);
    }
    @Override
    public Lemma addLemma(String lemmaStringList<TokenlemmaTokens) {
        LemmaStored lemma = new LemmaStored();
        int lemmaCount = .size();
        lemma.lemmaId = . + lemmaCount;
        lemma.lemmaString = lemmaString;
        lemma.tokRefs = new String[lemmaTokens.size()];
        for (int i = 0; i < lemmaTokens.size(); i++) {
            Token lemmaToken = lemmaTokens.get(i);
            lemma.tokRefs[i] = lemmaToken.getID();
            ..put(lemmaTokenlemma);
        }
        .add(lemma);
        return lemma;
    }
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(" : ");
        sb.append(.toString());
        return sb.toString();
    }
New to GrepCode? Check out our FAQ X