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 static final String XML_NAME = "namedEntities";
     @XmlAttribute(name = ., required = true)
     private String type;
     private List<NamedEntityStoredentities = new ArrayList<NamedEntityStored>();
     private Set<StringfoundTypes = new HashSet<String>();
 
     protected NamedEntitiesLayerStored() {
     }
 
     protected NamedEntitiesLayerStored(String type) {
         this. = type;
     }
 
     protected NamedEntitiesLayerStored(TextCorpusLayersConnector connector) {
         this. = connector;
     }
 
     protected void setLayersConnector(TextCorpusLayersConnector connector) {
         this. = connector;
         for (NamedEntityStored ne : ) {
             for (String tokRef : ne.tokRefs) {
                 //connector.token2ItsNE.put(connector.tokenId2ItsToken.get(tokRef), ne);
                 Token tok = connector.tokenId2ItsToken.get(tokRef);
                 if (!connector.token2ItsNE.containsKey(tok)) {
                     connector.token2ItsNE.put(toknew ArrayList<NamedEntity>());
                 }
                 connector.token2ItsNE.get(tok).add(ne);
             }
             .add(ne.getType());
         }
     }
 
     @Override
     public boolean isEmpty() {
         return .isEmpty();
     }
 
     @Override
     public int size() {
         return .size();
     }
 
     @Override
     public String getType() {
         return ;
     }
 
     @Override
     public Set<StringgetFoundTypes() {
         return ;
     }
 
     @Override
     public NamedEntity getEntity(int index) {
         return .get(index);
     }
    @Override
    public NamedEntity getEntity(Token token) {
        List<NamedEntitynes = ..get(token);
        if (nes != null && !nes.isEmpty()) {
            return nes.get(0);
        } else {
            return null;
        }
    }
    @Override
    public List<NamedEntitygetEntities(Token token) {
        List<NamedEntitynes = ..get(token);
        return nes;
    }
    @Override
    public Token[] getTokens(NamedEntity entity) {
        if (entity instanceof NamedEntityStored) {
            NamedEntityStored ne = (NamedEntityStoredentity;
            return WlfUtilities.tokenIdsToTokens(ne.tokRefs.);
        } else {
            return null;
        }
    }
    @Override
    public NamedEntity addEntity(String entityTypeToken tagToken) {
        List<TokentagTokens = Arrays.asList(new Token[]{tagToken});
        return addEntity(entityTypetagTokens);
    }
    @Override
    public NamedEntity addEntity(String entityTypeList<TokenentityTokens) {
        NamedEntityStored ne = new NamedEntityStored();
        ne.type = entityType;
        ne.tokRefs = new String[entityTokens.size()];
        for (int i = 0; i < entityTokens.size(); i++) {
            Token token = entityTokens.get(i);
            ne.tokRefs[i] = token.getID();
            //connector.token2ItsNE.put(token, ne);
            Token tok = ..get(token.getID());
            if (!..containsKey(tok)) {
                ..put(toknew ArrayList<NamedEntity>());
            }
            ..get(tok).add(ne);
        }
        .add(ne);
        this..add(ne.getType());
        return ne;
    }
    @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