function [segmentation,comments] = readSegmentationAnnotation(filename)


fid = fopen(filename,'r');

if fid<0
    fprintf('%s\n', filename);
    error('Can''t open annotation file');
end
comments = [];
comCounter = 1;
% tline = fgetl(fid);
% while strcmp(tline(1), '%')
%     comments{comCounter} = tline;
%     comCounter = comCounter + 1;
%     tline = fgetl(fid);
% end


% now starts annotation, one segment per line
% segmentation = zeros(numStanza,1);

segCounter = 1;

while true
    tline = fgetl(fid);
    if ~ischar(tline)||isempty(tline),   break,   end
    if strcmp(tline(1), '%')
        comments{comCounter} = tline;
        comCounter = comCounter + 1;
    else
        [seg,pos] = textscan(tline,'%f %f','delimiter','''', 'CollectOutput', 0);
        label = textscan(tline(pos+1:end),'%s','delimiter','''');
        label = label{:};
        segmentation(segCounter).start = seg{1};
        segmentation(segCounter).end = seg{2};
        segmentation(segCounter).label = label{1};
        segCounter = segCounter + 1;
    end
end

fclose(fid);