Class ChunkSample

  • All Implemented Interfaces:
    java.io.Serializable

    public class ChunkSample
    extends java.lang.Object
    implements java.io.Serializable
    Class for holding chunks for a single unit of text.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      ChunkSample​(java.lang.String[] sentence, java.lang.String[] tags, java.lang.String[] preds)
      Initializes the current instance.
      ChunkSample​(java.util.List<java.lang.String> sentence, java.util.List<java.lang.String> tags, java.util.List<java.lang.String> preds)
      Initializes the current instance.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      Span[] getPhrasesAsSpanList()
      Gets the phrases as an array of spans
      java.lang.String[] getPreds()
      Gets the Chunk tags in B-* I-* notation
      java.lang.String[] getSentence()
      Gets the training sentence
      java.lang.String[] getTags()
      Gets the POS Tags for the sentence
      int hashCode()  
      java.lang.String nicePrint()
      Creates a nice to read string for the phrases formatted as following:
      [NP Rockwell_NNP ] [VP said_VBD ] [NP the_DT agreement_NN ] [VP calls_VBZ ] [SBAR for_IN ] [NP it_PRP ] [VP to_TO supply_VB ] [NP 200_CD additional_JJ so-called_JJ shipsets_NNS ] [PP for_IN ] [NP the_DT planes_NNS ] ._.
      static Span[] phrasesAsSpanList​(java.lang.String[] aSentence, java.lang.String[] aTags, java.lang.String[] aPreds)
      Static method to create arrays of spans of phrases
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ChunkSample

        public ChunkSample​(java.lang.String[] sentence,
                           java.lang.String[] tags,
                           java.lang.String[] preds)
        Initializes the current instance.
        Parameters:
        sentence - training sentence
        tags - POS Tags for the sentence
        preds - Chunk tags in B-* I-* notation
      • ChunkSample

        public ChunkSample​(java.util.List<java.lang.String> sentence,
                           java.util.List<java.lang.String> tags,
                           java.util.List<java.lang.String> preds)
        Initializes the current instance.
        Parameters:
        sentence - training sentence
        tags - POS Tags for the sentence
        preds - Chunk tags in B-* I-* notation
    • Method Detail

      • getSentence

        public java.lang.String[] getSentence()
        Gets the training sentence
      • getTags

        public java.lang.String[] getTags()
        Gets the POS Tags for the sentence
      • getPreds

        public java.lang.String[] getPreds()
        Gets the Chunk tags in B-* I-* notation
      • getPhrasesAsSpanList

        public Span[] getPhrasesAsSpanList()
        Gets the phrases as an array of spans
      • phrasesAsSpanList

        public static Span[] phrasesAsSpanList​(java.lang.String[] aSentence,
                                               java.lang.String[] aTags,
                                               java.lang.String[] aPreds)
        Static method to create arrays of spans of phrases
        Parameters:
        aSentence - training sentence
        aTags - POS Tags for the sentence
        aPreds - Chunk tags in B-* I-* notation
        Returns:
        the phrases as an array of spans
      • nicePrint

        public java.lang.String nicePrint()
        Creates a nice to read string for the phrases formatted as following:
        [NP Rockwell_NNP ] [VP said_VBD ] [NP the_DT agreement_NN ] [VP calls_VBZ ] [SBAR for_IN ] [NP it_PRP ] [VP to_TO supply_VB ] [NP 200_CD additional_JJ so-called_JJ shipsets_NNS ] [PP for_IN ] [NP the_DT planes_NNS ] ._.
        Returns:
        a nice to read string representation of the chunk phases
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object