lib/anystyle/parser/parser.rb
# Returns an array of label/segment pairs for each line in the passed-in string.
Returns an array of label/segment pairs for each line in the passed-in string.
Returns an array of label / segment pairs for each line in the passed - in string .
def label(input, labelled = false)
        model.label(prepare(input, labelled)).map! do |sequence|
          sequence.inject([]) do |ts, (token, label)|
            token, label = token[/^\S+/], label.to_sym
            if (prev = ts[-1]) && prev[0] == label
              prev[1] << ' ' << token
              ts
            else
              ts << [label, token]
            end
          end
        end
      end
def label ( input , labelled = false ) model . label ( prepare ( input , labelled ) ) . map! do | sequence | sequence . inject ( [ ] ) do | ts , ( token , label ) | token , label = token [ / ^ \S + / ] , label . to_sym if ( prev = ts [ - 1 ] ) && prev [ 0 ] == label prev [ 1 ] << ' ' << token ts else ts << [ label , token ] end end end end
Returns an array of label/segment pairs for each line in the passed-in string.
Returns an array of label / segment pairs for each line in the passed - in string .
input
<not_specific>
labelled
<not_specific>