fn parse_line(linestr: &str) -> Result<(f64, Vec<(i32, f64)>)> {
    let line = linestr.trim();
    let tokens: Vec<&str> = line.split(' ').collect();
    match tokens.len() {
        0 => Err(SvmErr::ParseError("Failed to parse empty line".to_owned())),
        1 => Ok((try!(parse_output_var(tokens[0])), Vec::new())),
        _ => {
            let y = try!(parse_output_var(tokens[0]));
            let mut xs = Vec::new();
            for token in &tokens[1..] {
                let line_pairs = try!(parse_index_value_pair(token));
                xs.push(line_pairs);
            }
            Ok((y, xs))
        }
    }
}
/// Parse a line from the svm file format. A line consists of an output variable and a list of
/// <index>:value pairs, separated by spaces. The line must end with an <index>:<value> pair with
/// an index of -1.
///
/// Examples:
/// +1 1:1, 2:-2.3 -1:0
/// -1
/// 2
Parse a line from the svm file format. A line consists of an output variable and a list of
:value pairs, separated by spaces. The line must end with an : pair with
an index of -1.


Parse a line from the svm file format . A line consists of an output variable and a list of : value pairs separated by spaces . The line must end with an : pair with an index of - 1 .
fn parse_line(linestr: &str) -> Result<(f64, Vec<(i32, f64)>)> {
    let line = linestr.trim();
    let tokens: Vec<&str> = line.split(' ').collect();
    match tokens.len() {
        0 => Err(SvmErr::ParseError("Failed to parse empty line".to_owned())),
        1 => Ok((try!(parse_output_var(tokens[0])), Vec::new())),
        _ => {
            let y = try!(parse_output_var(tokens[0]));
            let mut xs = Vec::new();
            for token in &tokens[1..] {
                let line_pairs = try!(parse_index_value_pair(token));
                xs.push(line_pairs);
            }
            Ok((y, xs))
        }
    }
}
fn parse_line ( linestr : & str ) -> Result < ( f64 , Vec < ( i32 , f64 ) > ) > { let line = linestr . trim ( ) ; let tokens : Vec < & str > = line . split ( ' ' ) . collect ( ) ; match tokens . len ( ) { 0 => Err ( SvmErr :: ParseError ( " " . to_owned ( ) ) ) , 1 => Ok ( ( try ! ( parse_output_var ( tokens [ 0 ] ) ) , Vec :: new ( ) ) ) , _ => { let y = try ! ( parse_output_var ( tokens [ 0 ] ) ) ; let mut xs = Vec :: new ( ) ; for token in & tokens [ 1 .. ] { let line_pairs = try ! ( parse_index_value_pair ( token ) ) ; xs . push ( line_pairs ) ; } Ok ( ( y , xs ) ) } } }
Parse a line from the svm file format.
Parse a line from the svm file format .
linestr
&str
linestr
&str