@@ -0,0 +1,3260 @@
+// BSD License (http://lemurproject.org/galago-license)%0Apackage org.lemurproject.galago.contrib.parse;%0A%0Aimport org.lemurproject.galago.core.parse.Document;%0Aimport org.lemurproject.galago.core.parse.DocumentStreamParser;%0Aimport org.lemurproject.galago.core.types.DocumentSplit;%0Aimport org.lemurproject.galago.tupleflow.Parameters;%0A%0Aimport java.io.BufferedReader;%0Aimport java.io.File;%0Aimport java.io.IOException;%0A%0A/**%0A * Reads documents delimited by a line delimiter.%0A * Assumed the first line contains the document id (former DOCNO-tag).%0A *%0A * Optionally, a docId prefix can be configured via docIdPrefix. If configured, documents are skipped if first line does not start with the docIdPrefix.%0A *%0A * Default line delimiter is %22----------%22 (10 hyphens).%0A * The line can only contain the delimiter and followed by whitespace, otherwise it won't be accepted as a delimiter.%0A *%0A * A different line delimiter can be configured via option %22linedelim%22.%0A *%0A * Make sure that the line delimiter is not used in the contents of the documents!%0A *%0A *%0A * @author dietz%0A */%0Apublic class SingleFileParser extends DocumentStreamParser %7B%0A%0A    protected BufferedReader reader;%0A    protected String identifier;%0A    private int debugCounter = 0;%0A%0A    public SingleFileParser(DocumentSplit split, Parameters pp) throws IOException %7B%0A        super(split, pp);%0A        this.reader = getBufferedReader(split);%0A%0A//        Parameters p = null;%0A//        for(Object parserP_ : pp.getList(%22externalParsers%22))%7B%0A//            Parameters parserP = (Parameters) parserP_;%0A//            if(parserP.get(%22filetype%22,%22%22).equalsIgnoreCase(split.fileType))%7B%0A//                p = parserP;%0A//            %7D%0A//        %7D%0A//        if(p == null) p = new Parameters();%0A        try%7B%0A        identifier = split.fileName;%0A        int idx;%0A        if((idx=identifier.lastIndexOf(File.separator))%3E=0)%7B%0A            identifier = identifier.substring(idx+1);%0A        %7D%0A        if(split.fileType != null && identifier.endsWith(split.fileType)) %7B%0A            identifier = identifier.substring(0, identifier.length()-split.fileType.length()-1);%0A        %7D%0A%0A        if(debugCounter%25100==0)%7B%0A            System.out.println(%22Created SingleFileParser with filename %22+identifier);%0A        %7D%0A        debugCounter++;%0A        %7D catch(Exception e) %7B%0A            e.printStackTrace();%0A            System.err.println(%22split.fileName=%22+split.fileName);%0A            System.err.println(%22split.fileType=%22+split.fileType);%0A        %7D%0A    %7D%0A%0A%0A    public Document nextDocument() throws IOException %7B%0A        String line;%0A%0A        if (reader == null) %7B%0A            return null;%0A        %7D%0A%0A        if (identifier.length() == 0) %7B%0A            return null;%0A        %7D%0A%0A        StringBuilder buffer = new StringBuilder();%0A%0A        int lines = 0;%0A        while ((line = reader.readLine()) != null) %7B%0A            buffer.append(line);%0A            buffer.append('%5Cn');%0A            lines ++;%0A        %7D%0A%0A        if(lines == 0) return null;%0A%0A//        System.out.println(identifier+ %22%5Ct%5Ct%22+lines+%22 lines.%22);%0A        return new Document(identifier, buffer.toString());%0A    %7D%0A%0A    @Override%0A    public void close() throws IOException %7B%0A        if (this.reader != null) %7B%0A            this.reader.close();%0A            this.reader = null;%0A        %7D%0A    %7D%0A%7D%0A

Add SingleFile parser, where filename is the document id