Class Matrix

  • All Implemented Interfaces:
    nzilbb.util.CloneableBean

    public class Matrix
    extends Object
    implements nzilbb.util.CloneableBean
    Complete search matrix.
    • Constructor Summary

      Constructors 
      Constructor Description
      Matrix()  
    • Constructor Detail

      • Matrix

        public Matrix()
    • Method Detail

      • getParticipantQuery

        @ClonedProperty
        public String getParticipantQuery()
        Getter for participantQuery: Query to identify participants whose utterances should be searched.
        Returns:
        Query to identify participants whose utterances should be searched.
      • setParticipantQuery

        public Matrix setParticipantQuery​(String newParticipantQuery)
        Setter for participantQuery: Query to identify participants whose utterances should be searched.
        Parameters:
        newParticipantQuery - Query to identify participants whose utterances should be searched. An empty string results in null being assigned.
      • getTranscriptQuery

        @ClonedProperty
        public String getTranscriptQuery()
        Getter for transcriptQuery: Query to identify transcripts whose utterances should be searched.
        Returns:
        Query to identify transcripts whose utterances should be searched.
      • setTranscriptQuery

        public Matrix setTranscriptQuery​(String newTranscriptQuery)
        Setter for transcriptQuery: Query to identify transcripts whose utterances should be searched.
        Parameters:
        newTranscriptQuery - Query to identify transcripts whose utterances should be searched. An empty string results in null being assigned.
      • getColumns

        @ClonedProperty
        public Vector<Column> getColumns()
        Getter for columns: The columns of the search matrix, each representing patterns matching one word token.
        Returns:
        The columns of the search matrix, each representing patterns matching one word token.
      • setColumns

        public Matrix setColumns​(Vector<Column> newColumns)
        Setter for columns: The columns of the search matrix, each representing patterns matching one word token.
        Parameters:
        newColumns - The columns of the search matrix, each representing patterns matching one word token.
      • addColumn

        public Matrix addColumn​(Column column)
        Convenience builder-pattern method for adding a column.
        Parameters:
        column -
        Returns:
        This matrix.
      • fromJson

        public nzilbb.util.CloneableBean fromJson​(javax.json.JsonObject json)
        Initializes the bean with the given JSON representation.
        Specified by:
        fromJson in interface nzilbb.util.CloneableBean
        Parameters:
        json -
        Returns:
        A reference to this object.
      • fromJsonString

        public Matrix fromJsonString​(String jsonString)
        Deserialize a search matrix from a JSON-encoded string.
        Parameters:
        jsonString -
        Returns:
        This matrix.
      • fromLegacyString

        public Matrix fromLegacyString​(String search)
        Defines the matrix using a string formatted in the legacy LaBB-CAT encoding.

        A search string can be something like like pos:N\nphonemes:.*[aeiou]\tpos:V\nphonemes:[aeiou].*

        Which searches for A word with N on the pos layer, and ending with a vowel on the phonemes layer, followed by a word with V on the pos layer and starting with a vowel on the phonemes layer.

        The delimiters and formats of the parts are:

        \n
        start new layer
        \t
        start new search word column
        :
        Separator between layer ID and its search expression. If this is omitted, the whole string is assumed to be an expression to match on the orthography layer - i.e. the string expression is the same as orthography:expression.
        layer name
        The layer ID.
        expression
        The the regular expressions can be preceded by NOT indicating it's a reversed match. Or, for numeric layers, the expression may be of the form min<max, which is interpreted as minlabel<max
        Parameters:
        search -
        Returns:
        This object.
      • layerMatchStream

        public Stream<LayerMatch> layerMatchStream()
        A stream of LayerMatchs defined in the matrix.
        Returns:
        A stream of LayerMatchs defined in the matrix.
      • getTargetLayerId

        public String getTargetLayerId()
        Returns the layer ID of the (first) LayerMatch where LayerMatch.target == true.
        Returns:
        The layer ID of the (first) LayerMatch where LayerMatch.target == true, or null if there is no such LayerMatch.
      • getTargetColumn

        public int getTargetColumn()
        Determines which column the (first) LayerMatch where LayerMatch.target == true is located in.
        Returns:
        The index of the column the (first) LayerMatch where LayerMatch.target == true is located in, or -1 if there is no such LayerMatch.
      • getDescription

        public String getDescription()
        A curt semi-human-readable summary of the matrix that can be used for probably-unique, more or less descriptive file names, etc.
        Returns:
        A string describing the layer matches.
      • toString

        public String toString()
        Returns the JSON serialization of this search matrix.
        Overrides:
        toString in class Object
        Returns:
        The JSON serialization of this search matrix.