Class ChunkSample

    • Constructor Detail

      • ChunkSample

        public ChunkSample​(String[] sentence,
                           String[] tags,
                           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​(List<String> sentence,
                           List<String> tags,
                           List<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 String[] getSentence()
        Gets the training sentence
      • getTags

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

        public 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​(String[] aSentence,
                                               String[] aTags,
                                               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 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
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object