001 // Copyright 2012, 2013 Brad Block, Pawjaw, LLC. (an Ohio Limited Liability Company) 002 // 003 // This file is part of JBTCRF. 004 // 005 // JBTCRF is free software: you can redistribute it and/or modify 006 // it under the terms of the GNU General Public License as published by 007 // the Free Software Foundation, either version 3 of the License, or 008 // (at your option) any later version. 009 // 010 // JBTCRF is distributed in the hope that it will be useful, 011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 013 // GNU General Public License for more details. 014 // 015 // You should have received a copy of the GNU General Public License 016 // along with JBTCRF. If not, see <http://www.gnu.org/licenses/>. 017 018 package com.pawjaw.classification.crf.lmcbt.readers; 019 020 import com.pawjaw.classification.crf.lmcbt.points.Point; 021 import java.io.BufferedReader; 022 import java.io.File; 023 import java.io.FileReader; 024 import java.io.IOException; 025 import java.util.List; 026 027 public abstract class LabeledSequenceDataReader { 028 public abstract void readPoints(List<Point[]> pointss, List<int[]> true_labelss, BufferedReader br) throws IOException; 029 030 public abstract int getPointFeatureCount(); 031 032 public abstract int getLabelCount(); 033 034 public void readFile(List<Point[]> pointss, List<int[]> true_labelss, File f) throws IOException { 035 BufferedReader br = new BufferedReader(new FileReader(f)); 036 readPoints(pointss, true_labelss, br); 037 br.close(); 038 } 039 }