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.*;

Author(s):
Yana Panchenko
 
 public class WordSensesLayerStored extends TextCorpusLayerStoredAbstract implements WordSensesLayer {
 
     public static final String XML_NAME = "wsd";
     private String source;
     private List<WordSenseStoredsenses = new ArrayList<WordSenseStored>();
 
     protected WordSensesLayerStored() {
     }
 
     protected WordSensesLayerStored(String source) {
         this. = source;
     }
 
     protected WordSensesLayerStored(TextCorpusLayersConnector connector) {
         this. = connector;
     }
 
     @Override
     protected void setLayersConnector(TextCorpusLayersConnector connector) {
         this. = connector;
         for (WordSenseStored ws : ) {
             for (String tokRef : ws.tokRefs) {
                 connector.token2ItsWordSense.put(connector.tokenId2ItsToken.get(tokRef), ws);
             }
         }
     }
 
     @Override
     public boolean isEmpty() {
         return .isEmpty();
     }
 
     @Override
     public String getSource() {
         return ;
     }
 
     @Override
     public int size() {
         return .size();
     }
 
     @Override
     public WordSense getWordSense(int index) {
         return .get(index);
     }
     
     @Override
     public WordSense getWordSense(Token token) {
         WordSense ws = ..get(token);
         return ws;
     }
    @Override
    public Token[] getTokens(WordSense ws) {
        if (ws instanceof WordSenseStored) {
            WordSenseStored sense = (WordSenseStoredws;
            Token[] tokens = new Token[sense.tokRefs.length];
            for (int i = 0; i < sense.tokRefs.lengthi++) {
                tokens[i] = this...get(sense.tokRefs[i]);
            }
            return tokens;
        } else {
            throw new UnsupportedOperationException(WlfUtilities.layersErrorMessage(Orthform.classLexicalSemanticsLayerStored.class));
        }
    }
    
    @Override
    public WordSense addWordSense(Token tokenString ... lexicalUnits) {
        List<Tokentokens = Arrays.asList(new Token[]{token});
        return addWordSense(tokensnulllexicalUnits);
    }
    
    @Override
    public WordSense addWordSense(List<TokentokensString ... lexicalUnits) {
        return addWordSense(tokensnulllexicalUnits);
    }
    
    @Override
    public WordSense addWordSense(Token tokenString commentString ... lexicalUnits) {
        List<Tokentokens = Arrays.asList(new Token[]{token});
        return addWordSense(tokenscommentlexicalUnits);
    }
    
    @Override
    public WordSense addWordSense(List<TokentokensString commentString ... lexicalUnits) {
        WordSenseStored ws = new WordSenseStored();
        ws.comment = comment;
        ws.lexunits = new String[lexicalUnits.length];
        System.arraycopy(lexicalUnits, 0, ws.lexunits, 0, lexicalUnits.length);
        ws.tokRefs = new String[tokens.size()];
        for (int i = 0; i < tokens.size(); i++) {
            Token token = tokens.get(i);
            ws.tokRefs[i] = token.getID();
            ..put(tokenws);
        }
        .add(ws);
        return ws;
    }
    
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        sb.append();
        sb.append("}");
        sb.append(" : ");
        sb.append(.toString());
        return sb.toString();
    }
New to GrepCode? Check out our FAQ X