public class SimpleLayeredSequence extends Object implements LayeredSequence
LayeredSequence. This class represents
a sequence with multiple layers (e.g. a sentence with words and
part-of-speech tags). In this implementation, the length of the sequence is
fixed and the values at each position in the sequence cannot be changed. New
layers can be added.| Constructor and Description |
|---|
SimpleLayeredSequence(int length)
Constructs a new layered sequence with the given length
|
| Modifier and Type | Method and Description |
|---|---|
void |
addLayer(String layerName,
com.google.common.collect.ImmutableList<String> layer)
Adds a new layer to the sequence
|
void |
addLayer(String layerName,
List<String> layer)
Adds a new layer to the sequence.
|
void |
addLayer(String layerName,
String[] layer)
Adds a new layer to the sequence
|
boolean |
equals(Object obj) |
String |
get(String layerName,
int index) |
com.google.common.collect.ImmutableList<String> |
getLayer(String layerName) |
String |
getLayerAsString(String layerName) |
String |
getLayerAsString(String layerName,
int start,
int length) |
String |
getLayerAsString(String layerName,
edu.washington.cs.knowitall.commonlib.Range r) |
Collection<String> |
getLayerNames() |
int |
getLength() |
int |
getNumLayers() |
SimpleLayeredSequence |
getSubSequence(int start,
int length)
Returns the subsequence of this layered sequence starting at the given
position with the given length
|
SimpleLayeredSequence |
getSubSequence(edu.washington.cs.knowitall.commonlib.Range r)
Returns the subsequence of this layered sequence starting at the given
position with the given length
|
com.google.common.collect.ImmutableList<String> |
getSubSequence(String layerName,
int start,
int length) |
List<String> |
getSubSequence(String layerName,
edu.washington.cs.knowitall.commonlib.Range r) |
int |
hashCode() |
boolean |
hasLayer(String layerName) |
public SimpleLayeredSequence(int length)
length - public com.google.common.collect.ImmutableList<String> getLayer(String layerName)
layerName - public int getNumLayers()
getNumLayers in interface LayeredSequencepublic int getLength()
getLength in interface LayeredSequencepublic void addLayer(String layerName, com.google.common.collect.ImmutableList<String> layer) throws SequenceException
layerName - layer - SequenceException - if a layer with layerName already exists or the given layer
has the incorrect lengthpublic void addLayer(String layerName, List<String> layer)
layer.layerName - layer - SequenceException - if a layer with layerName already exists or the given layer
has the incorrect lengthpublic void addLayer(String layerName, String[] layer) throws SequenceException
layerName - layer - SequenceException - if a layer with layerName already exists or the given layer
has the incorrect lengthpublic boolean hasLayer(String layerName)
hasLayer in interface LayeredSequencelayerName - public String get(String layerName, int index)
get in interface LayeredSequencepublic com.google.common.collect.ImmutableList<String> getSubSequence(String layerName, int start, int length)
layerName - start - length - public List<String> getSubSequence(String layerName, edu.washington.cs.knowitall.commonlib.Range r)
layerName - r - public SimpleLayeredSequence getSubSequence(int start, int length)
start - length - public SimpleLayeredSequence getSubSequence(edu.washington.cs.knowitall.commonlib.Range r)
r - public Collection<String> getLayerNames()
getLayerNames in interface LayeredSequencepublic String getLayerAsString(String layerName)
layerName - public String getLayerAsString(String layerName, edu.washington.cs.knowitall.commonlib.Range r)
layerName - r - public String getLayerAsString(String layerName, int start, int length)
layerName - start - length - Copyright © 2010-2013 University of Washington CSE. All Rights Reserved.